diff --git a/FindCMDEF.cmake b/FindCMDEF.cmake index 6370c12..78e280a 100644 --- a/FindCMDEF.cmake +++ b/FindCMDEF.cmake @@ -30,5 +30,7 @@ INCLUDE(${CMAKE_CURRENT_LIST_DIR}/system_modules/CMDEF_LINK_OPTION.cmake) INCLUDE(${CMAKE_CURRENT_LIST_DIR}/system_modules/CMDEF_INSTALL.cmake) INCLUDE(${CMAKE_CURRENT_LIST_DIR}/system_modules/CMDEF_PACKAGE.cmake) +INCLUDE(${CMAKE_CURRENT_LIST_DIR}/system_modules/CMDEF_CLEANUP.cmake) + INCLUDE(${CMAKE_CURRENT_LIST_DIR}/system_modules/CMDEF_HELPER.cmake) diff --git a/doc/CacheVariables.md b/doc/CacheVariables.md index 77a5b10..ddac198 100644 --- a/doc/CacheVariables.md +++ b/doc/CacheVariables.md @@ -31,10 +31,10 @@ It tries to set the variable in the following order ## CMDEF_BUILD_TYPE_CMAKE_BUILD_TYPE_OVERRIDE:BOOL=\ -Indicate if the CMAKE_BUILD_TYPE is overriden by CMDEF library. +Indicate if the CMAKE_BUILD_TYPE is overridden by CMDEF library. - If the CMAKE_BUILD_TYPE is not set the CMDEF try to set the CMAKE_BUILD_TYPE variable - to the predefined value stored in CMDEF_BUILD_TYPE_DEFAULT variable. In this case the vairable is set to ON. + to the predefined value stored in CMDEF_BUILD_TYPE_DEFAULT variable. In this case the variable is set to ON. - If the CMAKE_BUILD_TYPE is set explicitly the variable is set to OFF. ## CMDEF_BUILD_TYPE_DEFAULT:STRING=Debug @@ -43,7 +43,7 @@ Default build type if CMAKE_BUILD_TYPE is not specified. ## CMDEF_BUILD_TYPE_LIST:STRING,LIST=\ -List of the suported byuld types. CMAKE_BUILD_TYPE must hold exactly one value from this list. +List of the supported byuld types. CMAKE_BUILD_TYPE must hold exactly one value from this list. Type: String, List diff --git a/example/executable/CMakeLists.txt b/example/executable/CMakeLists.txt index 2ddcb38..b999f37 100644 --- a/example/executable/CMakeLists.txt +++ b/example/executable/CMakeLists.txt @@ -14,6 +14,7 @@ PROJECT(${CMAKE_PROJECT_NAME}) FIND_PACKAGE(CMLIB COMPONENTS CMDEF) +CMDEF_CLEANUP() # # Add Definitions for each build type globally @@ -36,7 +37,7 @@ IF(CMDEF_OS_LINUX) ) ELSEIF(CMDEF_OS_WINDOWS) CMDEF_COMPILE_OPTIONS( - ALL /wd4996 # Disable deprectation warning on Windows OS + ALL /wd4996 # Disable deprecation warning on Windows OS ) ENDIF() @@ -53,7 +54,7 @@ CMDEF_ADD_EXECUTABLE( CMDEF_COMPILE_DEFINITIONS_TARGET( TARGET executable - VISIBLITY PUBLIC + VISIBILITY PUBLIC ALL RETURN_CODE=245 DEBUG RETURN_CODE_DEBUG=1000 RELEASE RETURN_CODE_RELEASE=2020 @@ -66,7 +67,7 @@ CMDEF_COMPILE_DEFINITIONS_TARGET( ADD_EXECUTABLE(cmake_executable main.c) CMDEF_COMPILE_DEFINITIONS_TARGET( TARGET cmake_executable - VISIBLITY PRIVATE + VISIBILITY PRIVATE ALL RETURN_CODE=255 DEBUG RETURN_CODE_DEBUG=10000 RELEASE RETURN_CODE_RELEASE=20200 @@ -94,3 +95,12 @@ CMDEF_PACKAGE( # SET(CPACK_GENERATOR ZIP) INCLUDE(CPack) + +function(dump_cmake_variables) + get_cmake_property(_variableNames VARIABLES) + list (SORT _variableNames) + foreach (_variableName IN LISTS _variableNames) + message(STATUS "${_variableName}=${${_variableName}}") + endforeach() +endfunction() +dump_cmake_variables() \ No newline at end of file diff --git a/example/library-interface/CMakeLists.txt b/example/library-interface/CMakeLists.txt index 85b436f..e4bf1f4 100644 --- a/example/library-interface/CMakeLists.txt +++ b/example/library-interface/CMakeLists.txt @@ -104,7 +104,7 @@ CMDEF_INSTALL(TARGET testlink-executable NAMESPACE testlib-shared::) # CMDEF_COMPILE_OPTIONS_TARGET( TARGET testlib-shared - VISIBLITY PUBLIC + VISIBILITY PUBLIC DEBUG -Wall ) diff --git a/example/library-interface/main.cpp b/example/library-interface/main.cpp index 5d6b697..fd6eeee 100644 --- a/example/library-interface/main.cpp +++ b/example/library-interface/main.cpp @@ -1,5 +1,5 @@ /** - * @brief Test exacutable to test all defined symbols are linked correctly + * @brief Test executable to test all defined symbols are linked correctly */ #include diff --git a/example/library/CMakeLists.txt b/example/library/CMakeLists.txt index 64de75e..54b8f11 100644 --- a/example/library/CMakeLists.txt +++ b/example/library/CMakeLists.txt @@ -49,7 +49,7 @@ CMDEF_ADD_LIBRARY( # CMDEF_COMPILE_OPTIONS_TARGET( TARGET testlib-shared - VISIBLITY PUBLIC + VISIBILITY PUBLIC DEBUG -Wall ) diff --git a/system_modules/CMDEF_BUILD_TYPE.cmake b/system_modules/CMDEF_BUILD_TYPE.cmake index 9514499..29c17c7 100644 --- a/system_modules/CMDEF_BUILD_TYPE.cmake +++ b/system_modules/CMDEF_BUILD_TYPE.cmake @@ -28,7 +28,7 @@ SET(CMDEF_BUILD_TYPE_DEFAULT "Debug" MACRO(_CMDEF_BUILD_TYPE_SET_CMAKE_BUILD_TYPE_OVERRIDE opt ${ARGN}) SET(CMDEF_BUILD_TYPE_CMAKE_BUILD_TYPE_OVERRIDE ${opt} CACHE BOOL - "ON if the CMAKE_BUILD_TYPE is overriden by CMDEF, OFF otherwise" + "ON if the CMAKE_BUILD_TYPE is overridden by CMDEF, OFF otherwise" ${ARGN} ) ENDMACRO() @@ -65,7 +65,7 @@ UNSET(all_find) ## -# Initialize CMake veriables according to CMDEF definitions +# Initialize CMake variables according to CMDEF definitions # # ( # ) diff --git a/system_modules/CMDEF_COMPILE_DEFINITION.cmake b/system_modules/CMDEF_COMPILE_DEFINITION.cmake index 24499b6..6195e26 100644 --- a/system_modules/CMDEF_COMPILE_DEFINITION.cmake +++ b/system_modules/CMDEF_COMPILE_DEFINITION.cmake @@ -22,7 +22,7 @@ INCLUDE(${CMAKE_CURRENT_LIST_DIR}/CMDEF_ADD_LIBRARY.cmake) # from BUILD_TYPE list. # # LANG -array, if specified must be one of CMDEF_SUPPORTED_LANG_LIST. -# If not specified no exact languege is select +# If not specified no exact language is select # # Each definition is passed to ADD_COMPILE_DEFINITION # by generator_expression $<:${definitnion}> @@ -78,20 +78,20 @@ ENDFUNCTION() # from BUILD_TYPE list. # # LANG - array, if specified must be one of CMDEF_SUPPORTED_LANG_LIST. -# If not specified no exact languege is select +# If not specified no exact language is select # # Each definition is passed to TARGET_COMPILE_DEFINITION # by generator_expression $<:${definitnion}> # -# VISIBLITY is passed to visiblity section of TARGET_LINK_OPTIONS. -# If no visiblity specified than visiblity is omitted +# VISIBILITY is passed to visibility section of TARGET_LINK_OPTIONS. +# If no visibility specified than visibility is omitted # # ( # TARGET # [LANG M] # [ALL ] # [ ]{1,} -# [VISIBLITY ] +# [VISIBILITY ] # ) # FUNCTION(CMDEF_COMPILE_DEFINITIONS_TARGET) @@ -101,9 +101,9 @@ FUNCTION(CMDEF_COMPILE_DEFINITIONS_TARGET) ${CMDEF_BUILD_TYPE_LIST_UPPERCASE} ONE_VALUE TARGET - VISIBLITY + VISIBILITY REQUIRED - TARGET VISIBLITY + TARGET VISIBILITY P_ARGN ${ARGN} ) @@ -125,9 +125,9 @@ FUNCTION(CMDEF_COMPILE_DEFINITIONS_TARGET) IF(DEFINED __LANG) SET(condition $,$>) SET(compile_definitions $<${condition}:${${build_type_var}}>) - TARGET_COMPILE_DEFINITIONS(${original_target_name} ${__VISIBLITY} ${compile_definitions}) + TARGET_COMPILE_DEFINITIONS(${original_target_name} ${__VISIBILITY} ${compile_definitions}) ELSE() - TARGET_COMPILE_DEFINITIONS(${original_target_name} ${__VISIBLITY} $<$:${${build_type_var}}>) + TARGET_COMPILE_DEFINITIONS(${original_target_name} ${__VISIBILITY} $<$:${${build_type_var}}>) ENDIF() ENDFOREACH() ENDFUNCTION() diff --git a/system_modules/CMDEF_COMPILE_OPTION.cmake b/system_modules/CMDEF_COMPILE_OPTION.cmake index 8851234..463b778 100644 --- a/system_modules/CMDEF_COMPILE_OPTION.cmake +++ b/system_modules/CMDEF_COMPILE_OPTION.cmake @@ -23,7 +23,7 @@ INCLUDE(${CMAKE_CURRENT_LIST_DIR}/CMDEF_ADD_LIBRARY.cmake) # from BUILD_TYPE list. # # LANG - array, If specified must be on CMDEF_SUPPORTED_LANG_LIST. -# If not specified no exact languege is select +# If not specified no exact language is select # # Each definition is passed to ADD_COMPILE_OPTIONS # by generator_expression $<:${option}> @@ -79,20 +79,20 @@ ENDMACRO() # to each BUILD_TYPE # # LANG - array, if specified must be one of CMDEF_SUPPORTED_LANG_LIST. -# If not specified no exact languege is select +# If not specified no exact language is select # # Each definition is passed to ADD_COMPILE_OPTIONS # by generator_expression $<:${option}> # -# VISIBLITY is passed to visiblity section of TARGET_LINK_OPTIONS. -# If no visiblity specified than visiblity is omitted +# VISIBILITY is passed to visibility section of TARGET_LINK_OPTIONS. +# If no visibility specified than visibility is omitted # # ( # TARGET # [LANG ] # [ALL ] # [ ]{1,} -# [VISIBLITY ] +# [VISIBILITY ] # ) # FUNCTION(CMDEF_COMPILE_OPTIONS_TARGET) @@ -102,10 +102,10 @@ FUNCTION(CMDEF_COMPILE_OPTIONS_TARGET) ${CMDEF_BUILD_TYPE_LIST_UPPERCASE} ONE_VALUE TARGET - VISIBLITY + VISIBILITY REQUIRED TARGET - VISIBLITY + VISIBILITY P_ARGN ${ARGN} ) @@ -128,9 +128,9 @@ FUNCTION(CMDEF_COMPILE_OPTIONS_TARGET) SET(option ${${build_type_var}}) SET(condition $,$>) SET(compile_options $<${condition}:${option}>) - TARGET_COMPILE_OPTIONS(${original_target_name} ${__VISIBLITY} ${compile_options}) + TARGET_COMPILE_OPTIONS(${original_target_name} ${__VISIBILITY} ${compile_options}) ELSE() - TARGET_COMPILE_OPTIONS(${original_target_name} ${__VISIBLITY} $<$:${${build_type_var}}>) + TARGET_COMPILE_OPTIONS(${original_target_name} ${__VISIBILITY} $<$:${${build_type_var}}>) ENDIF() ENDFOREACH() ENDFUNCTION() diff --git a/system_modules/CMDEF_ENV.cmake b/system_modules/CMDEF_ENV.cmake index a5d9213..d63c00a 100644 --- a/system_modules/CMDEF_ENV.cmake +++ b/system_modules/CMDEF_ENV.cmake @@ -3,7 +3,6 @@ # initialize base CMDEF CMake variables. # # Module relay on some CMake variables like -# - CMAKE_SIZEOF_VOID_P (not defined for Script mode) # - CMAKE_CURRENT_BINARY_DIR (defined as "${CMAKE_CURRENT_LIST_DIR}" for script mode) # @@ -281,7 +280,7 @@ MACRO(_CMDEF_ENV_SET_OS) ENDIF() SET(CMDEF_ARCHITECTURE ${arch} CACHE STRING - "Achitecture for which we will compile" + "Architecture for which we will compile" ) ENDIF() MESSAGE(STATUS "Architecture: ${CMDEF_ARCHITECTURE}") @@ -377,7 +376,7 @@ ENDMACRO() # FUNCTION(_CMDEF_ENV_SET_WINDOWS_FLAGS) IF(NOT DEFINED CMDEF_OS_WINDOWS) - MESSAGE(FATAL_ERROR "Canot determine target OS. Not defined.") + MESSAGE(FATAL_ERROR "Cannot determine target OS. Not defined.") ENDIF() IF(NOT CMDEF_OS_WINDOWS) RETURN() @@ -404,7 +403,7 @@ FUNCTION(_CMDEF_ENV_SET_DESCRIPTION) ) SET(CMDEF_ENV_DESCRIPTION_COPYRIGHT "${CMDEF_ENV_DESCRIPTION_COMPANY_NAME}" CACHE STRING - "Copyrigth which will be added to binaries" + "Copyright which will be added to binaries" ) ENDFUNCTION() @@ -469,7 +468,7 @@ FUNCTION(_CMDEF_ENV_GET_DISTRO_ID distro_id) STRING(TOLOWER "${_distro_id_mapped}" _distro_id_normalized) IF(NOT _distro_id_normalized) MESSAGE(FATAL_ERROR "Cannot determine Distro ID." - "It seems the system has Distro ID set to empty or invalid string." + " It seems the system has Distro ID set to empty or invalid string." " Consult os-release file." ) ENDIF() @@ -503,7 +502,7 @@ FUNCTION(_CMDEF_ENV_GET_DISTRO_VERSION_ID version_id) STRING(REGEX REPLACE "[^a-zA-Z0-9.]" "-" _version_id_mapped "${_version_id}") STRING(TOLOWER "${_version_id_mapped}" _version_id_normalized) IF(NOT _version_id_normalized) - MESSAGE(FATAL "Cannot determine Distro Version ID." + MESSAGE(FATAL_ERROR "Cannot determine Distro Version ID." " It seems the system has Distro Version ID set to empty or invalid string." " Consult os-release file." ) diff --git a/system_modules/CMDEF_LINK_OPTION.cmake b/system_modules/CMDEF_LINK_OPTION.cmake index 20e4b91..7d30fd6 100644 --- a/system_modules/CMDEF_LINK_OPTION.cmake +++ b/system_modules/CMDEF_LINK_OPTION.cmake @@ -21,7 +21,7 @@ INCLUDE(${CMAKE_CURRENT_LIST_DIR}/CMDEF_ADD_LIBRARY.cmake) # to each BUILD_TYPE # # LANG - array, if specified must be one of CMDEF_SUPPORTED_LANG_LIST. -# If not specified no exact languege is select +# If not specified no exact language is select # # Each definition is passed to ADD_LINK_OPTIONS # by generator_expression $<:${option}> @@ -78,20 +78,20 @@ ENDFUNCTION() # to each BUILD_TYPE # # LANG - array, if specified must be one of CMDEF_SUPPORTED_LANG_LIST. -# If not specified no exact languege is select +# If not specified no exact language is select # # Each definition is passed to ADD_LINK_OPTIONS # by generator_expression $<:${option}> # -# VISIBLITY is passed to visiblity section of TARGET_LINK_OPTIONS. -# If no visiblity specified than visiblity is omitted +# VISIBILITY is passed to visibility section of TARGET_LINK_OPTIONS. +# If no visibility specified than visibility is omitted # # ( # TARGET # [LANG M] # [ALL ] # [ ]{1,} -# [VISIBLITY ] +# [VISIBILITY ] # ) # FUNCTION(CMDEF_LINK_OPTIONS_TARGET) @@ -101,7 +101,7 @@ FUNCTION(CMDEF_LINK_OPTIONS_TARGET) ${CMDEF_BUILD_TYPE_LIST_UPPERCASE} ONE_VALUE TARGET - VISIBLITY + VISIBILITY REQUIRED TARGET P_ARGN ${ARGN} @@ -126,9 +126,9 @@ FUNCTION(CMDEF_LINK_OPTIONS_TARGET) SET(option ${${build_type_var}}) SET(condition $,$>) SET(link_options $<${condition}:${option}>) - TARGET_LINK_OPTIONS(${original_target_name} ${__VISIBLITY} ${link_options}) + TARGET_LINK_OPTIONS(${original_target_name} ${__VISIBILITY} ${link_options}) ELSE() - TARGET_LINK_OPTIONS(${original_target_name} ${__VISIBLITY} $<$:${${build_type_var}}>) + TARGET_LINK_OPTIONS(${original_target_name} ${__VISIBILITY} $<$:${${build_type_var}}>) ENDIF() ENDFOREACH() ENDFUNCTION() diff --git a/system_modules/CMDEF_RESOURCE.cmake b/system_modules/CMDEF_RESOURCE.cmake index 9fd0aca..ef9f0d8 100644 --- a/system_modules/CMDEF_RESOURCE.cmake +++ b/system_modules/CMDEF_RESOURCE.cmake @@ -1,6 +1,6 @@ ## Main # -# Manage resources for binaries. Specialy for Windows. +# Manage resources for binaries. Specially for Windows. # INCLUDE_GUARD(GLOBAL) @@ -17,7 +17,7 @@ FIND_PACKAGE(CMLIB REQUIRED) # RESOURCE_FILE is absolute path to Resource file # # DEFINITIONS is list of key-value pairs which is treated as -# definitons for cmd line command which process RESOURCE_FILE +# definitions for cmd line command which process RESOURCE_FILE # # ( # RESOURCE_TARGET