Improve coding style in CMake modules
This commit is contained in:
parent
eea5aa57bc
commit
0dcbb3de55
|
@ -1,6 +1,10 @@
|
||||||
cmake_minimum_required(VERSION 3.3.0 FATAL_ERROR)
|
cmake_minimum_required(VERSION 3.3.0 FATAL_ERROR)
|
||||||
|
|
||||||
if(NOT DEFINED THIRD_PARTY_MODULE_LOADED)
|
# prevent multiple inclusion
|
||||||
|
if(DEFINED THIRD_PARTY_MODULE_LOADED)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
set(THIRD_PARTY_MODULE_LOADED YES)
|
||||||
|
|
||||||
macro(save_default_library_suffixes)
|
macro(save_default_library_suffixes)
|
||||||
set(DEFAULT_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
set(DEFAULT_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||||
|
@ -267,6 +271,3 @@ if(NOT DEFINED THIRD_PARTY_MODULE_LOADED)
|
||||||
use_external_library(iconv ${LINKAGE} ${REQUIRED})
|
use_external_library(iconv ${LINKAGE} ${REQUIRED})
|
||||||
endif()
|
endif()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
set(THIRD_PARTY_MODULE_LOADED YES)
|
|
||||||
endif()
|
|
||||||
|
|
|
@ -3,8 +3,10 @@ if(NOT BASIC_PROJECT_CONFIG_DONE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
option(NO_DOXYGEN "whether creation of Doxygen targets is disabled (enabled by default)" OFF)
|
option(NO_DOXYGEN "whether creation of Doxygen targets is disabled (enabled by default)" OFF)
|
||||||
|
|
||||||
if(NOT NO_DOXYGEN)
|
if(NOT NO_DOXYGEN)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
# find doxygen.h template
|
# find doxygen.h template
|
||||||
include(TemplateFinder)
|
include(TemplateFinder)
|
||||||
find_template_file("doxygen" CPP_UTILITIES DOXYGEN_TEMPLATE_FILE)
|
find_template_file("doxygen" CPP_UTILITIES DOXYGEN_TEMPLATE_FILE)
|
||||||
|
@ -27,7 +29,9 @@ if(NOT NO_DOXYGEN)
|
||||||
|
|
||||||
if(NOT DOXYGEN_BIN)
|
if(NOT DOXYGEN_BIN)
|
||||||
message(WARNING "Doxygen not found, unable to add target for generating API documentation for ${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX}")
|
message(WARNING "Doxygen not found, unable to add target for generating API documentation for ${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX}")
|
||||||
else()
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
# load cached configuration and other variables
|
# load cached configuration and other variables
|
||||||
set(DOXY_LANGUAGE "English" CACHE STRING "specifies the language of the API documentation generated with Doxygen")
|
set(DOXY_LANGUAGE "English" CACHE STRING "specifies the language of the API documentation generated with Doxygen")
|
||||||
set(DOXY_CUSTOM_CONFIG "" CACHE STRING "specifies extra options for Doxygen")
|
set(DOXY_CUSTOM_CONFIG "" CACHE STRING "specifies extra options for Doxygen")
|
||||||
|
@ -75,6 +79,3 @@ if(NOT NO_DOXYGEN)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
message(STATUS "Generating target for generating API documentation for ${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX} with Doxygen")
|
message(STATUS "Generating target for generating API documentation for ${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX} with Doxygen")
|
||||||
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
|
@ -4,8 +4,10 @@ endif()
|
||||||
|
|
||||||
option(SHELL_COMPLETION_ENABLED "controls whether shell completion is enabled in general" ON)
|
option(SHELL_COMPLETION_ENABLED "controls whether shell completion is enabled in general" ON)
|
||||||
option(BASH_COMPLETION_ENABLED "controls whether shell completion for bash is enabled" ON)
|
option(BASH_COMPLETION_ENABLED "controls whether shell completion for bash is enabled" ON)
|
||||||
|
if(NOT SHELL_COMPLETION_ENABLED)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
if(SHELL_COMPLETION_ENABLED)
|
|
||||||
# add bash completion (currently the only supported shell completion)
|
# add bash completion (currently the only supported shell completion)
|
||||||
if(BASH_COMPLETION_ENABLED)
|
if(BASH_COMPLETION_ENABLED)
|
||||||
# find bash-completion.sh template
|
# find bash-completion.sh template
|
||||||
|
@ -34,4 +36,3 @@ if(SHELL_COMPLETION_ENABLED)
|
||||||
|
|
||||||
message(STATUS "Generating files for bash completion.")
|
message(STATUS "Generating files for bash completion.")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
if(NOT DEFINED TEMPLATE_FINDER_LOADED)
|
# prevent multiple inclusion
|
||||||
|
if(DEFINED TEMPLATE_FINDER_LOADED)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
set(TEMPLATE_FINDER_LOADED YES)
|
||||||
|
|
||||||
function(find_template_file FILE_NAME PROJECT_VAR_NAME OUTPUT_VAR)
|
function(find_template_file FILE_NAME PROJECT_VAR_NAME OUTPUT_VAR)
|
||||||
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/${FILE_NAME}.in")
|
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/${FILE_NAME}.in")
|
||||||
|
@ -17,6 +21,3 @@ if(NOT DEFINED TEMPLATE_FINDER_LOADED)
|
||||||
message(FATAL_ERROR "Template for ${FILE_NAME} file can not be located.")
|
message(FATAL_ERROR "Template for ${FILE_NAME} file can not be located.")
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
set(TEMPLATE_FINDER_LOADED YES)
|
|
||||||
endif()
|
|
||||||
|
|
|
@ -6,10 +6,13 @@ if(NOT BASIC_PROJECT_CONFIG_DONE)
|
||||||
message(FATAL_ERROR "Before including the WindowsResources module, the LibraryConfig/ApplicationConfig module must be included.")
|
message(FATAL_ERROR "Before including the WindowsResources module, the LibraryConfig/ApplicationConfig module must be included.")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
option(WINDOWS_RESOURCES_ENABLED "controls Windows resources are enabled" ON)
|
option(WINDOWS_RESOURCES_ENABLED "controls whether Windows resources are enabled" ON)
|
||||||
option(WINDOWS_ICON_ENABLED "controls Windows icon is enabled" ON)
|
option(WINDOWS_ICON_ENABLED "controls whether Windows icon is enabled" ON)
|
||||||
|
|
||||||
|
if(NOT MINGW OR NOT WINDOWS_RESOURCES_ENABLED)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
if(MINGW AND WINDOWS_RESOURCES_ENABLED)
|
|
||||||
# find rc template
|
# find rc template
|
||||||
include(TemplateFinder)
|
include(TemplateFinder)
|
||||||
find_template_file("windows.rc" CPP_UTILITIES RC_TEMPLATE_FILE)
|
find_template_file("windows.rc" CPP_UTILITIES RC_TEMPLATE_FILE)
|
||||||
|
@ -42,7 +45,7 @@ if(MINGW AND WINDOWS_RESOURCES_ENABLED)
|
||||||
message(FATAL_ERROR "The specified PNG_ICON_PATH \"${PNG_ICON_PATH}\" is invalid.")
|
message(FATAL_ERROR "The specified PNG_ICON_PATH \"${PNG_ICON_PATH}\" is invalid.")
|
||||||
endif()
|
endif()
|
||||||
unset(USING_DEFAULT_PNG_ICON_PATH)
|
unset(USING_DEFAULT_PNG_ICON_PATH)
|
||||||
endif(FFMPEG_BIN)
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# create Windows rc file from template
|
# create Windows rc file from template
|
||||||
|
@ -55,4 +58,3 @@ if(MINGW AND WINDOWS_RESOURCES_ENABLED)
|
||||||
set(CMAKE_RC_COMPILER_INIT windres)
|
set(CMAKE_RC_COMPILER_INIT windres)
|
||||||
set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> <FLAGS> -O coff <DEFINES> -i <SOURCE> -o <OBJECT>")
|
set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> <FLAGS> -O coff <DEFINES> -i <SOURCE> -o <OBJECT>")
|
||||||
enable_language(RC)
|
enable_language(RC)
|
||||||
endif()
|
|
||||||
|
|
Loading…
Reference in New Issue