diff options
author | Kitware Robot <kwrobot@kitware.com> | 2019-05-10 19:34:33 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-05-14 19:26:46 (GMT) |
commit | 932dcce1e63b98739ab547f2146a39310c2d0e1e (patch) | |
tree | 6802b7f96be03d8bfee2867c0f308307982d6ffc | |
parent | e2d0aea2c734c8c5028f3573082e75bd157dbe72 (diff) | |
download | CMake-932dcce1e63b98739ab547f2146a39310c2d0e1e.zip CMake-932dcce1e63b98739ab547f2146a39310c2d0e1e.tar.gz CMake-932dcce1e63b98739ab547f2146a39310c2d0e1e.tar.bz2 |
Modules: Consistently use 2 space indentation
48 files changed, 1624 insertions, 1627 deletions
diff --git a/Modules/AddFileDependencies.cmake b/Modules/AddFileDependencies.cmake index 4a4e645..598a52f 100644 --- a/Modules/AddFileDependencies.cmake +++ b/Modules/AddFileDependencies.cmake @@ -16,13 +16,13 @@ Adds the given ``<files>`` to the dependencies of file ``<source>``. macro(ADD_FILE_DEPENDENCIES _file) - get_source_file_property(_deps ${_file} OBJECT_DEPENDS) - if (_deps) - set(_deps ${_deps} ${ARGN}) - else () - set(_deps ${ARGN}) - endif () - - set_source_files_properties(${_file} PROPERTIES OBJECT_DEPENDS "${_deps}") + get_source_file_property(_deps ${_file} OBJECT_DEPENDS) + if (_deps) + set(_deps ${_deps} ${ARGN}) + else () + set(_deps ${ARGN}) + endif () + + set_source_files_properties(${_file} PROPERTIES OBJECT_DEPENDS "${_deps}") endmacro() diff --git a/Modules/BasicConfigVersion-AnyNewerVersion.cmake.in b/Modules/BasicConfigVersion-AnyNewerVersion.cmake.in index afffc04..a6e5fda 100644 --- a/Modules/BasicConfigVersion-AnyNewerVersion.cmake.in +++ b/Modules/BasicConfigVersion-AnyNewerVersion.cmake.in @@ -26,12 +26,12 @@ endif() # if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it: if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "@CMAKE_SIZEOF_VOID_P@" STREQUAL "") - return() + return() endif() # check that the installed version has the same 32/64bit-ness as the one which is currently searching: if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "@CMAKE_SIZEOF_VOID_P@") - math(EXPR installedBits "@CMAKE_SIZEOF_VOID_P@ * 8") - set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)") - set(PACKAGE_VERSION_UNSUITABLE TRUE) + math(EXPR installedBits "@CMAKE_SIZEOF_VOID_P@ * 8") + set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)") + set(PACKAGE_VERSION_UNSUITABLE TRUE) endif() diff --git a/Modules/BasicConfigVersion-ExactVersion.cmake.in b/Modules/BasicConfigVersion-ExactVersion.cmake.in index fe5c2e5..43fc4d0 100644 --- a/Modules/BasicConfigVersion-ExactVersion.cmake.in +++ b/Modules/BasicConfigVersion-ExactVersion.cmake.in @@ -41,7 +41,7 @@ endif() # if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it: if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "@CMAKE_SIZEOF_VOID_P@" STREQUAL "") - return() + return() endif() # check that the installed version has the same 32/64bit-ness as the one which is currently searching: diff --git a/Modules/BasicConfigVersion-SameMajorVersion.cmake.in b/Modules/BasicConfigVersion-SameMajorVersion.cmake.in index d885c0f..8c3b6a2 100644 --- a/Modules/BasicConfigVersion-SameMajorVersion.cmake.in +++ b/Modules/BasicConfigVersion-SameMajorVersion.cmake.in @@ -40,7 +40,7 @@ endif() # if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it: if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "@CMAKE_SIZEOF_VOID_P@" STREQUAL "") - return() + return() endif() # check that the installed version has the same 32/64bit-ness as the one which is currently searching: diff --git a/Modules/BasicConfigVersion-SameMinorVersion.cmake.in b/Modules/BasicConfigVersion-SameMinorVersion.cmake.in index bf055e8..e2030d2 100644 --- a/Modules/BasicConfigVersion-SameMinorVersion.cmake.in +++ b/Modules/BasicConfigVersion-SameMinorVersion.cmake.in @@ -44,7 +44,7 @@ endif() # if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it: if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "@CMAKE_SIZEOF_VOID_P@" STREQUAL "") - return() + return() endif() # check that the installed version has the same 32/64bit-ness as the one which is currently searching: diff --git a/Modules/CMakeAddNewLanguage.txt b/Modules/CMakeAddNewLanguage.txt index 6baadc3..b0be590 100644 --- a/Modules/CMakeAddNewLanguage.txt +++ b/Modules/CMakeAddNewLanguage.txt @@ -17,15 +17,15 @@ changes in release notes. CMakeDetermine(LANG)Compiler.cmake -> this should find the compiler for LANG and configure CMake(LANG)Compiler.cmake.in CMake(LANG)Compiler.cmake.in -> used by CMakeDetermine(LANG)Compiler.cmake - This file is used to store compiler information and is copied down into try - compile directories so that try compiles do not need to re-determine and test the LANG + This file is used to store compiler information and is copied down into try + compile directories so that try compiles do not need to re-determine and test the LANG CMakeTest(LANG)Compiler.cmake -> test the compiler and set: - SET(CMAKE_(LANG)_COMPILER_WORKS 1 CACHE INTERNAL "") + SET(CMAKE_(LANG)_COMPILER_WORKS 1 CACHE INTERNAL "") CMake(LANG)Information.cmake -> set up rule variables for LANG : - CMAKE_(LANG)_CREATE_SHARED_LIBRARY - CMAKE_(LANG)_CREATE_SHARED_MODULE - CMAKE_(LANG)_CREATE_STATIC_LIBRARY - CMAKE_(LANG)_COMPILE_OBJECT - CMAKE_(LANG)_LINK_EXECUTABLE + CMAKE_(LANG)_CREATE_SHARED_LIBRARY + CMAKE_(LANG)_CREATE_SHARED_MODULE + CMAKE_(LANG)_CREATE_STATIC_LIBRARY + CMAKE_(LANG)_COMPILE_OBJECT + CMAKE_(LANG)_LINK_EXECUTABLE diff --git a/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake b/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake index 5b9ed34..e1ce617 100644 --- a/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake +++ b/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake @@ -7,29 +7,29 @@ # any way between releases. macro (CHECK_COMPILER_FLAG_COMMON_PATTERNS _VAR) - set(${_VAR} - FAIL_REGEX "[Uu]nrecogni[sz]ed .*option" # GNU, NAG - FAIL_REGEX "unknown .*option" # Clang - FAIL_REGEX "optimization flag .* not supported" # Clang - FAIL_REGEX "unknown argument ignored" # Clang (cl) - FAIL_REGEX "ignoring unknown option" # MSVC, Intel - FAIL_REGEX "warning D9002" # MSVC, any lang - FAIL_REGEX "option.*not supported" # Intel - FAIL_REGEX "invalid argument .*option" # Intel - FAIL_REGEX "ignoring option .*argument required" # Intel - FAIL_REGEX "ignoring option .*argument is of wrong type" # Intel - FAIL_REGEX "[Uu]nknown option" # HP - FAIL_REGEX "[Ww]arning: [Oo]ption" # SunPro - FAIL_REGEX "command option .* is not recognized" # XL - FAIL_REGEX "command option .* contains an incorrect subargument" # XL - FAIL_REGEX "Option .* is not recognized. Option will be ignored." # XL - FAIL_REGEX "not supported in this configuration. ignored" # AIX - FAIL_REGEX "File with unknown suffix passed to linker" # PGI - FAIL_REGEX "[Uu]nknown switch" # PGI - FAIL_REGEX "WARNING: unknown flag:" # Open64 - FAIL_REGEX "Incorrect command line option:" # Borland - FAIL_REGEX "Warning: illegal option" # SunStudio 12 - FAIL_REGEX "[Ww]arning: Invalid suboption" # Fujitsu - FAIL_REGEX "An invalid option .* appears on the command line" # Cray - ) + set(${_VAR} + FAIL_REGEX "[Uu]nrecogni[sz]ed .*option" # GNU, NAG + FAIL_REGEX "unknown .*option" # Clang + FAIL_REGEX "optimization flag .* not supported" # Clang + FAIL_REGEX "unknown argument ignored" # Clang (cl) + FAIL_REGEX "ignoring unknown option" # MSVC, Intel + FAIL_REGEX "warning D9002" # MSVC, any lang + FAIL_REGEX "option.*not supported" # Intel + FAIL_REGEX "invalid argument .*option" # Intel + FAIL_REGEX "ignoring option .*argument required" # Intel + FAIL_REGEX "ignoring option .*argument is of wrong type" # Intel + FAIL_REGEX "[Uu]nknown option" # HP + FAIL_REGEX "[Ww]arning: [Oo]ption" # SunPro + FAIL_REGEX "command option .* is not recognized" # XL + FAIL_REGEX "command option .* contains an incorrect subargument" # XL + FAIL_REGEX "Option .* is not recognized. Option will be ignored." # XL + FAIL_REGEX "not supported in this configuration. ignored" # AIX + FAIL_REGEX "File with unknown suffix passed to linker" # PGI + FAIL_REGEX "[Uu]nknown switch" # PGI + FAIL_REGEX "WARNING: unknown flag:" # Open64 + FAIL_REGEX "Incorrect command line option:" # Borland + FAIL_REGEX "Warning: illegal option" # SunStudio 12 + FAIL_REGEX "[Ww]arning: Invalid suboption" # Fujitsu + FAIL_REGEX "An invalid option .* appears on the command line" # Cray + ) endmacro () diff --git a/Modules/CMakeDetermineASM_MASMCompiler.cmake b/Modules/CMakeDetermineASM_MASMCompiler.cmake index 789b049..80188fb 100644 --- a/Modules/CMakeDetermineASM_MASMCompiler.cmake +++ b/Modules/CMakeDetermineASM_MASMCompiler.cmake @@ -8,10 +8,10 @@ set(ASM_DIALECT "_MASM") # if we are using the 64bit cl compiler, assume we also want the 64bit assembler if(";${CMAKE_VS_PLATFORM_NAME};${MSVC_C_ARCHITECTURE_ID};${MSVC_CXX_ARCHITECTURE_ID};" - MATCHES ";(Win64|Itanium|x64|IA64);") - set(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT ml64) + MATCHES ";(Win64|Itanium|x64|IA64);") + set(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT ml64) else() - set(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT ml) + set(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT ml) endif() include(CMakeDetermineASMCompiler) diff --git a/Modules/CMakeDetermineCSharpCompiler.cmake b/Modules/CMakeDetermineCSharpCompiler.cmake index 5802b15..dab9414 100644 --- a/Modules/CMakeDetermineCSharpCompiler.cmake +++ b/Modules/CMakeDetermineCSharpCompiler.cmake @@ -2,7 +2,7 @@ # file Copyright.txt or https://cmake.org/licensing for details. if(NOT ${CMAKE_GENERATOR} MATCHES "Visual Studio ([^9]|[9][0-9])") - message(FATAL_ERROR + message(FATAL_ERROR "C# is currently only supported for Microsoft Visual Studio 2010 and later.") endif() diff --git a/Modules/CMakeDetermineVSServicePack.cmake b/Modules/CMakeDetermineVSServicePack.cmake index a3c4d9c..53868d2 100644 --- a/Modules/CMakeDetermineVSServicePack.cmake +++ b/Modules/CMakeDetermineVSServicePack.cmake @@ -44,32 +44,32 @@ endif() # [INTERNAL] # Please do not call this function directly function(_DetermineVSServicePackFromCompiler _OUT_VAR _cl_version) - if (${_cl_version} VERSION_EQUAL "14.00.50727.42") - set(_version "vc80") - elseif(${_cl_version} VERSION_EQUAL "14.00.50727.762") - set(_version "vc80sp1") - elseif(${_cl_version} VERSION_EQUAL "15.00.21022.08") - set(_version "vc90") - elseif(${_cl_version} VERSION_EQUAL "15.00.30729.01") - set(_version "vc90sp1") - elseif(${_cl_version} VERSION_EQUAL "16.00.30319.01") - set(_version "vc100") - elseif(${_cl_version} VERSION_EQUAL "16.00.40219.01") - set(_version "vc100sp1") - elseif(${_cl_version} VERSION_EQUAL "17.00.50727.1") - set(_version "vc110") - elseif(${_cl_version} VERSION_EQUAL "17.00.51106.1") - set(_version "vc110sp1") - elseif(${_cl_version} VERSION_EQUAL "17.00.60315.1") - set(_version "vc110sp2") - elseif(${_cl_version} VERSION_EQUAL "17.00.60610.1") - set(_version "vc110sp3") - elseif(${_cl_version} VERSION_EQUAL "17.00.61030") - set(_version "vc110sp4") - else() - set(_version "") - endif() - set(${_OUT_VAR} ${_version} PARENT_SCOPE) + if (${_cl_version} VERSION_EQUAL "14.00.50727.42") + set(_version "vc80") + elseif(${_cl_version} VERSION_EQUAL "14.00.50727.762") + set(_version "vc80sp1") + elseif(${_cl_version} VERSION_EQUAL "15.00.21022.08") + set(_version "vc90") + elseif(${_cl_version} VERSION_EQUAL "15.00.30729.01") + set(_version "vc90sp1") + elseif(${_cl_version} VERSION_EQUAL "16.00.30319.01") + set(_version "vc100") + elseif(${_cl_version} VERSION_EQUAL "16.00.40219.01") + set(_version "vc100sp1") + elseif(${_cl_version} VERSION_EQUAL "17.00.50727.1") + set(_version "vc110") + elseif(${_cl_version} VERSION_EQUAL "17.00.51106.1") + set(_version "vc110sp1") + elseif(${_cl_version} VERSION_EQUAL "17.00.60315.1") + set(_version "vc110sp2") + elseif(${_cl_version} VERSION_EQUAL "17.00.60610.1") + set(_version "vc110sp3") + elseif(${_cl_version} VERSION_EQUAL "17.00.61030") + set(_version "vc110sp4") + else() + set(_version "") + endif() + set(${_OUT_VAR} ${_version} PARENT_SCOPE) endfunction() diff --git a/Modules/CMakeExpandImportedTargets.cmake b/Modules/CMakeExpandImportedTargets.cmake index ae26cc2..b8f471c 100644 --- a/Modules/CMakeExpandImportedTargets.cmake +++ b/Modules/CMakeExpandImportedTargets.cmake @@ -42,108 +42,107 @@ ${CMAKE_CONFIGURATION_TYPES} if set, otherwise ${CMAKE_BUILD_TYPE}. function(CMAKE_EXPAND_IMPORTED_TARGETS _RESULT ) - set(options ) - set(oneValueArgs CONFIGURATION ) - set(multiValueArgs LIBRARIES ) - - cmake_parse_arguments(CEIT "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - - if(CEIT_UNPARSED_ARGUMENTS) - message(FATAL_ERROR "Unknown keywords given to CMAKE_EXPAND_IMPORTED_TARGETS(): \"${CEIT_UNPARSED_ARGUMENTS}\"") - endif() - - if(NOT CEIT_CONFIGURATION) - # Would be better to test GENERATOR_IS_MULTI_CONFIG global property, - # but the documented behavior specifically says we check - # CMAKE_CONFIGURATION_TYPES and fall back to CMAKE_BUILD_TYPE if no - # config types are defined. - if(CMAKE_CONFIGURATION_TYPES) - list(GET CMAKE_CONFIGURATION_TYPES 0 CEIT_CONFIGURATION) - else() - set(CEIT_CONFIGURATION ${CMAKE_BUILD_TYPE}) - endif() - endif() - - # handle imported library targets - - set(_CCSR_REQ_LIBS ${CEIT_LIBRARIES}) - - set(_CHECK_FOR_IMPORTED_TARGETS TRUE) - set(_CCSR_LOOP_COUNTER 0) - while(_CHECK_FOR_IMPORTED_TARGETS) - math(EXPR _CCSR_LOOP_COUNTER "${_CCSR_LOOP_COUNTER} + 1 ") - set(_CCSR_NEW_REQ_LIBS ) - set(_CHECK_FOR_IMPORTED_TARGETS FALSE) - foreach(_CURRENT_LIB ${_CCSR_REQ_LIBS}) - if(TARGET "${_CURRENT_LIB}") - get_target_property(_importedConfigs "${_CURRENT_LIB}" IMPORTED_CONFIGURATIONS) - else() - set(_importedConfigs "") - endif() - if (_importedConfigs) -# message(STATUS "Detected imported target ${_CURRENT_LIB}") - # Ok, so this is an imported target. - # First we get the imported configurations. - # Then we get the location of the actual library on disk of the first configuration. - # then we'll get its link interface libraries property, - # iterate through it and replace all imported targets we find there - # with there actual location. - - # guard against infinite loop: abort after 100 iterations ( 100 is arbitrary chosen) - if ("${_CCSR_LOOP_COUNTER}" LESS 100) - set(_CHECK_FOR_IMPORTED_TARGETS TRUE) -# else () -# message(STATUS "********* aborting loop, counter : ${_CCSR_LOOP_COUNTER}") - endif () - - # if one of the imported configurations equals ${CMAKE_TRY_COMPILE_CONFIGURATION}, - # use it, otherwise simply use the first one: - list(FIND _importedConfigs "${CEIT_CONFIGURATION}" _configIndexToUse) - if("${_configIndexToUse}" EQUAL -1) - set(_configIndexToUse 0) - endif() - list(GET _importedConfigs ${_configIndexToUse} _importedConfigToUse) - - get_target_property(_importedLocation "${_CURRENT_LIB}" IMPORTED_LOCATION_${_importedConfigToUse}) - get_target_property(_linkInterfaceLibs "${_CURRENT_LIB}" IMPORTED_LINK_INTERFACE_LIBRARIES_${_importedConfigToUse} ) - - list(APPEND _CCSR_NEW_REQ_LIBS "${_importedLocation}") -# message(STATUS "Appending lib ${_CURRENT_LIB} as ${_importedLocation}") - if(_linkInterfaceLibs) - foreach(_currentLinkInterfaceLib ${_linkInterfaceLibs}) -# message(STATUS "Appending link interface lib ${_currentLinkInterfaceLib}") - if(_currentLinkInterfaceLib) - list(APPEND _CCSR_NEW_REQ_LIBS "${_currentLinkInterfaceLib}" ) - endif() - endforeach() - endif() - else() - # "Normal" libraries are just used as they are. - list(APPEND _CCSR_NEW_REQ_LIBS "${_CURRENT_LIB}" ) -# message(STATUS "Appending lib directly: ${_CURRENT_LIB}") - endif() - endforeach() - - set(_CCSR_REQ_LIBS ${_CCSR_NEW_REQ_LIBS} ) - endwhile() - - # Finally we iterate once more over all libraries. This loop only removes - # all remaining imported target names (there shouldn't be any left anyway). - set(_CCSR_NEW_REQ_LIBS ) - foreach(_CURRENT_LIB ${_CCSR_REQ_LIBS}) + set(options ) + set(oneValueArgs CONFIGURATION ) + set(multiValueArgs LIBRARIES ) + + cmake_parse_arguments(CEIT "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + if(CEIT_UNPARSED_ARGUMENTS) + message(FATAL_ERROR "Unknown keywords given to CMAKE_EXPAND_IMPORTED_TARGETS(): \"${CEIT_UNPARSED_ARGUMENTS}\"") + endif() + + if(NOT CEIT_CONFIGURATION) + # Would be better to test GENERATOR_IS_MULTI_CONFIG global property, + # but the documented behavior specifically says we check + # CMAKE_CONFIGURATION_TYPES and fall back to CMAKE_BUILD_TYPE if no + # config types are defined. + if(CMAKE_CONFIGURATION_TYPES) + list(GET CMAKE_CONFIGURATION_TYPES 0 CEIT_CONFIGURATION) + else() + set(CEIT_CONFIGURATION ${CMAKE_BUILD_TYPE}) + endif() + endif() + + # handle imported library targets + + set(_CCSR_REQ_LIBS ${CEIT_LIBRARIES}) + + set(_CHECK_FOR_IMPORTED_TARGETS TRUE) + set(_CCSR_LOOP_COUNTER 0) + while(_CHECK_FOR_IMPORTED_TARGETS) + math(EXPR _CCSR_LOOP_COUNTER "${_CCSR_LOOP_COUNTER} + 1 ") + set(_CCSR_NEW_REQ_LIBS ) + set(_CHECK_FOR_IMPORTED_TARGETS FALSE) + foreach(_CURRENT_LIB ${_CCSR_REQ_LIBS}) if(TARGET "${_CURRENT_LIB}") get_target_property(_importedConfigs "${_CURRENT_LIB}" IMPORTED_CONFIGURATIONS) else() set(_importedConfigs "") endif() - if (NOT _importedConfigs) - list(APPEND _CCSR_NEW_REQ_LIBS "${_CURRENT_LIB}" ) -# message(STATUS "final: appending ${_CURRENT_LIB}") - else () -# message(STATUS "final: skipping ${_CURRENT_LIB}") - endif () - endforeach() -# message(STATUS "setting -${_RESULT}- to -${_CCSR_NEW_REQ_LIBS}-") - set(${_RESULT} "${_CCSR_NEW_REQ_LIBS}" PARENT_SCOPE) + if (_importedConfigs) + # message(STATUS "Detected imported target ${_CURRENT_LIB}") + # Ok, so this is an imported target. + # First we get the imported configurations. + # Then we get the location of the actual library on disk of the first configuration. + # then we'll get its link interface libraries property, + # iterate through it and replace all imported targets we find there + # with there actual location. + + # guard against infinite loop: abort after 100 iterations ( 100 is arbitrary chosen) + if ("${_CCSR_LOOP_COUNTER}" LESS 100) + set(_CHECK_FOR_IMPORTED_TARGETS TRUE) +# else () +# message(STATUS "********* aborting loop, counter : ${_CCSR_LOOP_COUNTER}") + endif () + + # if one of the imported configurations equals ${CMAKE_TRY_COMPILE_CONFIGURATION}, + # use it, otherwise simply use the first one: + list(FIND _importedConfigs "${CEIT_CONFIGURATION}" _configIndexToUse) + if("${_configIndexToUse}" EQUAL -1) + set(_configIndexToUse 0) + endif() + list(GET _importedConfigs ${_configIndexToUse} _importedConfigToUse) + + get_target_property(_importedLocation "${_CURRENT_LIB}" IMPORTED_LOCATION_${_importedConfigToUse}) + get_target_property(_linkInterfaceLibs "${_CURRENT_LIB}" IMPORTED_LINK_INTERFACE_LIBRARIES_${_importedConfigToUse} ) + + list(APPEND _CCSR_NEW_REQ_LIBS "${_importedLocation}") +# message(STATUS "Appending lib ${_CURRENT_LIB} as ${_importedLocation}") + if(_linkInterfaceLibs) + foreach(_currentLinkInterfaceLib ${_linkInterfaceLibs}) +# message(STATUS "Appending link interface lib ${_currentLinkInterfaceLib}") + if(_currentLinkInterfaceLib) + list(APPEND _CCSR_NEW_REQ_LIBS "${_currentLinkInterfaceLib}" ) + endif() + endforeach() + endif() + else() + # "Normal" libraries are just used as they are. + list(APPEND _CCSR_NEW_REQ_LIBS "${_CURRENT_LIB}" ) +# message(STATUS "Appending lib directly: ${_CURRENT_LIB}") + endif() + endforeach() + set(_CCSR_REQ_LIBS ${_CCSR_NEW_REQ_LIBS} ) + endwhile() + + # Finally we iterate once more over all libraries. This loop only removes + # all remaining imported target names (there shouldn't be any left anyway). + set(_CCSR_NEW_REQ_LIBS ) + foreach(_CURRENT_LIB ${_CCSR_REQ_LIBS}) + if(TARGET "${_CURRENT_LIB}") + get_target_property(_importedConfigs "${_CURRENT_LIB}" IMPORTED_CONFIGURATIONS) + else() + set(_importedConfigs "") + endif() + if (NOT _importedConfigs) + list(APPEND _CCSR_NEW_REQ_LIBS "${_CURRENT_LIB}" ) +# message(STATUS "final: appending ${_CURRENT_LIB}") +# else () +# message(STATUS "final: skipping ${_CURRENT_LIB}") + endif () + endforeach() +# message(STATUS "setting -${_RESULT}- to -${_CCSR_NEW_REQ_LIBS}-") + set(${_RESULT} "${_CCSR_NEW_REQ_LIBS}" PARENT_SCOPE) endfunction() diff --git a/Modules/CMakeFindCodeBlocks.cmake b/Modules/CMakeFindCodeBlocks.cmake index 13bceb1..bf27ec1 100644 --- a/Modules/CMakeFindCodeBlocks.cmake +++ b/Modules/CMakeFindCodeBlocks.cmake @@ -8,7 +8,7 @@ find_program(CMAKE_CODEBLOCKS_EXECUTABLE NAMES codeblocks DOC "The CodeBlocks executable") if(CMAKE_CODEBLOCKS_EXECUTABLE) - set(CMAKE_OPEN_PROJECT_COMMAND "${CMAKE_CODEBLOCKS_EXECUTABLE} <PROJECT_FILE>" ) + set(CMAKE_OPEN_PROJECT_COMMAND "${CMAKE_CODEBLOCKS_EXECUTABLE} <PROJECT_FILE>" ) endif() # Determine builtin macros and include dirs: diff --git a/Modules/CMakeFindSublimeText2.cmake b/Modules/CMakeFindSublimeText2.cmake index 022d010..7f67bf0 100644 --- a/Modules/CMakeFindSublimeText2.cmake +++ b/Modules/CMakeFindSublimeText2.cmake @@ -19,5 +19,5 @@ find_program(CMAKE_SUBLIMETEXT_EXECUTABLE DOC "The Sublime Text executable") if(CMAKE_SUBLIMETEXT_EXECUTABLE) - set(CMAKE_OPEN_PROJECT_COMMAND "${CMAKE_SUBLIMETEXT_EXECUTABLE} --project <PROJECT_FILE>" ) + set(CMAKE_OPEN_PROJECT_COMMAND "${CMAKE_SUBLIMETEXT_EXECUTABLE} --project <PROJECT_FILE>" ) endif() diff --git a/Modules/CMakeJavaInformation.cmake b/Modules/CMakeJavaInformation.cmake index 11568a8..989afc1 100644 --- a/Modules/CMakeJavaInformation.cmake +++ b/Modules/CMakeJavaInformation.cmake @@ -16,8 +16,8 @@ endif() if(CMAKE_USER_MAKE_RULES_OVERRIDE_Java) # Save the full path of the file so try_compile can use it. - include(${CMAKE_USER_MAKE_RULES_OVERRIDE_Java} RESULT_VARIABLE _override) - set(CMAKE_USER_MAKE_RULES_OVERRIDE_Java "${_override}") + include(${CMAKE_USER_MAKE_RULES_OVERRIDE_Java} RESULT_VARIABLE _override) + set(CMAKE_USER_MAKE_RULES_OVERRIDE_Java "${_override}") endif() # this is a place holder if java needed flags for javac they would go here. diff --git a/Modules/CMakePrintHelpers.cmake b/Modules/CMakePrintHelpers.cmake index 1af0bb7..aa40b59 100644 --- a/Modules/CMakePrintHelpers.cmake +++ b/Modules/CMakePrintHelpers.cmake @@ -42,14 +42,14 @@ Gives:: #]=======================================================================] function(cmake_print_variables) - set(msg "") - foreach(var ${ARGN}) - if(msg) - string(APPEND msg " ; ") - endif() - string(APPEND msg "${var}=\"${${var}}\"") - endforeach() - message(STATUS "${msg}") + set(msg "") + foreach(var ${ARGN}) + if(msg) + string(APPEND msg " ; ") + endif() + string(APPEND msg "${var}=\"${${var}}\"") + endforeach() + message(STATUS "${msg}") endfunction() diff --git a/Modules/CMakePushCheckState.cmake b/Modules/CMakePushCheckState.cmake index f6bfc12..3e519ee 100644 --- a/Modules/CMakePushCheckState.cmake +++ b/Modules/CMakePushCheckState.cmake @@ -40,52 +40,52 @@ Usage: macro(CMAKE_RESET_CHECK_STATE) - set(CMAKE_EXTRA_INCLUDE_FILES) - set(CMAKE_REQUIRED_INCLUDES) - set(CMAKE_REQUIRED_DEFINITIONS) - set(CMAKE_REQUIRED_LINK_OPTIONS) - set(CMAKE_REQUIRED_LIBRARIES) - set(CMAKE_REQUIRED_FLAGS) - set(CMAKE_REQUIRED_QUIET) + set(CMAKE_EXTRA_INCLUDE_FILES) + set(CMAKE_REQUIRED_INCLUDES) + set(CMAKE_REQUIRED_DEFINITIONS) + set(CMAKE_REQUIRED_LINK_OPTIONS) + set(CMAKE_REQUIRED_LIBRARIES) + set(CMAKE_REQUIRED_FLAGS) + set(CMAKE_REQUIRED_QUIET) endmacro() macro(CMAKE_PUSH_CHECK_STATE) - if(NOT DEFINED _CMAKE_PUSH_CHECK_STATE_COUNTER) - set(_CMAKE_PUSH_CHECK_STATE_COUNTER 0) - endif() + if(NOT DEFINED _CMAKE_PUSH_CHECK_STATE_COUNTER) + set(_CMAKE_PUSH_CHECK_STATE_COUNTER 0) + endif() - math(EXPR _CMAKE_PUSH_CHECK_STATE_COUNTER "${_CMAKE_PUSH_CHECK_STATE_COUNTER}+1") + math(EXPR _CMAKE_PUSH_CHECK_STATE_COUNTER "${_CMAKE_PUSH_CHECK_STATE_COUNTER}+1") - set(_CMAKE_EXTRA_INCLUDE_FILES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_EXTRA_INCLUDE_FILES}) - set(_CMAKE_REQUIRED_INCLUDES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_INCLUDES}) - set(_CMAKE_REQUIRED_DEFINITIONS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_DEFINITIONS}) - set(_CMAKE_REQUIRED_LINK_OPTIONS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_LINK_OPTIONS}) - set(_CMAKE_REQUIRED_LIBRARIES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_LIBRARIES}) - set(_CMAKE_REQUIRED_FLAGS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_FLAGS}) - set(_CMAKE_REQUIRED_QUIET_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_QUIET}) + set(_CMAKE_EXTRA_INCLUDE_FILES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_EXTRA_INCLUDE_FILES}) + set(_CMAKE_REQUIRED_INCLUDES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_INCLUDES}) + set(_CMAKE_REQUIRED_DEFINITIONS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_DEFINITIONS}) + set(_CMAKE_REQUIRED_LINK_OPTIONS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_LINK_OPTIONS}) + set(_CMAKE_REQUIRED_LIBRARIES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_LIBRARIES}) + set(_CMAKE_REQUIRED_FLAGS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_FLAGS}) + set(_CMAKE_REQUIRED_QUIET_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_QUIET}) - if (${ARGC} GREATER 0 AND "${ARGV0}" STREQUAL "RESET") - cmake_reset_check_state() - endif() + if (${ARGC} GREATER 0 AND "${ARGV0}" STREQUAL "RESET") + cmake_reset_check_state() + endif() endmacro() macro(CMAKE_POP_CHECK_STATE) # don't pop more than we pushed - if("${_CMAKE_PUSH_CHECK_STATE_COUNTER}" GREATER "0") - - set(CMAKE_EXTRA_INCLUDE_FILES ${_CMAKE_EXTRA_INCLUDE_FILES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}}) - set(CMAKE_REQUIRED_INCLUDES ${_CMAKE_REQUIRED_INCLUDES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}}) - set(CMAKE_REQUIRED_DEFINITIONS ${_CMAKE_REQUIRED_DEFINITIONS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}}) - set(CMAKE_REQUIRED_LINK_OPTIONS ${_CMAKE_REQUIRED_LINK_OPTIONS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}}) - set(CMAKE_REQUIRED_LIBRARIES ${_CMAKE_REQUIRED_LIBRARIES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}}) - set(CMAKE_REQUIRED_FLAGS ${_CMAKE_REQUIRED_FLAGS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}}) - set(CMAKE_REQUIRED_QUIET ${_CMAKE_REQUIRED_QUIET_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}}) - - math(EXPR _CMAKE_PUSH_CHECK_STATE_COUNTER "${_CMAKE_PUSH_CHECK_STATE_COUNTER}-1") - endif() + if("${_CMAKE_PUSH_CHECK_STATE_COUNTER}" GREATER "0") + + set(CMAKE_EXTRA_INCLUDE_FILES ${_CMAKE_EXTRA_INCLUDE_FILES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}}) + set(CMAKE_REQUIRED_INCLUDES ${_CMAKE_REQUIRED_INCLUDES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}}) + set(CMAKE_REQUIRED_DEFINITIONS ${_CMAKE_REQUIRED_DEFINITIONS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}}) + set(CMAKE_REQUIRED_LINK_OPTIONS ${_CMAKE_REQUIRED_LINK_OPTIONS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}}) + set(CMAKE_REQUIRED_LIBRARIES ${_CMAKE_REQUIRED_LIBRARIES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}}) + set(CMAKE_REQUIRED_FLAGS ${_CMAKE_REQUIRED_FLAGS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}}) + set(CMAKE_REQUIRED_QUIET ${_CMAKE_REQUIRED_QUIET_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}}) + + math(EXPR _CMAKE_PUSH_CHECK_STATE_COUNTER "${_CMAKE_PUSH_CHECK_STATE_COUNTER}-1") + endif() endmacro() diff --git a/Modules/CMakeSystemSpecificInformation.cmake b/Modules/CMakeSystemSpecificInformation.cmake index 66f1722..c6a8814 100644 --- a/Modules/CMakeSystemSpecificInformation.cmake +++ b/Modules/CMakeSystemSpecificInformation.cmake @@ -34,7 +34,7 @@ if(NOT _INCLUDED_SYSTEM_INFO_FILE) ${CMAKE_BINARY_DIR}/CopyOfCMakeCache.txt COPYONLY) message("Your CMakeCache.txt file was copied to CopyOfCMakeCache.txt. " "Please send that file to cmake@www.cmake.org.") - endif() + endif() endif() # optionally include a file which can do extra-generator specific things, e.g. diff --git a/Modules/CheckCCompilerFlag.cmake b/Modules/CheckCCompilerFlag.cmake index f5c1127..a3e2da3 100644 --- a/Modules/CheckCCompilerFlag.cmake +++ b/Modules/CheckCCompilerFlag.cmake @@ -37,27 +37,27 @@ include(CheckCSourceCompiles) include(CMakeCheckCompilerFlagCommonPatterns) macro (CHECK_C_COMPILER_FLAG _FLAG _RESULT) - set(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}") - set(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}") + set(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}") + set(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}") # Normalize locale during test compilation. - set(_CheckCCompilerFlag_LOCALE_VARS LC_ALL LC_MESSAGES LANG) - foreach(v ${_CheckCCompilerFlag_LOCALE_VARS}) - set(_CheckCCompilerFlag_SAVED_${v} "$ENV{${v}}") - set(ENV{${v}} C) - endforeach() - CHECK_COMPILER_FLAG_COMMON_PATTERNS(_CheckCCompilerFlag_COMMON_PATTERNS) - CHECK_C_SOURCE_COMPILES("int main(void) { return 0; }" ${_RESULT} - # Some compilers do not fail with a bad flag - FAIL_REGEX "command line option .* is valid for .* but not for C" # GNU - ${_CheckCCompilerFlag_COMMON_PATTERNS} - ) - foreach(v ${_CheckCCompilerFlag_LOCALE_VARS}) - set(ENV{${v}} ${_CheckCCompilerFlag_SAVED_${v}}) - unset(_CheckCCompilerFlag_SAVED_${v}) - endforeach() - unset(_CheckCCompilerFlag_LOCALE_VARS) - unset(_CheckCCompilerFlag_COMMON_PATTERNS) - - set (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}") + set(_CheckCCompilerFlag_LOCALE_VARS LC_ALL LC_MESSAGES LANG) + foreach(v ${_CheckCCompilerFlag_LOCALE_VARS}) + set(_CheckCCompilerFlag_SAVED_${v} "$ENV{${v}}") + set(ENV{${v}} C) + endforeach() + CHECK_COMPILER_FLAG_COMMON_PATTERNS(_CheckCCompilerFlag_COMMON_PATTERNS) + CHECK_C_SOURCE_COMPILES("int main(void) { return 0; }" ${_RESULT} + # Some compilers do not fail with a bad flag + FAIL_REGEX "command line option .* is valid for .* but not for C" # GNU + ${_CheckCCompilerFlag_COMMON_PATTERNS} + ) + foreach(v ${_CheckCCompilerFlag_LOCALE_VARS}) + set(ENV{${v}} ${_CheckCCompilerFlag_SAVED_${v}}) + unset(_CheckCCompilerFlag_SAVED_${v}) + endforeach() + unset(_CheckCCompilerFlag_LOCALE_VARS) + unset(_CheckCCompilerFlag_COMMON_PATTERNS) + + set (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}") endmacro () diff --git a/Modules/CheckCXXCompilerFlag.cmake b/Modules/CheckCXXCompilerFlag.cmake index a01e142..5729843 100644 --- a/Modules/CheckCXXCompilerFlag.cmake +++ b/Modules/CheckCXXCompilerFlag.cmake @@ -37,27 +37,27 @@ include(CheckCXXSourceCompiles) include(CMakeCheckCompilerFlagCommonPatterns) macro (CHECK_CXX_COMPILER_FLAG _FLAG _RESULT) - set(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}") - set(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}") - - # Normalize locale during test compilation. - set(_CheckCXXCompilerFlag_LOCALE_VARS LC_ALL LC_MESSAGES LANG) - foreach(v ${_CheckCXXCompilerFlag_LOCALE_VARS}) - set(_CheckCXXCompilerFlag_SAVED_${v} "$ENV{${v}}") - set(ENV{${v}} C) - endforeach() - CHECK_COMPILER_FLAG_COMMON_PATTERNS(_CheckCXXCompilerFlag_COMMON_PATTERNS) - CHECK_CXX_SOURCE_COMPILES("int main() { return 0; }" ${_RESULT} - # Some compilers do not fail with a bad flag - FAIL_REGEX "command line option .* is valid for .* but not for C\\\\+\\\\+" # GNU - ${_CheckCXXCompilerFlag_COMMON_PATTERNS} - ) - foreach(v ${_CheckCXXCompilerFlag_LOCALE_VARS}) - set(ENV{${v}} ${_CheckCXXCompilerFlag_SAVED_${v}}) - unset(_CheckCXXCompilerFlag_SAVED_${v}) - endforeach() - unset(_CheckCXXCompilerFlag_LOCALE_VARS) - unset(_CheckCXXCompilerFlag_COMMON_PATTERNS) - - set (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}") + set(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}") + set(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}") + + # Normalize locale during test compilation. + set(_CheckCXXCompilerFlag_LOCALE_VARS LC_ALL LC_MESSAGES LANG) + foreach(v ${_CheckCXXCompilerFlag_LOCALE_VARS}) + set(_CheckCXXCompilerFlag_SAVED_${v} "$ENV{${v}}") + set(ENV{${v}} C) + endforeach() + CHECK_COMPILER_FLAG_COMMON_PATTERNS(_CheckCXXCompilerFlag_COMMON_PATTERNS) + CHECK_CXX_SOURCE_COMPILES("int main() { return 0; }" ${_RESULT} + # Some compilers do not fail with a bad flag + FAIL_REGEX "command line option .* is valid for .* but not for C\\\\+\\\\+" # GNU + ${_CheckCXXCompilerFlag_COMMON_PATTERNS} + ) + foreach(v ${_CheckCXXCompilerFlag_LOCALE_VARS}) + set(ENV{${v}} ${_CheckCXXCompilerFlag_SAVED_${v}}) + unset(_CheckCXXCompilerFlag_SAVED_${v}) + endforeach() + unset(_CheckCXXCompilerFlag_LOCALE_VARS) + unset(_CheckCXXCompilerFlag_COMMON_PATTERNS) + + set (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}") endmacro () diff --git a/Modules/CheckStructHasMember.cmake b/Modules/CheckStructHasMember.cmake index 7fef857..842a8fd 100644 --- a/Modules/CheckStructHasMember.cmake +++ b/Modules/CheckStructHasMember.cmake @@ -50,33 +50,33 @@ include(CheckCSourceCompiles) include(CheckCXXSourceCompiles) macro (CHECK_STRUCT_HAS_MEMBER _STRUCT _MEMBER _HEADER _RESULT) - set(_INCLUDE_FILES) - foreach (it ${_HEADER}) - string(APPEND _INCLUDE_FILES "#include <${it}>\n") - endforeach () - - if("x${ARGN}" STREQUAL "x") - set(_lang C) - elseif("x${ARGN}" MATCHES "^xLANGUAGE;([a-zA-Z]+)$") - set(_lang "${CMAKE_MATCH_1}") - else() - message(FATAL_ERROR "Unknown arguments:\n ${ARGN}\n") - endif() - - set(_CHECK_STRUCT_MEMBER_SOURCE_CODE " + set(_INCLUDE_FILES) + foreach (it ${_HEADER}) + string(APPEND _INCLUDE_FILES "#include <${it}>\n") + endforeach () + + if("x${ARGN}" STREQUAL "x") + set(_lang C) + elseif("x${ARGN}" MATCHES "^xLANGUAGE;([a-zA-Z]+)$") + set(_lang "${CMAKE_MATCH_1}") + else() + message(FATAL_ERROR "Unknown arguments:\n ${ARGN}\n") + endif() + + set(_CHECK_STRUCT_MEMBER_SOURCE_CODE " ${_INCLUDE_FILES} int main() { - (void)sizeof(((${_STRUCT} *)0)->${_MEMBER}); - return 0; + (void)sizeof(((${_STRUCT} *)0)->${_MEMBER}); + return 0; } ") - if("${_lang}" STREQUAL "C") - CHECK_C_SOURCE_COMPILES("${_CHECK_STRUCT_MEMBER_SOURCE_CODE}" ${_RESULT}) - elseif("${_lang}" STREQUAL "CXX") - CHECK_CXX_SOURCE_COMPILES("${_CHECK_STRUCT_MEMBER_SOURCE_CODE}" ${_RESULT}) - else() - message(FATAL_ERROR "Unknown language:\n ${_lang}\nSupported languages: C, CXX.\n") - endif() + if("${_lang}" STREQUAL "C") + CHECK_C_SOURCE_COMPILES("${_CHECK_STRUCT_MEMBER_SOURCE_CODE}" ${_RESULT}) + elseif("${_lang}" STREQUAL "CXX") + CHECK_CXX_SOURCE_COMPILES("${_CHECK_STRUCT_MEMBER_SOURCE_CODE}" ${_RESULT}) + else() + message(FATAL_ERROR "Unknown language:\n ${_lang}\nSupported languages: C, CXX.\n") + endif() endmacro () diff --git a/Modules/FindBZip2.cmake b/Modules/FindBZip2.cmake index 2495148..309b971 100644 --- a/Modules/FindBZip2.cmake +++ b/Modules/FindBZip2.cmake @@ -65,40 +65,40 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(BZip2 VERSION_VAR BZIP2_VERSION_STRING) if (BZIP2_FOUND) - set(BZIP2_INCLUDE_DIRS ${BZIP2_INCLUDE_DIR}) - include(${CMAKE_CURRENT_LIST_DIR}/CheckSymbolExists.cmake) - include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake) - cmake_push_check_state() - set(CMAKE_REQUIRED_QUIET ${BZip2_FIND_QUIETLY}) - set(CMAKE_REQUIRED_INCLUDES ${BZIP2_INCLUDE_DIR}) - set(CMAKE_REQUIRED_LIBRARIES ${BZIP2_LIBRARIES}) - CHECK_SYMBOL_EXISTS(BZ2_bzCompressInit "bzlib.h" BZIP2_NEED_PREFIX) - cmake_pop_check_state() - - if(NOT TARGET BZip2::BZip2) - add_library(BZip2::BZip2 UNKNOWN IMPORTED) + set(BZIP2_INCLUDE_DIRS ${BZIP2_INCLUDE_DIR}) + include(${CMAKE_CURRENT_LIST_DIR}/CheckSymbolExists.cmake) + include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake) + cmake_push_check_state() + set(CMAKE_REQUIRED_QUIET ${BZip2_FIND_QUIETLY}) + set(CMAKE_REQUIRED_INCLUDES ${BZIP2_INCLUDE_DIR}) + set(CMAKE_REQUIRED_LIBRARIES ${BZIP2_LIBRARIES}) + CHECK_SYMBOL_EXISTS(BZ2_bzCompressInit "bzlib.h" BZIP2_NEED_PREFIX) + cmake_pop_check_state() + + if(NOT TARGET BZip2::BZip2) + add_library(BZip2::BZip2 UNKNOWN IMPORTED) + set_target_properties(BZip2::BZip2 PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${BZIP2_INCLUDE_DIRS}") + + if(BZIP2_LIBRARY_RELEASE) + set_property(TARGET BZip2::BZip2 APPEND PROPERTY + IMPORTED_CONFIGURATIONS RELEASE) set_target_properties(BZip2::BZip2 PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${BZIP2_INCLUDE_DIRS}") - - if(BZIP2_LIBRARY_RELEASE) - set_property(TARGET BZip2::BZip2 APPEND PROPERTY - IMPORTED_CONFIGURATIONS RELEASE) - set_target_properties(BZip2::BZip2 PROPERTIES - IMPORTED_LOCATION_RELEASE "${BZIP2_LIBRARY_RELEASE}") - endif() - - if(BZIP2_LIBRARY_DEBUG) - set_property(TARGET BZip2::BZip2 APPEND PROPERTY - IMPORTED_CONFIGURATIONS DEBUG) - set_target_properties(BZip2::BZip2 PROPERTIES - IMPORTED_LOCATION_DEBUG "${BZIP2_LIBRARY_DEBUG}") - endif() - - if(NOT BZIP2_LIBRARY_RELEASE AND NOT BZIP2_LIBRARY_DEBUG) - set_property(TARGET BZip2::BZip2 APPEND PROPERTY - IMPORTED_LOCATION "${BZIP2_LIBRARY}") - endif() + IMPORTED_LOCATION_RELEASE "${BZIP2_LIBRARY_RELEASE}") endif() + + if(BZIP2_LIBRARY_DEBUG) + set_property(TARGET BZip2::BZip2 APPEND PROPERTY + IMPORTED_CONFIGURATIONS DEBUG) + set_target_properties(BZip2::BZip2 PROPERTIES + IMPORTED_LOCATION_DEBUG "${BZIP2_LIBRARY_DEBUG}") + endif() + + if(NOT BZIP2_LIBRARY_RELEASE AND NOT BZIP2_LIBRARY_DEBUG) + set_property(TARGET BZip2::BZip2 APPEND PROPERTY + IMPORTED_LOCATION "${BZIP2_LIBRARY}") + endif() + endif() endif () mark_as_advanced(BZIP2_INCLUDE_DIR) diff --git a/Modules/FindBullet.cmake b/Modules/FindBullet.cmake index a3c9fc6..6d64185 100644 --- a/Modules/FindBullet.cmake +++ b/Modules/FindBullet.cmake @@ -52,12 +52,12 @@ macro(_FIND_BULLET_LIBRARY _var) endmacro() macro(_BULLET_APPEND_LIBRARIES _list _release) - set(_debug ${_release}_DEBUG) - if(${_debug}) - set(${_list} ${${_list}} optimized ${${_release}} debug ${${_debug}}) - else() - set(${_list} ${${_list}} ${${_release}}) - endif() + set(_debug ${_release}_DEBUG) + if(${_debug}) + set(${_list} ${${_list}} optimized ${${_release}} debug ${${_debug}}) + else() + set(${_list} ${${_list}} ${${_release}}) + endif() endmacro() find_path(BULLET_INCLUDE_DIR NAMES btBulletCollisionCommon.h diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index 228eed4..3315505 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -538,7 +538,7 @@ if(DEFINED ENV{CUDAHOSTCXX}) elseif(CMAKE_GENERATOR MATCHES "Visual Studio") set(_CUDA_MSVC_HOST_COMPILER "$(VCInstallDir)Tools/MSVC/$(VCToolsVersion)/bin/Host$(Platform)/$(PlatformTarget)") if(MSVC_VERSION LESS 1910) - set(_CUDA_MSVC_HOST_COMPILER "$(VCInstallDir)bin") + set(_CUDA_MSVC_HOST_COMPILER "$(VCInstallDir)bin") endif() set(CUDA_HOST_COMPILER "${_CUDA_MSVC_HOST_COMPILER}" CACHE FILEPATH "Host side compiler used by NVCC") diff --git a/Modules/FindCurses.cmake b/Modules/FindCurses.cmake index c225847..b3cd8fa 100644 --- a/Modules/FindCurses.cmake +++ b/Modules/FindCurses.cmake @@ -141,7 +141,7 @@ if(CURSES_USE_NCURSES) NAMES ncurses/ncurses.h ncurses/curses.h ncurses.h curses.h HINTS "${_cursesParentDir}/include" ) - endif() + endif() # Previous versions of FindCurses provided these values. if(NOT DEFINED CURSES_LIBRARY) diff --git a/Modules/FindCxxTest.cmake b/Modules/FindCxxTest.cmake index 321f004..3fc0e93 100644 --- a/Modules/FindCxxTest.cmake +++ b/Modules/FindCxxTest.cmake @@ -194,7 +194,7 @@ endmacro() # main() #============================================================= if(NOT DEFINED CXXTEST_TESTGEN_ARGS) - set(CXXTEST_TESTGEN_ARGS --error-printer) + set(CXXTEST_TESTGEN_ARGS --error-printer) endif() find_package(Python QUIET) @@ -208,40 +208,40 @@ find_program(CXXTEST_PERL_TESTGEN_EXECUTABLE cxxtestgen.pl PATHS ${CXXTEST_INCLUDE_DIR}) if(PYTHON_FOUND OR PERL_FOUND) - include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) - - if(PYTHON_FOUND AND (CXXTEST_USE_PYTHON OR NOT PERL_FOUND OR NOT DEFINED CXXTEST_USE_PYTHON)) - set(CXXTEST_TESTGEN_EXECUTABLE ${CXXTEST_PYTHON_TESTGEN_EXECUTABLE}) - execute_process(COMMAND ${CXXTEST_PYTHON_TESTGEN_EXECUTABLE} --version - OUTPUT_VARIABLE _CXXTEST_OUT ERROR_VARIABLE _CXXTEST_OUT RESULT_VARIABLE _CXXTEST_RESULT) - if(_CXXTEST_RESULT EQUAL 0) - set(CXXTEST_TESTGEN_INTERPRETER "") - else() - set(CXXTEST_TESTGEN_INTERPRETER ${Python_EXECUTABLE}) - endif() - FIND_PACKAGE_HANDLE_STANDARD_ARGS(CxxTest DEFAULT_MSG - CXXTEST_INCLUDE_DIR CXXTEST_PYTHON_TESTGEN_EXECUTABLE) - - elseif(PERL_FOUND) - set(CXXTEST_TESTGEN_EXECUTABLE ${CXXTEST_PERL_TESTGEN_EXECUTABLE}) - set(CXXTEST_TESTGEN_INTERPRETER ${PERL_EXECUTABLE}) - FIND_PACKAGE_HANDLE_STANDARD_ARGS(CxxTest DEFAULT_MSG - CXXTEST_INCLUDE_DIR CXXTEST_PERL_TESTGEN_EXECUTABLE) - endif() - - if(CXXTEST_FOUND) - set(CXXTEST_INCLUDE_DIRS ${CXXTEST_INCLUDE_DIR}) - endif() + include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) + + if(PYTHON_FOUND AND (CXXTEST_USE_PYTHON OR NOT PERL_FOUND OR NOT DEFINED CXXTEST_USE_PYTHON)) + set(CXXTEST_TESTGEN_EXECUTABLE ${CXXTEST_PYTHON_TESTGEN_EXECUTABLE}) + execute_process(COMMAND ${CXXTEST_PYTHON_TESTGEN_EXECUTABLE} --version + OUTPUT_VARIABLE _CXXTEST_OUT ERROR_VARIABLE _CXXTEST_OUT RESULT_VARIABLE _CXXTEST_RESULT) + if(_CXXTEST_RESULT EQUAL 0) + set(CXXTEST_TESTGEN_INTERPRETER "") + else() + set(CXXTEST_TESTGEN_INTERPRETER ${Python_EXECUTABLE}) + endif() + FIND_PACKAGE_HANDLE_STANDARD_ARGS(CxxTest DEFAULT_MSG + CXXTEST_INCLUDE_DIR CXXTEST_PYTHON_TESTGEN_EXECUTABLE) + + elseif(PERL_FOUND) + set(CXXTEST_TESTGEN_EXECUTABLE ${CXXTEST_PERL_TESTGEN_EXECUTABLE}) + set(CXXTEST_TESTGEN_INTERPRETER ${PERL_EXECUTABLE}) + FIND_PACKAGE_HANDLE_STANDARD_ARGS(CxxTest DEFAULT_MSG + CXXTEST_INCLUDE_DIR CXXTEST_PERL_TESTGEN_EXECUTABLE) + endif() + + if(CXXTEST_FOUND) + set(CXXTEST_INCLUDE_DIRS ${CXXTEST_INCLUDE_DIR}) + endif() else() - set(CXXTEST_FOUND false) - if(NOT CxxTest_FIND_QUIETLY) - if(CxxTest_FIND_REQUIRED) - message(FATAL_ERROR "Neither Python nor Perl found, cannot use CxxTest, aborting!") - else() - message(STATUS "Neither Python nor Perl found, CxxTest will not be used.") - endif() - endif() + set(CXXTEST_FOUND false) + if(NOT CxxTest_FIND_QUIETLY) + if(CxxTest_FIND_REQUIRED) + message(FATAL_ERROR "Neither Python nor Perl found, cannot use CxxTest, aborting!") + else() + message(STATUS "Neither Python nor Perl found, CxxTest will not be used.") + endif() + endif() endif() diff --git a/Modules/FindEnvModules.cmake b/Modules/FindEnvModules.cmake index 5d3452d..e39ec97 100644 --- a/Modules/FindEnvModules.cmake +++ b/Modules/FindEnvModules.cmake @@ -170,7 +170,7 @@ function(env_module) if(MOD_ARGS_OUTPUT_VARIABLE) set(err_var_args ERROR_VARIABLE err_var) - endif() + endif() execute_process( COMMAND mktemp -t module.cmake.XXXXXXXXXXXX diff --git a/Modules/FindGTK2.cmake b/Modules/FindGTK2.cmake index 02e96c6..e3af676 100644 --- a/Modules/FindGTK2.cmake +++ b/Modules/FindGTK2.cmake @@ -947,5 +947,5 @@ else() endif() if(GTK2_INCLUDE_DIRS) - list(REMOVE_DUPLICATES GTK2_INCLUDE_DIRS) + list(REMOVE_DUPLICATES GTK2_INCLUDE_DIRS) endif() diff --git a/Modules/FindGettext.cmake b/Modules/FindGettext.cmake index 9e29e8d..213ad13 100644 --- a/Modules/FindGettext.cmake +++ b/Modules/FindGettext.cmake @@ -63,18 +63,18 @@ find_program(GETTEXT_MSGMERGE_EXECUTABLE msgmerge) find_program(GETTEXT_MSGFMT_EXECUTABLE msgfmt) if(GETTEXT_MSGMERGE_EXECUTABLE) - execute_process(COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --version + execute_process(COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --version OUTPUT_VARIABLE gettext_version ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) - get_filename_component(msgmerge_name ${GETTEXT_MSGMERGE_EXECUTABLE} NAME) - get_filename_component(msgmerge_namewe ${GETTEXT_MSGMERGE_EXECUTABLE} NAME_WE) - if (gettext_version MATCHES "^(${msgmerge_name}|${msgmerge_namewe}) \\([^\\)]*\\) ([0-9\\.]+[^ \n]*)") - set(GETTEXT_VERSION_STRING "${CMAKE_MATCH_2}") - endif() - unset(gettext_version) - unset(msgmerge_name) - unset(msgmerge_namewe) + get_filename_component(msgmerge_name ${GETTEXT_MSGMERGE_EXECUTABLE} NAME) + get_filename_component(msgmerge_namewe ${GETTEXT_MSGMERGE_EXECUTABLE} NAME_WE) + if (gettext_version MATCHES "^(${msgmerge_name}|${msgmerge_namewe}) \\([^\\)]*\\) ([0-9\\.]+[^ \n]*)") + set(GETTEXT_VERSION_STRING "${CMAKE_MATCH_2}") + endif() + unset(gettext_version) + unset(msgmerge_name) + unset(msgmerge_namewe) endif() include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) @@ -83,150 +83,150 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(Gettext VERSION_VAR GETTEXT_VERSION_STRING) function(_GETTEXT_GET_UNIQUE_TARGET_NAME _name _unique_name) - set(propertyName "_GETTEXT_UNIQUE_COUNTER_${_name}") - get_property(currentCounter GLOBAL PROPERTY "${propertyName}") - if(NOT currentCounter) - set(currentCounter 1) - endif() - set(${_unique_name} "${_name}_${currentCounter}" PARENT_SCOPE) - math(EXPR currentCounter "${currentCounter} + 1") - set_property(GLOBAL PROPERTY ${propertyName} ${currentCounter} ) + set(propertyName "_GETTEXT_UNIQUE_COUNTER_${_name}") + get_property(currentCounter GLOBAL PROPERTY "${propertyName}") + if(NOT currentCounter) + set(currentCounter 1) + endif() + set(${_unique_name} "${_name}_${currentCounter}" PARENT_SCOPE) + math(EXPR currentCounter "${currentCounter} + 1") + set_property(GLOBAL PROPERTY ${propertyName} ${currentCounter} ) endfunction() macro(GETTEXT_CREATE_TRANSLATIONS _potFile _firstPoFileArg) - # make it a real variable, so we can modify it here - set(_firstPoFile "${_firstPoFileArg}") - - set(_gmoFiles) - get_filename_component(_potName ${_potFile} NAME) - string(REGEX REPLACE "^(.+)(\\.[^.]+)$" "\\1" _potBasename ${_potName}) - get_filename_component(_absPotFile ${_potFile} ABSOLUTE) - - set(_addToAll) - if(${_firstPoFile} STREQUAL "ALL") - set(_addToAll "ALL") - set(_firstPoFile) - endif() - - foreach (_currentPoFile ${_firstPoFile} ${ARGN}) - get_filename_component(_absFile ${_currentPoFile} ABSOLUTE) - get_filename_component(_abs_PATH ${_absFile} PATH) - get_filename_component(_lang ${_absFile} NAME_WE) - set(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_lang}.gmo) - - add_custom_command( - OUTPUT ${_gmoFile} - COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --quiet --update --backup=none -s ${_absFile} ${_absPotFile} - COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_absFile} - DEPENDS ${_absPotFile} ${_absFile} - ) - - install(FILES ${_gmoFile} DESTINATION share/locale/${_lang}/LC_MESSAGES RENAME ${_potBasename}.mo) - set(_gmoFiles ${_gmoFiles} ${_gmoFile}) - - endforeach () - - if(NOT TARGET translations) - add_custom_target(translations) - endif() + # make it a real variable, so we can modify it here + set(_firstPoFile "${_firstPoFileArg}") + + set(_gmoFiles) + get_filename_component(_potName ${_potFile} NAME) + string(REGEX REPLACE "^(.+)(\\.[^.]+)$" "\\1" _potBasename ${_potName}) + get_filename_component(_absPotFile ${_potFile} ABSOLUTE) + + set(_addToAll) + if(${_firstPoFile} STREQUAL "ALL") + set(_addToAll "ALL") + set(_firstPoFile) + endif() + + foreach (_currentPoFile ${_firstPoFile} ${ARGN}) + get_filename_component(_absFile ${_currentPoFile} ABSOLUTE) + get_filename_component(_abs_PATH ${_absFile} PATH) + get_filename_component(_lang ${_absFile} NAME_WE) + set(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_lang}.gmo) + + add_custom_command( + OUTPUT ${_gmoFile} + COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --quiet --update --backup=none -s ${_absFile} ${_absPotFile} + COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_absFile} + DEPENDS ${_absPotFile} ${_absFile} + ) + + install(FILES ${_gmoFile} DESTINATION share/locale/${_lang}/LC_MESSAGES RENAME ${_potBasename}.mo) + set(_gmoFiles ${_gmoFiles} ${_gmoFile}) + + endforeach () + + if(NOT TARGET translations) + add_custom_target(translations) + endif() _GETTEXT_GET_UNIQUE_TARGET_NAME(translations uniqueTargetName) - add_custom_target(${uniqueTargetName} ${_addToAll} DEPENDS ${_gmoFiles}) + add_custom_target(${uniqueTargetName} ${_addToAll} DEPENDS ${_gmoFiles}) - add_dependencies(translations ${uniqueTargetName}) + add_dependencies(translations ${uniqueTargetName}) endmacro() function(GETTEXT_PROCESS_POT_FILE _potFile) - set(_gmoFiles) - set(_options ALL) - set(_oneValueArgs INSTALL_DESTINATION) - set(_multiValueArgs LANGUAGES) - - CMAKE_PARSE_ARGUMENTS(_parsedArguments "${_options}" "${_oneValueArgs}" "${_multiValueArgs}" ${ARGN}) - - get_filename_component(_potName ${_potFile} NAME) - string(REGEX REPLACE "^(.+)(\\.[^.]+)$" "\\1" _potBasename ${_potName}) - get_filename_component(_absPotFile ${_potFile} ABSOLUTE) - - foreach (_lang ${_parsedArguments_LANGUAGES}) - set(_poFile "${CMAKE_CURRENT_BINARY_DIR}/${_lang}.po") - set(_gmoFile "${CMAKE_CURRENT_BINARY_DIR}/${_lang}.gmo") - - add_custom_command( - OUTPUT "${_poFile}" - COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --quiet --update --backup=none -s ${_poFile} ${_absPotFile} - DEPENDS ${_absPotFile} - ) - - add_custom_command( - OUTPUT "${_gmoFile}" - COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_poFile} - DEPENDS ${_absPotFile} ${_poFile} - ) - - if(_parsedArguments_INSTALL_DESTINATION) - install(FILES ${_gmoFile} DESTINATION ${_parsedArguments_INSTALL_DESTINATION}/${_lang}/LC_MESSAGES RENAME ${_potBasename}.mo) - endif() - list(APPEND _gmoFiles ${_gmoFile}) - endforeach () + set(_gmoFiles) + set(_options ALL) + set(_oneValueArgs INSTALL_DESTINATION) + set(_multiValueArgs LANGUAGES) + + CMAKE_PARSE_ARGUMENTS(_parsedArguments "${_options}" "${_oneValueArgs}" "${_multiValueArgs}" ${ARGN}) + + get_filename_component(_potName ${_potFile} NAME) + string(REGEX REPLACE "^(.+)(\\.[^.]+)$" "\\1" _potBasename ${_potName}) + get_filename_component(_absPotFile ${_potFile} ABSOLUTE) + + foreach (_lang ${_parsedArguments_LANGUAGES}) + set(_poFile "${CMAKE_CURRENT_BINARY_DIR}/${_lang}.po") + set(_gmoFile "${CMAKE_CURRENT_BINARY_DIR}/${_lang}.gmo") + + add_custom_command( + OUTPUT "${_poFile}" + COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --quiet --update --backup=none -s ${_poFile} ${_absPotFile} + DEPENDS ${_absPotFile} + ) + + add_custom_command( + OUTPUT "${_gmoFile}" + COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_poFile} + DEPENDS ${_absPotFile} ${_poFile} + ) + + if(_parsedArguments_INSTALL_DESTINATION) + install(FILES ${_gmoFile} DESTINATION ${_parsedArguments_INSTALL_DESTINATION}/${_lang}/LC_MESSAGES RENAME ${_potBasename}.mo) + endif() + list(APPEND _gmoFiles ${_gmoFile}) + endforeach () if(NOT TARGET potfiles) - add_custom_target(potfiles) + add_custom_target(potfiles) endif() _GETTEXT_GET_UNIQUE_TARGET_NAME( potfiles uniqueTargetName) - if(_parsedArguments_ALL) - add_custom_target(${uniqueTargetName} ALL DEPENDS ${_gmoFiles}) - else() - add_custom_target(${uniqueTargetName} DEPENDS ${_gmoFiles}) - endif() + if(_parsedArguments_ALL) + add_custom_target(${uniqueTargetName} ALL DEPENDS ${_gmoFiles}) + else() + add_custom_target(${uniqueTargetName} DEPENDS ${_gmoFiles}) + endif() - add_dependencies(potfiles ${uniqueTargetName}) + add_dependencies(potfiles ${uniqueTargetName}) endfunction() function(GETTEXT_PROCESS_PO_FILES _lang) - set(_options ALL) - set(_oneValueArgs INSTALL_DESTINATION) - set(_multiValueArgs PO_FILES) - set(_gmoFiles) - - CMAKE_PARSE_ARGUMENTS(_parsedArguments "${_options}" "${_oneValueArgs}" "${_multiValueArgs}" ${ARGN}) - - foreach(_current_PO_FILE ${_parsedArguments_PO_FILES}) - get_filename_component(_name ${_current_PO_FILE} NAME) - string(REGEX REPLACE "^(.+)(\\.[^.]+)$" "\\1" _basename ${_name}) - set(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.gmo) - add_custom_command(OUTPUT ${_gmoFile} - COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_current_PO_FILE} - WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" - DEPENDS ${_current_PO_FILE} - ) - - if(_parsedArguments_INSTALL_DESTINATION) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.gmo DESTINATION ${_parsedArguments_INSTALL_DESTINATION}/${_lang}/LC_MESSAGES/ RENAME ${_basename}.mo) - endif() - list(APPEND _gmoFiles ${_gmoFile}) - endforeach() + set(_options ALL) + set(_oneValueArgs INSTALL_DESTINATION) + set(_multiValueArgs PO_FILES) + set(_gmoFiles) + + CMAKE_PARSE_ARGUMENTS(_parsedArguments "${_options}" "${_oneValueArgs}" "${_multiValueArgs}" ${ARGN}) + + foreach(_current_PO_FILE ${_parsedArguments_PO_FILES}) + get_filename_component(_name ${_current_PO_FILE} NAME) + string(REGEX REPLACE "^(.+)(\\.[^.]+)$" "\\1" _basename ${_name}) + set(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.gmo) + add_custom_command(OUTPUT ${_gmoFile} + COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_current_PO_FILE} + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + DEPENDS ${_current_PO_FILE} + ) + + if(_parsedArguments_INSTALL_DESTINATION) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.gmo DESTINATION ${_parsedArguments_INSTALL_DESTINATION}/${_lang}/LC_MESSAGES/ RENAME ${_basename}.mo) + endif() + list(APPEND _gmoFiles ${_gmoFile}) + endforeach() if(NOT TARGET pofiles) - add_custom_target(pofiles) + add_custom_target(pofiles) endif() _GETTEXT_GET_UNIQUE_TARGET_NAME( pofiles uniqueTargetName) - if(_parsedArguments_ALL) - add_custom_target(${uniqueTargetName} ALL DEPENDS ${_gmoFiles}) - else() - add_custom_target(${uniqueTargetName} DEPENDS ${_gmoFiles}) - endif() + if(_parsedArguments_ALL) + add_custom_target(${uniqueTargetName} ALL DEPENDS ${_gmoFiles}) + else() + add_custom_target(${uniqueTargetName} DEPENDS ${_gmoFiles}) + endif() - add_dependencies(pofiles ${uniqueTargetName}) + add_dependencies(pofiles ${uniqueTargetName}) endfunction() diff --git a/Modules/FindGnuTLS.cmake b/Modules/FindGnuTLS.cmake index 4b4019c..123a0f5 100644 --- a/Modules/FindGnuTLS.cmake +++ b/Modules/FindGnuTLS.cmake @@ -23,31 +23,31 @@ Once done this will define if (GNUTLS_INCLUDE_DIR AND GNUTLS_LIBRARY) - # in cache already - set(gnutls_FIND_QUIETLY TRUE) + # in cache already + set(gnutls_FIND_QUIETLY TRUE) endif () if (NOT WIN32) - # try using pkg-config to get the directories and then use these values - # in the find_path() and find_library() calls - # also fills in GNUTLS_DEFINITIONS, although that isn't normally useful - find_package(PkgConfig QUIET) - PKG_CHECK_MODULES(PC_GNUTLS QUIET gnutls) - set(GNUTLS_DEFINITIONS ${PC_GNUTLS_CFLAGS_OTHER}) - set(GNUTLS_VERSION_STRING ${PC_GNUTLS_VERSION}) + # try using pkg-config to get the directories and then use these values + # in the find_path() and find_library() calls + # also fills in GNUTLS_DEFINITIONS, although that isn't normally useful + find_package(PkgConfig QUIET) + PKG_CHECK_MODULES(PC_GNUTLS QUIET gnutls) + set(GNUTLS_DEFINITIONS ${PC_GNUTLS_CFLAGS_OTHER}) + set(GNUTLS_VERSION_STRING ${PC_GNUTLS_VERSION}) endif () find_path(GNUTLS_INCLUDE_DIR gnutls/gnutls.h - HINTS - ${PC_GNUTLS_INCLUDEDIR} - ${PC_GNUTLS_INCLUDE_DIRS} - ) + HINTS + ${PC_GNUTLS_INCLUDEDIR} + ${PC_GNUTLS_INCLUDE_DIRS} + ) find_library(GNUTLS_LIBRARY NAMES gnutls libgnutls - HINTS - ${PC_GNUTLS_LIBDIR} - ${PC_GNUTLS_LIBRARY_DIRS} - ) + HINTS + ${PC_GNUTLS_LIBDIR} + ${PC_GNUTLS_LIBRARY_DIRS} + ) mark_as_advanced(GNUTLS_INCLUDE_DIR GNUTLS_LIBRARY) @@ -57,6 +57,6 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(GnuTLS VERSION_VAR GNUTLS_VERSION_STRING) if(GNUTLS_FOUND) - set(GNUTLS_LIBRARIES ${GNUTLS_LIBRARY}) - set(GNUTLS_INCLUDE_DIRS ${GNUTLS_INCLUDE_DIR}) + set(GNUTLS_LIBRARIES ${GNUTLS_LIBRARY}) + set(GNUTLS_INCLUDE_DIRS ${GNUTLS_INCLUDE_DIR}) endif() diff --git a/Modules/FindJasper.cmake b/Modules/FindJasper.cmake index dd0e984..729a503 100644 --- a/Modules/FindJasper.cmake +++ b/Modules/FindJasper.cmake @@ -41,7 +41,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(Jasper VERSION_VAR JASPER_VERSION_STRING) if (JASPER_FOUND) - set(JASPER_LIBRARIES ${JASPER_LIBRARIES} ${JPEG_LIBRARIES} ) + set(JASPER_LIBRARIES ${JASPER_LIBRARIES} ${JPEG_LIBRARIES} ) endif () mark_as_advanced(JASPER_INCLUDE_DIR) diff --git a/Modules/FindKDE3.cmake b/Modules/FindKDE3.cmake index f916359..30ea5e6 100644 --- a/Modules/FindKDE3.cmake +++ b/Modules/FindKDE3.cmake @@ -139,7 +139,7 @@ Author: Alexander Neundorf <neundorf@kde.org> #]=======================================================================] if(NOT UNIX AND KDE3_FIND_REQUIRED) - message(FATAL_ERROR "Compiling KDE3 applications and libraries under Windows is not supported") + message(FATAL_ERROR "Compiling KDE3 applications and libraries under Windows is not supported") endif() # If Qt4 has already been found, fail. @@ -170,24 +170,24 @@ find_package(X11 ${_REQ_STRING_KDE3}) #now try to find some kde stuff find_program(KDECONFIG_EXECUTABLE NAMES kde-config HINTS - $ENV{KDEDIR}/bin - PATHS - /opt/kde3/bin - /opt/kde/bin + $ENV{KDEDIR}/bin + PATHS + /opt/kde3/bin + /opt/kde/bin ) set(KDE3PREFIX) if(KDECONFIG_EXECUTABLE) - execute_process(COMMAND ${KDECONFIG_EXECUTABLE} --version - OUTPUT_VARIABLE kde_config_version ) + execute_process(COMMAND ${KDECONFIG_EXECUTABLE} --version + OUTPUT_VARIABLE kde_config_version ) - string(REGEX MATCH "KDE: .\\." kde_version "${kde_config_version}") - if ("${kde_version}" MATCHES "KDE: 3\\.") - execute_process(COMMAND ${KDECONFIG_EXECUTABLE} --prefix - OUTPUT_VARIABLE kdedir ) - string(REPLACE "\n" "" KDE3PREFIX "${kdedir}") + string(REGEX MATCH "KDE: .\\." kde_version "${kde_config_version}") + if ("${kde_version}" MATCHES "KDE: 3\\.") + execute_process(COMMAND ${KDECONFIG_EXECUTABLE} --prefix + OUTPUT_VARIABLE kdedir ) + string(REPLACE "\n" "" KDE3PREFIX "${kdedir}") - endif () + endif () endif() @@ -196,22 +196,22 @@ endif() # kpassdlg.h comes from kdeui and doesn't exist in KDE4 anymore find_path(KDE3_INCLUDE_DIR kpassdlg.h HINTS - $ENV{KDEDIR}/include - ${KDE3PREFIX}/include + $ENV{KDEDIR}/include + ${KDE3PREFIX}/include PATHS - /opt/kde3/include - /opt/kde/include + /opt/kde3/include + /opt/kde/include PATH_SUFFIXES include/kde ) #now the KDE library directory find_library(KDE3_KDECORE_LIBRARY NAMES kdecore HINTS - $ENV{KDEDIR}/lib - ${KDE3PREFIX}/lib + $ENV{KDEDIR}/lib + ${KDE3PREFIX}/lib PATHS - /opt/kde3/lib - /opt/kde/lib + /opt/kde3/lib + /opt/kde/lib ) set(QT_AND_KDECORE_LIBS ${QT_LIBRARIES} ${KDE3_KDECORE_LIBRARY}) @@ -219,49 +219,49 @@ set(QT_AND_KDECORE_LIBS ${QT_LIBRARIES} ${KDE3_KDECORE_LIBRARY}) get_filename_component(KDE3_LIB_DIR ${KDE3_KDECORE_LIBRARY} PATH ) if(NOT KDE3_LIBTOOL_DIR) - if(KDE3_KDECORE_LIBRARY MATCHES lib64) - set(KDE3_LIBTOOL_DIR /lib64/kde3) - elseif(KDE3_KDECORE_LIBRARY MATCHES libx32) - set(KDE3_LIBTOOL_DIR /libx32/kde3) - else() - set(KDE3_LIBTOOL_DIR /lib/kde3) - endif() + if(KDE3_KDECORE_LIBRARY MATCHES lib64) + set(KDE3_LIBTOOL_DIR /lib64/kde3) + elseif(KDE3_KDECORE_LIBRARY MATCHES libx32) + set(KDE3_LIBTOOL_DIR /libx32/kde3) + else() + set(KDE3_LIBTOOL_DIR /lib/kde3) + endif() endif() #now search for the dcop utilities find_program(KDE3_DCOPIDL_EXECUTABLE NAMES dcopidl HINTS - $ENV{KDEDIR}/bin - ${KDE3PREFIX}/bin + $ENV{KDEDIR}/bin + ${KDE3PREFIX}/bin PATHS - /opt/kde3/bin - /opt/kde/bin + /opt/kde3/bin + /opt/kde/bin ) find_program(KDE3_DCOPIDL2CPP_EXECUTABLE NAMES dcopidl2cpp HINTS - $ENV{KDEDIR}/bin - ${KDE3PREFIX}/bin + $ENV{KDEDIR}/bin + ${KDE3PREFIX}/bin PATHS - /opt/kde3/bin - /opt/kde/bin + /opt/kde3/bin + /opt/kde/bin ) find_program(KDE3_KCFGC_EXECUTABLE NAMES kconfig_compiler HINTS - $ENV{KDEDIR}/bin - ${KDE3PREFIX}/bin + $ENV{KDEDIR}/bin + ${KDE3PREFIX}/bin PATHS - /opt/kde3/bin - /opt/kde/bin + /opt/kde3/bin + /opt/kde/bin ) #SET KDE3_FOUND if (KDE3_INCLUDE_DIR AND KDE3_LIB_DIR AND KDE3_DCOPIDL_EXECUTABLE AND KDE3_DCOPIDL2CPP_EXECUTABLE AND KDE3_KCFGC_EXECUTABLE) - set(KDE3_FOUND TRUE) + set(KDE3_FOUND TRUE) else () - set(KDE3_FOUND FALSE) + set(KDE3_FOUND FALSE) endif () # add some KDE specific stuff @@ -269,36 +269,36 @@ set(KDE3_DEFINITIONS -DQT_CLEAN_NAMESPACE -D_GNU_SOURCE) # set compiler flags only if KDE3 has actually been found if(KDE3_FOUND) - set(_KDE3_USE_FLAGS FALSE) - if(CMAKE_COMPILER_IS_GNUCXX) - set(_KDE3_USE_FLAGS TRUE) # use flags for gnu compiler - execute_process(COMMAND ${CMAKE_CXX_COMPILER} --version - OUTPUT_VARIABLE out) - # gnu gcc 2.96 does not work with flags - # I guess 2.95 also doesn't then - if("${out}" MATCHES "2.9[56]") - set(_KDE3_USE_FLAGS FALSE) - endif() - endif() - - #only on linux, but NOT e.g. on FreeBSD: - if(CMAKE_SYSTEM_NAME MATCHES "Linux" AND _KDE3_USE_FLAGS) - set (KDE3_DEFINITIONS ${KDE3_DEFINITIONS} -D_XOPEN_SOURCE=500 -D_BSD_SOURCE) - set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-long-long -ansi -Wundef -Wcast-align -Wconversion -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -Wmissing-format-attribute -fno-common") - set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Wno-long-long -ansi -Wundef -Wcast-align -Wconversion -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -fno-exceptions -fno-check-new -fno-common") - endif() - - # works on FreeBSD, NOT tested on NetBSD and OpenBSD - if (CMAKE_SYSTEM_NAME MATCHES BSD AND _KDE3_USE_FLAGS) - set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-long-long -ansi -Wundef -Wcast-align -Wconversion -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -Wmissing-format-attribute -fno-common") - set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Wno-long-long -Wundef -Wcast-align -Wconversion -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -Wmissing-format-attribute -fno-exceptions -fno-check-new -fno-common") - endif () - - # if no special buildtype is selected, add -O2 as default optimization - if (NOT CMAKE_BUILD_TYPE AND _KDE3_USE_FLAGS) - set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2") - set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2") - endif () + set(_KDE3_USE_FLAGS FALSE) + if(CMAKE_COMPILER_IS_GNUCXX) + set(_KDE3_USE_FLAGS TRUE) # use flags for gnu compiler + execute_process(COMMAND ${CMAKE_CXX_COMPILER} --version + OUTPUT_VARIABLE out) + # gnu gcc 2.96 does not work with flags + # I guess 2.95 also doesn't then + if("${out}" MATCHES "2.9[56]") + set(_KDE3_USE_FLAGS FALSE) + endif() + endif() + + #only on linux, but NOT e.g. on FreeBSD: + if(CMAKE_SYSTEM_NAME MATCHES "Linux" AND _KDE3_USE_FLAGS) + set (KDE3_DEFINITIONS ${KDE3_DEFINITIONS} -D_XOPEN_SOURCE=500 -D_BSD_SOURCE) + set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-long-long -ansi -Wundef -Wcast-align -Wconversion -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -Wmissing-format-attribute -fno-common") + set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Wno-long-long -ansi -Wundef -Wcast-align -Wconversion -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -fno-exceptions -fno-check-new -fno-common") + endif() + + # works on FreeBSD, NOT tested on NetBSD and OpenBSD + if (CMAKE_SYSTEM_NAME MATCHES BSD AND _KDE3_USE_FLAGS) + set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-long-long -ansi -Wundef -Wcast-align -Wconversion -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -Wmissing-format-attribute -fno-common") + set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Wno-long-long -Wundef -Wcast-align -Wconversion -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -Wmissing-format-attribute -fno-exceptions -fno-check-new -fno-common") + endif () + + # if no special buildtype is selected, add -O2 as default optimization + if (NOT CMAKE_BUILD_TYPE AND _KDE3_USE_FLAGS) + set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2") + set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2") + endif () #set(CMAKE_SHARED_LINKER_FLAGS "-avoid-version -module -Wl,--no-undefined -Wl,--allow-shlib-undefined") #set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--fatal-warnings -avoid-version -Wl,--no-undefined -lc") @@ -311,49 +311,49 @@ include(${CMAKE_CURRENT_LIST_DIR}/KDE3Macros.cmake) macro (KDE3_PRINT_RESULTS) - if(KDE3_INCLUDE_DIR) - message(STATUS "Found KDE3 include dir: ${KDE3_INCLUDE_DIR}") - else() - message(STATUS "Didn't find KDE3 headers") - endif() - - if(KDE3_LIB_DIR) - message(STATUS "Found KDE3 library dir: ${KDE3_LIB_DIR}") - else() - message(STATUS "Didn't find KDE3 core library") - endif() - - if(KDE3_DCOPIDL_EXECUTABLE) - message(STATUS "Found KDE3 dcopidl preprocessor: ${KDE3_DCOPIDL_EXECUTABLE}") - else() - message(STATUS "Didn't find the KDE3 dcopidl preprocessor") - endif() - - if(KDE3_DCOPIDL2CPP_EXECUTABLE) - message(STATUS "Found KDE3 dcopidl2cpp preprocessor: ${KDE3_DCOPIDL2CPP_EXECUTABLE}") - else() - message(STATUS "Didn't find the KDE3 dcopidl2cpp preprocessor") - endif() - - if(KDE3_KCFGC_EXECUTABLE) - message(STATUS "Found KDE3 kconfig_compiler preprocessor: ${KDE3_KCFGC_EXECUTABLE}") - else() - message(STATUS "Didn't find the KDE3 kconfig_compiler preprocessor") - endif() + if(KDE3_INCLUDE_DIR) + message(STATUS "Found KDE3 include dir: ${KDE3_INCLUDE_DIR}") + else() + message(STATUS "Didn't find KDE3 headers") + endif() + + if(KDE3_LIB_DIR) + message(STATUS "Found KDE3 library dir: ${KDE3_LIB_DIR}") + else() + message(STATUS "Didn't find KDE3 core library") + endif() + + if(KDE3_DCOPIDL_EXECUTABLE) + message(STATUS "Found KDE3 dcopidl preprocessor: ${KDE3_DCOPIDL_EXECUTABLE}") + else() + message(STATUS "Didn't find the KDE3 dcopidl preprocessor") + endif() + + if(KDE3_DCOPIDL2CPP_EXECUTABLE) + message(STATUS "Found KDE3 dcopidl2cpp preprocessor: ${KDE3_DCOPIDL2CPP_EXECUTABLE}") + else() + message(STATUS "Didn't find the KDE3 dcopidl2cpp preprocessor") + endif() + + if(KDE3_KCFGC_EXECUTABLE) + message(STATUS "Found KDE3 kconfig_compiler preprocessor: ${KDE3_KCFGC_EXECUTABLE}") + else() + message(STATUS "Didn't find the KDE3 kconfig_compiler preprocessor") + endif() endmacro () if (KDE3_FIND_REQUIRED AND NOT KDE3_FOUND) - #bail out if something wasn't found - KDE3_PRINT_RESULTS() - message(FATAL_ERROR "Could NOT find everything required for compiling KDE 3 programs") + #bail out if something wasn't found + KDE3_PRINT_RESULTS() + message(FATAL_ERROR "Could NOT find everything required for compiling KDE 3 programs") endif () if (NOT KDE3_FIND_QUIETLY) - KDE3_PRINT_RESULTS() + KDE3_PRINT_RESULTS() endif () #add the found Qt and KDE include directories to the current include path diff --git a/Modules/FindKDE4.cmake b/Modules/FindKDE4.cmake index 2a1838f..695e9ac 100644 --- a/Modules/FindKDE4.cmake +++ b/Modules/FindKDE4.cmake @@ -57,47 +57,47 @@ find_program(KDE4_KDECONFIG_EXECUTABLE NAMES kde4-config ) if (NOT KDE4_KDECONFIG_EXECUTABLE) - if (KDE4_FIND_REQUIRED) - message(FATAL_ERROR "ERROR: Could not find KDE4 kde4-config") - endif () + if (KDE4_FIND_REQUIRED) + message(FATAL_ERROR "ERROR: Could not find KDE4 kde4-config") + endif () endif () # when cross compiling, KDE4_DATA_DIR may be already preset if(NOT KDE4_DATA_DIR) - if(CMAKE_CROSSCOMPILING) - # when cross compiling, don't run kde4-config but use its location as install dir - get_filename_component(KDE4_DATA_DIR "${KDE4_KDECONFIG_EXECUTABLE}" PATH) - get_filename_component(KDE4_DATA_DIR "${KDE4_DATA_DIR}" PATH) - else() - # then ask kde4-config for the kde data dirs - - if(KDE4_KDECONFIG_EXECUTABLE) - execute_process(COMMAND "${KDE4_KDECONFIG_EXECUTABLE}" --path data OUTPUT_VARIABLE _data_DIR ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) - file(TO_CMAKE_PATH "${_data_DIR}" _data_DIR) - # then check the data dirs for FindKDE4Internal.cmake - find_path(KDE4_DATA_DIR cmake/modules/FindKDE4Internal.cmake HINTS ${_data_DIR}) - endif() - endif() + if(CMAKE_CROSSCOMPILING) + # when cross compiling, don't run kde4-config but use its location as install dir + get_filename_component(KDE4_DATA_DIR "${KDE4_KDECONFIG_EXECUTABLE}" PATH) + get_filename_component(KDE4_DATA_DIR "${KDE4_DATA_DIR}" PATH) + else() + # then ask kde4-config for the kde data dirs + + if(KDE4_KDECONFIG_EXECUTABLE) + execute_process(COMMAND "${KDE4_KDECONFIG_EXECUTABLE}" --path data OUTPUT_VARIABLE _data_DIR ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) + file(TO_CMAKE_PATH "${_data_DIR}" _data_DIR) + # then check the data dirs for FindKDE4Internal.cmake + find_path(KDE4_DATA_DIR cmake/modules/FindKDE4Internal.cmake HINTS ${_data_DIR}) + endif() + endif() endif() # if it has been found... if (KDE4_DATA_DIR) - set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${KDE4_DATA_DIR}/cmake/modules) + set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${KDE4_DATA_DIR}/cmake/modules) - if (KDE4_FIND_QUIETLY) - set(_quiet QUIET) - endif () + if (KDE4_FIND_QUIETLY) + set(_quiet QUIET) + endif () - if (KDE4_FIND_REQUIRED) - set(_req REQUIRED) - endif () + if (KDE4_FIND_REQUIRED) + set(_req REQUIRED) + endif () - # use FindKDE4Internal.cmake to do the rest - find_package(KDE4Internal ${_req} ${_quiet} NO_POLICY_SCOPE) + # use FindKDE4Internal.cmake to do the rest + find_package(KDE4Internal ${_req} ${_quiet} NO_POLICY_SCOPE) else () - if (KDE4_FIND_REQUIRED) - message(FATAL_ERROR "ERROR: cmake/modules/FindKDE4Internal.cmake not found in ${_data_DIR}") - endif () + if (KDE4_FIND_REQUIRED) + message(FATAL_ERROR "ERROR: cmake/modules/FindKDE4Internal.cmake not found in ${_data_DIR}") + endif () endif () diff --git a/Modules/FindLAPACK.cmake b/Modules/FindLAPACK.cmake index 6582eea..c9c3cce 100644 --- a/Modules/FindLAPACK.cmake +++ b/Modules/FindLAPACK.cmake @@ -173,11 +173,11 @@ if(_libraries_work) #message("DEBUG: ${LIBRARIES} = ${${LIBRARIES}}") endif() - if(_libraries_work) - set(${LIBRARIES} ${${LIBRARIES}} ${_blas} ${_threads}) - else() - set(${LIBRARIES} FALSE) - endif() +if(_libraries_work) + set(${LIBRARIES} ${${LIBRARIES}} ${_blas} ${_threads}) +else() + set(${LIBRARIES} FALSE) +endif() endmacro() @@ -325,25 +325,25 @@ if (BLA_VENDOR STREQUAL "FLAME" OR BLA_VENDOR STREQUAL "All") endif () #acml lapack - if (BLA_VENDOR MATCHES "ACML" OR BLA_VENDOR STREQUAL "All") - if (BLAS_LIBRARIES MATCHES ".+acml.+") - set (LAPACK_LIBRARIES ${BLAS_LIBRARIES}) - endif () - endif () +if (BLA_VENDOR MATCHES "ACML" OR BLA_VENDOR STREQUAL "All") + if (BLAS_LIBRARIES MATCHES ".+acml.+") + set (LAPACK_LIBRARIES ${BLAS_LIBRARIES}) + endif () +endif () # Apple LAPACK library? if (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All") - if(NOT LAPACK_LIBRARIES) - check_lapack_libraries( - LAPACK_LIBRARIES - LAPACK - cheev - "" - "Accelerate" - "${BLAS_LIBRARIES}" - "" - ) - endif() + if(NOT LAPACK_LIBRARIES) + check_lapack_libraries( + LAPACK_LIBRARIES + LAPACK + cheev + "" + "Accelerate" + "${BLAS_LIBRARIES}" + "" + ) + endif() endif () if (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All") if ( NOT LAPACK_LIBRARIES ) @@ -380,50 +380,50 @@ else() endif() if(BLA_F95) - if(LAPACK95_LIBRARIES) - set(LAPACK95_FOUND TRUE) - else() - set(LAPACK95_FOUND FALSE) - endif() - if(NOT LAPACK_FIND_QUIETLY) - if(LAPACK95_FOUND) - message(STATUS "A library with LAPACK95 API found.") + if(LAPACK95_LIBRARIES) + set(LAPACK95_FOUND TRUE) else() - if(LAPACK_FIND_REQUIRED) - message(FATAL_ERROR - "A required library with LAPACK95 API not found. Please specify library location." - ) + set(LAPACK95_FOUND FALSE) + endif() + if(NOT LAPACK_FIND_QUIETLY) + if(LAPACK95_FOUND) + message(STATUS "A library with LAPACK95 API found.") else() - message(STATUS - "A library with LAPACK95 API not found. Please specify library location." - ) + if(LAPACK_FIND_REQUIRED) + message(FATAL_ERROR + "A required library with LAPACK95 API not found. Please specify library location." + ) + else() + message(STATUS + "A library with LAPACK95 API not found. Please specify library location." + ) + endif() endif() endif() - endif() - set(LAPACK_FOUND "${LAPACK95_FOUND}") - set(LAPACK_LIBRARIES "${LAPACK95_LIBRARIES}") + set(LAPACK_FOUND "${LAPACK95_FOUND}") + set(LAPACK_LIBRARIES "${LAPACK95_LIBRARIES}") else() - if(LAPACK_LIBRARIES) - set(LAPACK_FOUND TRUE) - else() - set(LAPACK_FOUND FALSE) - endif() - - if(NOT LAPACK_FIND_QUIETLY) - if(LAPACK_FOUND) - message(STATUS "A library with LAPACK API found.") + if(LAPACK_LIBRARIES) + set(LAPACK_FOUND TRUE) else() - if(LAPACK_FIND_REQUIRED) - message(FATAL_ERROR - "A required library with LAPACK API not found. Please specify library location." - ) + set(LAPACK_FOUND FALSE) + endif() + + if(NOT LAPACK_FIND_QUIETLY) + if(LAPACK_FOUND) + message(STATUS "A library with LAPACK API found.") else() - message(STATUS - "A library with LAPACK API not found. Please specify library location." - ) + if(LAPACK_FIND_REQUIRED) + message(FATAL_ERROR + "A required library with LAPACK API not found. Please specify library location." + ) + else() + message(STATUS + "A library with LAPACK API not found. Please specify library location." + ) + endif() endif() endif() - endif() endif() cmake_pop_check_state() diff --git a/Modules/FindLATEX.cmake b/Modules/FindLATEX.cmake index b365d63..b0dad7d 100644 --- a/Modules/FindLATEX.cmake +++ b/Modules/FindLATEX.cmake @@ -171,7 +171,7 @@ find_program(XINDY_COMPILER /usr/bin ) if (XINDY_COMPILER) - set(LATEX_XINDY_FOUND TRUE) + set(LATEX_XINDY_FOUND TRUE) else() set(LATEX_XINDY_FOUND FALSE) endif() diff --git a/Modules/FindLibLZMA.cmake b/Modules/FindLibLZMA.cmake index 6225744..fc97655 100644 --- a/Modules/FindLibLZMA.cmake +++ b/Modules/FindLibLZMA.cmake @@ -59,13 +59,13 @@ endif() # it can be found in http://tukaani.org/xz/ # Avoid using old codebase if (LIBLZMA_LIBRARY) - include(${CMAKE_CURRENT_LIST_DIR}/CheckLibraryExists.cmake) - set(CMAKE_REQUIRED_QUIET_SAVE ${CMAKE_REQUIRED_QUIET}) - set(CMAKE_REQUIRED_QUIET ${LibLZMA_FIND_QUIETLY}) - CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARY} lzma_auto_decoder "" LIBLZMA_HAS_AUTO_DECODER) - CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARY} lzma_easy_encoder "" LIBLZMA_HAS_EASY_ENCODER) - CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARY} lzma_lzma_preset "" LIBLZMA_HAS_LZMA_PRESET) - set(CMAKE_REQUIRED_QUIET ${CMAKE_REQUIRED_QUIET_SAVE}) + include(${CMAKE_CURRENT_LIST_DIR}/CheckLibraryExists.cmake) + set(CMAKE_REQUIRED_QUIET_SAVE ${CMAKE_REQUIRED_QUIET}) + set(CMAKE_REQUIRED_QUIET ${LibLZMA_FIND_QUIETLY}) + CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARY} lzma_auto_decoder "" LIBLZMA_HAS_AUTO_DECODER) + CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARY} lzma_easy_encoder "" LIBLZMA_HAS_EASY_ENCODER) + CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARY} lzma_lzma_preset "" LIBLZMA_HAS_LZMA_PRESET) + set(CMAKE_REQUIRED_QUIET ${CMAKE_REQUIRED_QUIET_SAVE}) endif () include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) diff --git a/Modules/FindLibXml2.cmake b/Modules/FindLibXml2.cmake index 47c0e79..da8bfe0 100644 --- a/Modules/FindLibXml2.cmake +++ b/Modules/FindLibXml2.cmake @@ -96,7 +96,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXml2 mark_as_advanced(LIBXML2_INCLUDE_DIR LIBXML2_LIBRARY LIBXML2_XMLLINT_EXECUTABLE) if(LibXml2_FOUND AND NOT TARGET LibXml2::LibXml2) - add_library(LibXml2::LibXml2 UNKNOWN IMPORTED) - set_target_properties(LibXml2::LibXml2 PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${LIBXML2_INCLUDE_DIRS}") - set_property(TARGET LibXml2::LibXml2 APPEND PROPERTY IMPORTED_LOCATION "${LIBXML2_LIBRARY}") + add_library(LibXml2::LibXml2 UNKNOWN IMPORTED) + set_target_properties(LibXml2::LibXml2 PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${LIBXML2_INCLUDE_DIRS}") + set_property(TARGET LibXml2::LibXml2 APPEND PROPERTY IMPORTED_LOCATION "${LIBXML2_LIBRARY}") endif() diff --git a/Modules/FindLua.cmake b/Modules/FindLua.cmake index d229e18..caf9d69 100644 --- a/Modules/FindLua.cmake +++ b/Modules/FindLua.cmake @@ -84,105 +84,104 @@ function(_lua_get_versions) endfunction() function(_lua_set_version_vars) - set(_lua_include_subdirs_raw "lua") - - foreach (ver IN LISTS _lua_append_versions) - string(REGEX MATCH "^([0-9]+)\\.([0-9]+)$" _ver "${ver}") - list(APPEND _lua_include_subdirs_raw - lua${CMAKE_MATCH_1}${CMAKE_MATCH_2} - lua${CMAKE_MATCH_1}.${CMAKE_MATCH_2} - lua-${CMAKE_MATCH_1}.${CMAKE_MATCH_2} + set(_lua_include_subdirs_raw "lua") + + foreach (ver IN LISTS _lua_append_versions) + string(REGEX MATCH "^([0-9]+)\\.([0-9]+)$" _ver "${ver}") + list(APPEND _lua_include_subdirs_raw + lua${CMAKE_MATCH_1}${CMAKE_MATCH_2} + lua${CMAKE_MATCH_1}.${CMAKE_MATCH_2} + lua-${CMAKE_MATCH_1}.${CMAKE_MATCH_2} ) - endforeach () + endforeach () - # Prepend "include/" to each path directly after the path - set(_lua_include_subdirs "include") - foreach (dir IN LISTS _lua_include_subdirs_raw) - list(APPEND _lua_include_subdirs "${dir}" "include/${dir}") - endforeach () + # Prepend "include/" to each path directly after the path + set(_lua_include_subdirs "include") + foreach (dir IN LISTS _lua_include_subdirs_raw) + list(APPEND _lua_include_subdirs "${dir}" "include/${dir}") + endforeach () - set(_lua_include_subdirs "${_lua_include_subdirs}" PARENT_SCOPE) + set(_lua_include_subdirs "${_lua_include_subdirs}" PARENT_SCOPE) endfunction(_lua_set_version_vars) function(_lua_get_header_version) - unset(LUA_VERSION_STRING PARENT_SCOPE) - set(_hdr_file "${LUA_INCLUDE_DIR}/lua.h") - - if (NOT EXISTS "${_hdr_file}") - return() + unset(LUA_VERSION_STRING PARENT_SCOPE) + set(_hdr_file "${LUA_INCLUDE_DIR}/lua.h") + + if (NOT EXISTS "${_hdr_file}") + return() + endif () + + # At least 5.[012] have different ways to express the version + # so all of them need to be tested. Lua 5.2 defines LUA_VERSION + # and LUA_RELEASE as joined by the C preprocessor, so avoid those. + file(STRINGS "${_hdr_file}" lua_version_strings + REGEX "^#define[ \t]+LUA_(RELEASE[ \t]+\"Lua [0-9]|VERSION([ \t]+\"Lua [0-9]|_[MR])).*") + + string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION_MAJOR[ \t]+\"([0-9])\"[ \t]*;.*" "\\1" LUA_VERSION_MAJOR ";${lua_version_strings};") + if (LUA_VERSION_MAJOR MATCHES "^[0-9]+$") + string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION_MINOR[ \t]+\"([0-9])\"[ \t]*;.*" "\\1" LUA_VERSION_MINOR ";${lua_version_strings};") + string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION_RELEASE[ \t]+\"([0-9])\"[ \t]*;.*" "\\1" LUA_VERSION_PATCH ";${lua_version_strings};") + set(LUA_VERSION_STRING "${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}.${LUA_VERSION_PATCH}") + else () + string(REGEX REPLACE ".*;#define[ \t]+LUA_RELEASE[ \t]+\"Lua ([0-9.]+)\"[ \t]*;.*" "\\1" LUA_VERSION_STRING ";${lua_version_strings};") + if (NOT LUA_VERSION_STRING MATCHES "^[0-9.]+$") + string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION[ \t]+\"Lua ([0-9.]+)\"[ \t]*;.*" "\\1" LUA_VERSION_STRING ";${lua_version_strings};") endif () - - # At least 5.[012] have different ways to express the version - # so all of them need to be tested. Lua 5.2 defines LUA_VERSION - # and LUA_RELEASE as joined by the C preprocessor, so avoid those. - file(STRINGS "${_hdr_file}" lua_version_strings - REGEX "^#define[ \t]+LUA_(RELEASE[ \t]+\"Lua [0-9]|VERSION([ \t]+\"Lua [0-9]|_[MR])).*") - - string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION_MAJOR[ \t]+\"([0-9])\"[ \t]*;.*" "\\1" LUA_VERSION_MAJOR ";${lua_version_strings};") - if (LUA_VERSION_MAJOR MATCHES "^[0-9]+$") - string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION_MINOR[ \t]+\"([0-9])\"[ \t]*;.*" "\\1" LUA_VERSION_MINOR ";${lua_version_strings};") - string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION_RELEASE[ \t]+\"([0-9])\"[ \t]*;.*" "\\1" LUA_VERSION_PATCH ";${lua_version_strings};") - set(LUA_VERSION_STRING "${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}.${LUA_VERSION_PATCH}") - else () - string(REGEX REPLACE ".*;#define[ \t]+LUA_RELEASE[ \t]+\"Lua ([0-9.]+)\"[ \t]*;.*" "\\1" LUA_VERSION_STRING ";${lua_version_strings};") - if (NOT LUA_VERSION_STRING MATCHES "^[0-9.]+$") - string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION[ \t]+\"Lua ([0-9.]+)\"[ \t]*;.*" "\\1" LUA_VERSION_STRING ";${lua_version_strings};") - endif () - string(REGEX REPLACE "^([0-9]+)\\.[0-9.]*$" "\\1" LUA_VERSION_MAJOR "${LUA_VERSION_STRING}") - string(REGEX REPLACE "^[0-9]+\\.([0-9]+)[0-9.]*$" "\\1" LUA_VERSION_MINOR "${LUA_VERSION_STRING}") - string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]).*" "\\1" LUA_VERSION_PATCH "${LUA_VERSION_STRING}") + string(REGEX REPLACE "^([0-9]+)\\.[0-9.]*$" "\\1" LUA_VERSION_MAJOR "${LUA_VERSION_STRING}") + string(REGEX REPLACE "^[0-9]+\\.([0-9]+)[0-9.]*$" "\\1" LUA_VERSION_MINOR "${LUA_VERSION_STRING}") + string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]).*" "\\1" LUA_VERSION_PATCH "${LUA_VERSION_STRING}") + endif () + foreach (ver IN LISTS _lua_append_versions) + if (ver STREQUAL "${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}") + set(LUA_VERSION_MAJOR ${LUA_VERSION_MAJOR} PARENT_SCOPE) + set(LUA_VERSION_MINOR ${LUA_VERSION_MINOR} PARENT_SCOPE) + set(LUA_VERSION_PATCH ${LUA_VERSION_PATCH} PARENT_SCOPE) + set(LUA_VERSION_STRING ${LUA_VERSION_STRING} PARENT_SCOPE) + return() endif () - foreach (ver IN LISTS _lua_append_versions) - if (ver STREQUAL "${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}") - set(LUA_VERSION_MAJOR ${LUA_VERSION_MAJOR} PARENT_SCOPE) - set(LUA_VERSION_MINOR ${LUA_VERSION_MINOR} PARENT_SCOPE) - set(LUA_VERSION_PATCH ${LUA_VERSION_PATCH} PARENT_SCOPE) - set(LUA_VERSION_STRING ${LUA_VERSION_STRING} PARENT_SCOPE) - return() - endif () - endforeach () + endforeach () endfunction(_lua_get_header_version) function(_lua_find_header) - _lua_set_version_vars() - - # Initialize as local variable - set(CMAKE_IGNORE_PATH ${CMAKE_IGNORE_PATH}) - while (TRUE) - # Find the next header to test. Check each possible subdir in order - # This prefers e.g. higher versions as they are earlier in the list - # It is also consistent with previous versions of FindLua - foreach (subdir IN LISTS _lua_include_subdirs) - find_path(LUA_INCLUDE_DIR lua.h - HINTS - ENV LUA_DIR - PATH_SUFFIXES ${subdir} - ) - if (LUA_INCLUDE_DIR) - break() - endif() - endforeach() - # Did not found header -> Fail - if (NOT LUA_INCLUDE_DIR) - return() - endif() - _lua_get_header_version() - # Found accepted version -> Ok - if (LUA_VERSION_STRING) - if (LUA_Debug) - message(STATUS "Found suitable version ${LUA_VERSION_STRING} in ${LUA_INCLUDE_DIR}/lua.h") - endif() - return() - endif() - # Found wrong version -> Ignore this path and retry - if (LUA_Debug) - message(STATUS "Ignoring unsuitable version in ${LUA_INCLUDE_DIR}") - endif() - list(APPEND CMAKE_IGNORE_PATH "${LUA_INCLUDE_DIR}") - unset(LUA_INCLUDE_DIR CACHE) - unset(LUA_INCLUDE_DIR) - unset(LUA_INCLUDE_DIR PARENT_SCOPE) - endwhile () + _lua_set_version_vars() + + # Initialize as local variable + set(CMAKE_IGNORE_PATH ${CMAKE_IGNORE_PATH}) + while (TRUE) + # Find the next header to test. Check each possible subdir in order + # This prefers e.g. higher versions as they are earlier in the list + # It is also consistent with previous versions of FindLua + foreach (subdir IN LISTS _lua_include_subdirs) + find_path(LUA_INCLUDE_DIR lua.h + HINTS ENV LUA_DIR + PATH_SUFFIXES ${subdir} + ) + if (LUA_INCLUDE_DIR) + break() + endif() + endforeach() + # Did not found header -> Fail + if (NOT LUA_INCLUDE_DIR) + return() + endif() + _lua_get_header_version() + # Found accepted version -> Ok + if (LUA_VERSION_STRING) + if (LUA_Debug) + message(STATUS "Found suitable version ${LUA_VERSION_STRING} in ${LUA_INCLUDE_DIR}/lua.h") + endif() + return() + endif() + # Found wrong version -> Ignore this path and retry + if (LUA_Debug) + message(STATUS "Ignoring unsuitable version in ${LUA_INCLUDE_DIR}") + endif() + list(APPEND CMAKE_IGNORE_PATH "${LUA_INCLUDE_DIR}") + unset(LUA_INCLUDE_DIR CACHE) + unset(LUA_INCLUDE_DIR) + unset(LUA_INCLUDE_DIR PARENT_SCOPE) + endwhile () endfunction() _lua_get_versions() @@ -191,11 +190,11 @@ _lua_get_header_version() unset(_lua_append_versions) if (LUA_VERSION_STRING) - set(_lua_library_names - lua${LUA_VERSION_MAJOR}${LUA_VERSION_MINOR} - lua${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR} - lua-${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR} - lua.${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR} + set(_lua_library_names + lua${LUA_VERSION_MAJOR}${LUA_VERSION_MINOR} + lua${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR} + lua-${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR} + lua.${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR} ) endif () @@ -209,21 +208,21 @@ find_library(LUA_LIBRARY unset(_lua_library_names) if (LUA_LIBRARY) - # include the math library for Unix - if (UNIX AND NOT APPLE AND NOT BEOS) - find_library(LUA_MATH_LIBRARY m) - set(LUA_LIBRARIES "${LUA_LIBRARY};${LUA_MATH_LIBRARY}") - - # include dl library for statically-linked Lua library - get_filename_component(LUA_LIB_EXT ${LUA_LIBRARY} EXT) - if(LUA_LIB_EXT STREQUAL CMAKE_STATIC_LIBRARY_SUFFIX) - list(APPEND LUA_LIBRARIES ${CMAKE_DL_LIBS}) - endif() - - # For Windows and Mac, don't need to explicitly include the math library - else () - set(LUA_LIBRARIES "${LUA_LIBRARY}") - endif () + # include the math library for Unix + if (UNIX AND NOT APPLE AND NOT BEOS) + find_library(LUA_MATH_LIBRARY m) + set(LUA_LIBRARIES "${LUA_LIBRARY};${LUA_MATH_LIBRARY}") + + # include dl library for statically-linked Lua library + get_filename_component(LUA_LIB_EXT ${LUA_LIBRARY} EXT) + if(LUA_LIB_EXT STREQUAL CMAKE_STATIC_LIBRARY_SUFFIX) + list(APPEND LUA_LIBRARIES ${CMAKE_DL_LIBS}) + endif() + + # For Windows and Mac, don't need to explicitly include the math library + else () + set(LUA_LIBRARIES "${LUA_LIBRARY}") + endif () endif () include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) diff --git a/Modules/FindRuby.cmake b/Modules/FindRuby.cmake index 58debdd..7e01fbc 100644 --- a/Modules/FindRuby.cmake +++ b/Modules/FindRuby.cmake @@ -49,14 +49,14 @@ set(_RUBY_POSSIBLE_EXECUTABLE_NAMES ruby) # if 1.9 is required, don't look for ruby18 and ruby1.8, default to version 1.8 if(DEFINED Ruby_FIND_VERSION_MAJOR AND DEFINED Ruby_FIND_VERSION_MINOR) - set(Ruby_FIND_VERSION_SHORT_NODOT "${Ruby_FIND_VERSION_MAJOR}${RUBY_FIND_VERSION_MINOR}") - # we can't construct that if only major version is given - set(_RUBY_POSSIBLE_EXECUTABLE_NAMES - ruby${Ruby_FIND_VERSION_MAJOR}.${Ruby_FIND_VERSION_MINOR} - ruby${Ruby_FIND_VERSION_MAJOR}${Ruby_FIND_VERSION_MINOR} - ${_RUBY_POSSIBLE_EXECUTABLE_NAMES}) + set(Ruby_FIND_VERSION_SHORT_NODOT "${Ruby_FIND_VERSION_MAJOR}${RUBY_FIND_VERSION_MINOR}") + # we can't construct that if only major version is given + set(_RUBY_POSSIBLE_EXECUTABLE_NAMES + ruby${Ruby_FIND_VERSION_MAJOR}.${Ruby_FIND_VERSION_MINOR} + ruby${Ruby_FIND_VERSION_MAJOR}${Ruby_FIND_VERSION_MINOR} + ${_RUBY_POSSIBLE_EXECUTABLE_NAMES}) else() - set(Ruby_FIND_VERSION_SHORT_NODOT "18") + set(Ruby_FIND_VERSION_SHORT_NODOT "18") endif() if(NOT Ruby_FIND_VERSION_EXACT) @@ -94,130 +94,131 @@ if(RUBY_EXECUTABLE AND NOT RUBY_VERSION_MAJOR) # query the ruby version - _RUBY_CONFIG_VAR("MAJOR" RUBY_VERSION_MAJOR) - _RUBY_CONFIG_VAR("MINOR" RUBY_VERSION_MINOR) - _RUBY_CONFIG_VAR("TEENY" RUBY_VERSION_PATCH) - - # query the different directories - _RUBY_CONFIG_VAR("archdir" RUBY_ARCH_DIR) - _RUBY_CONFIG_VAR("arch" RUBY_ARCH) - _RUBY_CONFIG_VAR("rubyhdrdir" RUBY_HDR_DIR) - _RUBY_CONFIG_VAR("rubyarchhdrdir" RUBY_ARCHHDR_DIR) - _RUBY_CONFIG_VAR("libdir" RUBY_POSSIBLE_LIB_DIR) - _RUBY_CONFIG_VAR("rubylibdir" RUBY_RUBY_LIB_DIR) - - # site_ruby - _RUBY_CONFIG_VAR("sitearchdir" RUBY_SITEARCH_DIR) - _RUBY_CONFIG_VAR("sitelibdir" RUBY_SITELIB_DIR) - - # vendor_ruby available ? - execute_process(COMMAND ${RUBY_EXECUTABLE} -r vendor-specific -e "print 'true'" - OUTPUT_VARIABLE RUBY_HAS_VENDOR_RUBY ERROR_QUIET) - - if(RUBY_HAS_VENDOR_RUBY) - _RUBY_CONFIG_VAR("vendorlibdir" RUBY_VENDORLIB_DIR) - _RUBY_CONFIG_VAR("vendorarchdir" RUBY_VENDORARCH_DIR) - endif() - - # save the results in the cache so we don't have to run ruby the next time again - set(RUBY_VERSION_MAJOR ${RUBY_VERSION_MAJOR} CACHE PATH "The Ruby major version" FORCE) - set(RUBY_VERSION_MINOR ${RUBY_VERSION_MINOR} CACHE PATH "The Ruby minor version" FORCE) - set(RUBY_VERSION_PATCH ${RUBY_VERSION_PATCH} CACHE PATH "The Ruby patch version" FORCE) - set(RUBY_ARCH_DIR ${RUBY_ARCH_DIR} CACHE PATH "The Ruby arch dir" FORCE) - set(RUBY_HDR_DIR ${RUBY_HDR_DIR} CACHE PATH "The Ruby header dir (1.9+)" FORCE) - set(RUBY_ARCHHDR_DIR ${RUBY_ARCHHDR_DIR} CACHE PATH "The Ruby arch header dir (2.0+)" FORCE) - set(RUBY_POSSIBLE_LIB_DIR ${RUBY_POSSIBLE_LIB_DIR} CACHE PATH "The Ruby lib dir" FORCE) - set(RUBY_RUBY_LIB_DIR ${RUBY_RUBY_LIB_DIR} CACHE PATH "The Ruby ruby-lib dir" FORCE) - set(RUBY_SITEARCH_DIR ${RUBY_SITEARCH_DIR} CACHE PATH "The Ruby site arch dir" FORCE) - set(RUBY_SITELIB_DIR ${RUBY_SITELIB_DIR} CACHE PATH "The Ruby site lib dir" FORCE) - set(RUBY_HAS_VENDOR_RUBY ${RUBY_HAS_VENDOR_RUBY} CACHE BOOL "Vendor Ruby is available" FORCE) - set(RUBY_VENDORARCH_DIR ${RUBY_VENDORARCH_DIR} CACHE PATH "The Ruby vendor arch dir" FORCE) - set(RUBY_VENDORLIB_DIR ${RUBY_VENDORLIB_DIR} CACHE PATH "The Ruby vendor lib dir" FORCE) - - mark_as_advanced( - RUBY_ARCH_DIR - RUBY_ARCH - RUBY_HDR_DIR - RUBY_ARCHHDR_DIR - RUBY_POSSIBLE_LIB_DIR - RUBY_RUBY_LIB_DIR - RUBY_SITEARCH_DIR - RUBY_SITELIB_DIR - RUBY_HAS_VENDOR_RUBY - RUBY_VENDORARCH_DIR - RUBY_VENDORLIB_DIR - RUBY_VERSION_MAJOR - RUBY_VERSION_MINOR - RUBY_VERSION_PATCH - ) + _RUBY_CONFIG_VAR("MAJOR" RUBY_VERSION_MAJOR) + _RUBY_CONFIG_VAR("MINOR" RUBY_VERSION_MINOR) + _RUBY_CONFIG_VAR("TEENY" RUBY_VERSION_PATCH) + + # query the different directories + _RUBY_CONFIG_VAR("archdir" RUBY_ARCH_DIR) + _RUBY_CONFIG_VAR("arch" RUBY_ARCH) + _RUBY_CONFIG_VAR("rubyhdrdir" RUBY_HDR_DIR) + _RUBY_CONFIG_VAR("rubyarchhdrdir" RUBY_ARCHHDR_DIR) + _RUBY_CONFIG_VAR("libdir" RUBY_POSSIBLE_LIB_DIR) + _RUBY_CONFIG_VAR("rubylibdir" RUBY_RUBY_LIB_DIR) + + # site_ruby + _RUBY_CONFIG_VAR("sitearchdir" RUBY_SITEARCH_DIR) + _RUBY_CONFIG_VAR("sitelibdir" RUBY_SITELIB_DIR) + + # vendor_ruby available ? + execute_process(COMMAND ${RUBY_EXECUTABLE} -r vendor-specific -e "print 'true'" + OUTPUT_VARIABLE RUBY_HAS_VENDOR_RUBY ERROR_QUIET) + + if(RUBY_HAS_VENDOR_RUBY) + _RUBY_CONFIG_VAR("vendorlibdir" RUBY_VENDORLIB_DIR) + _RUBY_CONFIG_VAR("vendorarchdir" RUBY_VENDORARCH_DIR) + endif() + + # save the results in the cache so we don't have to run ruby the next time again + set(RUBY_VERSION_MAJOR ${RUBY_VERSION_MAJOR} CACHE PATH "The Ruby major version" FORCE) + set(RUBY_VERSION_MINOR ${RUBY_VERSION_MINOR} CACHE PATH "The Ruby minor version" FORCE) + set(RUBY_VERSION_PATCH ${RUBY_VERSION_PATCH} CACHE PATH "The Ruby patch version" FORCE) + set(RUBY_ARCH_DIR ${RUBY_ARCH_DIR} CACHE PATH "The Ruby arch dir" FORCE) + set(RUBY_HDR_DIR ${RUBY_HDR_DIR} CACHE PATH "The Ruby header dir (1.9+)" FORCE) + set(RUBY_ARCHHDR_DIR ${RUBY_ARCHHDR_DIR} CACHE PATH "The Ruby arch header dir (2.0+)" FORCE) + set(RUBY_POSSIBLE_LIB_DIR ${RUBY_POSSIBLE_LIB_DIR} CACHE PATH "The Ruby lib dir" FORCE) + set(RUBY_RUBY_LIB_DIR ${RUBY_RUBY_LIB_DIR} CACHE PATH "The Ruby ruby-lib dir" FORCE) + set(RUBY_SITEARCH_DIR ${RUBY_SITEARCH_DIR} CACHE PATH "The Ruby site arch dir" FORCE) + set(RUBY_SITELIB_DIR ${RUBY_SITELIB_DIR} CACHE PATH "The Ruby site lib dir" FORCE) + set(RUBY_HAS_VENDOR_RUBY ${RUBY_HAS_VENDOR_RUBY} CACHE BOOL "Vendor Ruby is available" FORCE) + set(RUBY_VENDORARCH_DIR ${RUBY_VENDORARCH_DIR} CACHE PATH "The Ruby vendor arch dir" FORCE) + set(RUBY_VENDORLIB_DIR ${RUBY_VENDORLIB_DIR} CACHE PATH "The Ruby vendor lib dir" FORCE) + + mark_as_advanced( + RUBY_ARCH_DIR + RUBY_ARCH + RUBY_HDR_DIR + RUBY_ARCHHDR_DIR + RUBY_POSSIBLE_LIB_DIR + RUBY_RUBY_LIB_DIR + RUBY_SITEARCH_DIR + RUBY_SITELIB_DIR + RUBY_HAS_VENDOR_RUBY + RUBY_VENDORARCH_DIR + RUBY_VENDORLIB_DIR + RUBY_VERSION_MAJOR + RUBY_VERSION_MINOR + RUBY_VERSION_PATCH + ) endif() # In case RUBY_EXECUTABLE could not be executed (e.g. cross compiling) # try to detect which version we found. This is not too good. if(RUBY_EXECUTABLE AND NOT RUBY_VERSION_MAJOR) - # by default assume 1.8.0 - set(RUBY_VERSION_MAJOR 1) - set(RUBY_VERSION_MINOR 8) - set(RUBY_VERSION_PATCH 0) - # check whether we found 1.9.x - if(${RUBY_EXECUTABLE} MATCHES "ruby1\\.?9") - set(RUBY_VERSION_MAJOR 1) - set(RUBY_VERSION_MINOR 9) - endif() - # check whether we found 2.0.x - if(${RUBY_EXECUTABLE} MATCHES "ruby2\\.?0") - set(RUBY_VERSION_MAJOR 2) - set(RUBY_VERSION_MINOR 0) - endif() - # check whether we found 2.1.x - if(${RUBY_EXECUTABLE} MATCHES "ruby2\\.?1") - set(RUBY_VERSION_MAJOR 2) - set(RUBY_VERSION_MINOR 1) - endif() - # check whether we found 2.2.x - if(${RUBY_EXECUTABLE} MATCHES "ruby2\\.?2") - set(RUBY_VERSION_MAJOR 2) - set(RUBY_VERSION_MINOR 2) - endif() - # check whether we found 2.3.x - if(${RUBY_EXECUTABLE} MATCHES "ruby2\\.?3") - set(RUBY_VERSION_MAJOR 2) - set(RUBY_VERSION_MINOR 3) - endif() - # check whether we found 2.4.x - if(${RUBY_EXECUTABLE} MATCHES "ruby2\\.?4") - set(RUBY_VERSION_MAJOR 2) - set(RUBY_VERSION_MINOR 4) - endif() + # by default assume 1.8.0 + set(RUBY_VERSION_MAJOR 1) + set(RUBY_VERSION_MINOR 8) + set(RUBY_VERSION_PATCH 0) + # check whether we found 1.9.x + if(${RUBY_EXECUTABLE} MATCHES "ruby1\\.?9") + set(RUBY_VERSION_MAJOR 1) + set(RUBY_VERSION_MINOR 9) + endif() + # check whether we found 2.0.x + if(${RUBY_EXECUTABLE} MATCHES "ruby2\\.?0") + set(RUBY_VERSION_MAJOR 2) + set(RUBY_VERSION_MINOR 0) + endif() + # check whether we found 2.1.x + if(${RUBY_EXECUTABLE} MATCHES "ruby2\\.?1") + set(RUBY_VERSION_MAJOR 2) + set(RUBY_VERSION_MINOR 1) + endif() + # check whether we found 2.2.x + if(${RUBY_EXECUTABLE} MATCHES "ruby2\\.?2") + set(RUBY_VERSION_MAJOR 2) + set(RUBY_VERSION_MINOR 2) + endif() + # check whether we found 2.3.x + if(${RUBY_EXECUTABLE} MATCHES "ruby2\\.?3") + set(RUBY_VERSION_MAJOR 2) + set(RUBY_VERSION_MINOR 3) + endif() + # check whether we found 2.4.x + if(${RUBY_EXECUTABLE} MATCHES "ruby2\\.?4") + set(RUBY_VERSION_MAJOR 2) + set(RUBY_VERSION_MINOR 4) + endif() endif() if(RUBY_VERSION_MAJOR) - set(RUBY_VERSION "${RUBY_VERSION_MAJOR}.${RUBY_VERSION_MINOR}.${RUBY_VERSION_PATCH}") - set(_RUBY_VERSION_SHORT "${RUBY_VERSION_MAJOR}.${RUBY_VERSION_MINOR}") - set(_RUBY_VERSION_SHORT_NODOT "${RUBY_VERSION_MAJOR}${RUBY_VERSION_MINOR}") - set(_RUBY_NODOT_VERSION "${RUBY_VERSION_MAJOR}${RUBY_VERSION_MINOR}${RUBY_VERSION_PATCH}") + set(RUBY_VERSION "${RUBY_VERSION_MAJOR}.${RUBY_VERSION_MINOR}.${RUBY_VERSION_PATCH}") + set(_RUBY_VERSION_SHORT "${RUBY_VERSION_MAJOR}.${RUBY_VERSION_MINOR}") + set(_RUBY_VERSION_SHORT_NODOT "${RUBY_VERSION_MAJOR}${RUBY_VERSION_MINOR}") + set(_RUBY_NODOT_VERSION "${RUBY_VERSION_MAJOR}${RUBY_VERSION_MINOR}${RUBY_VERSION_PATCH}") endif() find_path(RUBY_INCLUDE_DIR - NAMES ruby.h - HINTS - ${RUBY_HDR_DIR} - ${RUBY_ARCH_DIR} - /usr/lib/ruby/${_RUBY_VERSION_SHORT}/i586-linux-gnu/ ) + NAMES ruby.h + HINTS + ${RUBY_HDR_DIR} + ${RUBY_ARCH_DIR} + /usr/lib/ruby/${_RUBY_VERSION_SHORT}/i586-linux-gnu/ +) set(RUBY_INCLUDE_DIRS ${RUBY_INCLUDE_DIR} ) # if ruby > 1.8 is required or if ruby > 1.8 was found, search for the config.h dir if( "${Ruby_FIND_VERSION_SHORT_NODOT}" GREATER 18 OR "${_RUBY_VERSION_SHORT_NODOT}" GREATER 18 OR RUBY_HDR_DIR) - find_path(RUBY_CONFIG_INCLUDE_DIR - NAMES ruby/config.h config.h - HINTS - ${RUBY_HDR_DIR}/${RUBY_ARCH} - ${RUBY_ARCH_DIR} - ${RUBY_ARCHHDR_DIR} - ) - - set(RUBY_INCLUDE_DIRS ${RUBY_INCLUDE_DIRS} ${RUBY_CONFIG_INCLUDE_DIR} ) + find_path(RUBY_CONFIG_INCLUDE_DIR + NAMES ruby/config.h config.h + HINTS + ${RUBY_HDR_DIR}/${RUBY_ARCH} + ${RUBY_ARCH_DIR} + ${RUBY_ARCHHDR_DIR} + ) + + set(RUBY_INCLUDE_DIRS ${RUBY_INCLUDE_DIRS} ${RUBY_CONFIG_INCLUDE_DIR} ) endif() @@ -225,33 +226,33 @@ endif() set(_RUBY_POSSIBLE_LIB_NAMES ruby ruby-static ruby${_RUBY_VERSION_SHORT} ruby${_RUBY_VERSION_SHORT_NODOT} ruby-${_RUBY_VERSION_SHORT} ruby-${RUBY_VERSION}) if(WIN32) - set( _RUBY_MSVC_RUNTIME "" ) - if( MSVC_VERSION EQUAL 1200 ) - set( _RUBY_MSVC_RUNTIME "60" ) - endif() - if( MSVC_VERSION EQUAL 1300 ) - set( _RUBY_MSVC_RUNTIME "70" ) - endif() - if( MSVC_VERSION EQUAL 1310 ) - set( _RUBY_MSVC_RUNTIME "71" ) - endif() - if( MSVC_VERSION EQUAL 1400 ) - set( _RUBY_MSVC_RUNTIME "80" ) - endif() - if( MSVC_VERSION EQUAL 1500 ) - set( _RUBY_MSVC_RUNTIME "90" ) - endif() - - set(_RUBY_ARCH_PREFIX "") - if(CMAKE_SIZEOF_VOID_P EQUAL 8) - set(_RUBY_ARCH_PREFIX "x64-") - endif() - - list(APPEND _RUBY_POSSIBLE_LIB_NAMES - "${_RUBY_ARCH_PREFIX}msvcr${_RUBY_MSVC_RUNTIME}-ruby${_RUBY_NODOT_VERSION}" - "${_RUBY_ARCH_PREFIX}msvcr${_RUBY_MSVC_RUNTIME}-ruby${_RUBY_NODOT_VERSION}-static" - "${_RUBY_ARCH_PREFIX}msvcrt-ruby${_RUBY_NODOT_VERSION}" - "${_RUBY_ARCH_PREFIX}msvcrt-ruby${_RUBY_NODOT_VERSION}-static" ) + set( _RUBY_MSVC_RUNTIME "" ) + if( MSVC_VERSION EQUAL 1200 ) + set( _RUBY_MSVC_RUNTIME "60" ) + endif() + if( MSVC_VERSION EQUAL 1300 ) + set( _RUBY_MSVC_RUNTIME "70" ) + endif() + if( MSVC_VERSION EQUAL 1310 ) + set( _RUBY_MSVC_RUNTIME "71" ) + endif() + if( MSVC_VERSION EQUAL 1400 ) + set( _RUBY_MSVC_RUNTIME "80" ) + endif() + if( MSVC_VERSION EQUAL 1500 ) + set( _RUBY_MSVC_RUNTIME "90" ) + endif() + + set(_RUBY_ARCH_PREFIX "") + if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(_RUBY_ARCH_PREFIX "x64-") + endif() + + list(APPEND _RUBY_POSSIBLE_LIB_NAMES + "${_RUBY_ARCH_PREFIX}msvcr${_RUBY_MSVC_RUNTIME}-ruby${_RUBY_NODOT_VERSION}" + "${_RUBY_ARCH_PREFIX}msvcr${_RUBY_MSVC_RUNTIME}-ruby${_RUBY_NODOT_VERSION}-static" + "${_RUBY_ARCH_PREFIX}msvcrt-ruby${_RUBY_NODOT_VERSION}" + "${_RUBY_ARCH_PREFIX}msvcrt-ruby${_RUBY_NODOT_VERSION}-static" ) endif() find_library(RUBY_LIBRARY NAMES ${_RUBY_POSSIBLE_LIB_NAMES} HINTS ${RUBY_POSSIBLE_LIB_DIR} ) @@ -259,23 +260,23 @@ find_library(RUBY_LIBRARY NAMES ${_RUBY_POSSIBLE_LIB_NAMES} HINTS ${RUBY_POSSIBL include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) set(_RUBY_REQUIRED_VARS RUBY_EXECUTABLE RUBY_INCLUDE_DIR RUBY_LIBRARY) if(_RUBY_VERSION_SHORT_NODOT GREATER 18) - list(APPEND _RUBY_REQUIRED_VARS RUBY_CONFIG_INCLUDE_DIR) + list(APPEND _RUBY_REQUIRED_VARS RUBY_CONFIG_INCLUDE_DIR) endif() if(_RUBY_DEBUG_OUTPUT) - message(STATUS "--------FindRuby.cmake debug------------") - message(STATUS "_RUBY_POSSIBLE_EXECUTABLE_NAMES: ${_RUBY_POSSIBLE_EXECUTABLE_NAMES}") - message(STATUS "_RUBY_POSSIBLE_LIB_NAMES: ${_RUBY_POSSIBLE_LIB_NAMES}") - message(STATUS "RUBY_ARCH_DIR: ${RUBY_ARCH_DIR}") - message(STATUS "RUBY_HDR_DIR: ${RUBY_HDR_DIR}") - message(STATUS "RUBY_POSSIBLE_LIB_DIR: ${RUBY_POSSIBLE_LIB_DIR}") - message(STATUS "Found RUBY_VERSION: \"${RUBY_VERSION}\" , short: \"${_RUBY_VERSION_SHORT}\", nodot: \"${_RUBY_VERSION_SHORT_NODOT}\"") - message(STATUS "_RUBY_REQUIRED_VARS: ${_RUBY_REQUIRED_VARS}") - message(STATUS "RUBY_EXECUTABLE: ${RUBY_EXECUTABLE}") - message(STATUS "RUBY_LIBRARY: ${RUBY_LIBRARY}") - message(STATUS "RUBY_INCLUDE_DIR: ${RUBY_INCLUDE_DIR}") - message(STATUS "RUBY_CONFIG_INCLUDE_DIR: ${RUBY_CONFIG_INCLUDE_DIR}") - message(STATUS "--------------------") + message(STATUS "--------FindRuby.cmake debug------------") + message(STATUS "_RUBY_POSSIBLE_EXECUTABLE_NAMES: ${_RUBY_POSSIBLE_EXECUTABLE_NAMES}") + message(STATUS "_RUBY_POSSIBLE_LIB_NAMES: ${_RUBY_POSSIBLE_LIB_NAMES}") + message(STATUS "RUBY_ARCH_DIR: ${RUBY_ARCH_DIR}") + message(STATUS "RUBY_HDR_DIR: ${RUBY_HDR_DIR}") + message(STATUS "RUBY_POSSIBLE_LIB_DIR: ${RUBY_POSSIBLE_LIB_DIR}") + message(STATUS "Found RUBY_VERSION: \"${RUBY_VERSION}\" , short: \"${_RUBY_VERSION_SHORT}\", nodot: \"${_RUBY_VERSION_SHORT_NODOT}\"") + message(STATUS "_RUBY_REQUIRED_VARS: ${_RUBY_REQUIRED_VARS}") + message(STATUS "RUBY_EXECUTABLE: ${RUBY_EXECUTABLE}") + message(STATUS "RUBY_LIBRARY: ${RUBY_LIBRARY}") + message(STATUS "RUBY_INCLUDE_DIR: ${RUBY_INCLUDE_DIR}") + message(STATUS "RUBY_CONFIG_INCLUDE_DIR: ${RUBY_CONFIG_INCLUDE_DIR}") + message(STATUS "--------------------") endif() FIND_PACKAGE_HANDLE_STANDARD_ARGS(Ruby REQUIRED_VARS ${_RUBY_REQUIRED_VARS} diff --git a/Modules/FindSDL_sound.cmake b/Modules/FindSDL_sound.cmake index c986574..8d2f9f8 100644 --- a/Modules/FindSDL_sound.cmake +++ b/Modules/FindSDL_sound.cmake @@ -152,202 +152,199 @@ if(SDL_FOUND AND SDL_SOUND_INCLUDE_DIR AND SDL_SOUND_LIBRARY) SDL_Quit(); return 0; }" - ) - - # Calling - # target_link_libraries(DetermineSoundLibs "${SDL_SOUND_LIBRARY} ${SDL_LIBRARY}) - # causes problems when SDL_LIBRARY looks like - # /Library/Frameworks/SDL.framework;-framework Cocoa - # The ;-framework Cocoa seems to be confusing CMake once the OS X - # framework support was added. I was told that breaking up the list - # would fix the problem. - set(TMP_TRY_LIBS) - foreach(lib ${SDL_SOUND_LIBRARY} ${SDL_LIBRARY}) - string(APPEND TMP_TRY_LIBS " \"${lib}\"") - endforeach() - - # message("TMP_TRY_LIBS ${TMP_TRY_LIBS}") - - # Write the CMakeLists.txt and test project - # Weird, this is still sketchy. If I don't quote the variables - # in the TARGET_LINK_LIBRARIES, I seem to loose everything - # in the SDL_LIBRARY string after the "-framework". - # But if I quote the stuff in INCLUDE_DIRECTORIES, it doesn't work. - file(WRITE ${PROJECT_BINARY_DIR}/CMakeTmp/CMakeLists.txt - "cmake_minimum_required(VERSION ${CMAKE_VERSION}) - project(DetermineSoundLibs) - include_directories(${SDL_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR}) - add_executable(DetermineSoundLibs DetermineSoundLibs.c) - target_link_libraries(DetermineSoundLibs ${TMP_TRY_LIBS})" - ) - - try_compile( - MY_RESULT - ${PROJECT_BINARY_DIR}/CMakeTmp - ${PROJECT_BINARY_DIR}/CMakeTmp - DetermineSoundLibs - OUTPUT_VARIABLE MY_OUTPUT - ) - - # message("${MY_RESULT}") - # message(${MY_OUTPUT}) - - if(NOT MY_RESULT) - - # I expect that MPGLIB, VOC, WAV, AIFF, and SHN are compiled in statically. - # I think Timidity is also compiled in statically. - # I've never had to explcitly link against Quicktime, so I'll skip that for now. - - set(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARY}) - - # Find MikMod - if("${MY_OUTPUT}" MATCHES "MikMod_") - find_library(MIKMOD_LIBRARY - NAMES libmikmod-coreaudio mikmod - PATHS - ENV MIKMODDIR - ENV SDLSOUNDDIR - ENV SDLDIR - /opt - PATH_SUFFIXES - lib - ) - if(MIKMOD_LIBRARY) - set(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${MIKMOD_LIBRARY}) - endif(MIKMOD_LIBRARY) - endif("${MY_OUTPUT}" MATCHES "MikMod_") - - # Find ModPlug - if("${MY_OUTPUT}" MATCHES "MODPLUG_") - find_library(MODPLUG_LIBRARY - NAMES modplug - PATHS - ENV MODPLUGDIR - ENV SDLSOUNDDIR - ENV SDLDIR - /opt - PATH_SUFFIXES - lib - ) - if(MODPLUG_LIBRARY) - set(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${MODPLUG_LIBRARY}) - endif() - endif() - - - # Find Ogg and Vorbis - if("${MY_OUTPUT}" MATCHES "ov_") - find_library(VORBIS_LIBRARY - NAMES vorbis Vorbis VORBIS - PATHS - ENV VORBISDIR - ENV OGGDIR - ENV SDLSOUNDDIR - ENV SDLDIR - /opt - PATH_SUFFIXES - lib - ) - if(VORBIS_LIBRARY) - set(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${VORBIS_LIBRARY}) - endif() - - find_library(OGG_LIBRARY - NAMES ogg Ogg OGG - PATHS - ENV OGGDIR - ENV VORBISDIR - ENV SDLSOUNDDIR - ENV SDLDIR - /opt - PATH_SUFFIXES - lib - ) - if(OGG_LIBRARY) - set(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${OGG_LIBRARY}) - endif() - endif() - - - # Find SMPEG - if("${MY_OUTPUT}" MATCHES "SMPEG_") - find_library(SMPEG_LIBRARY - NAMES smpeg SMPEG Smpeg SMpeg - PATHS - ENV SMPEGDIR - ENV SDLSOUNDDIR - ENV SDLDIR - /opt - PATH_SUFFIXES - lib - ) - if(SMPEG_LIBRARY) - set(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${SMPEG_LIBRARY}) - endif() - endif() - - - # Find FLAC - if("${MY_OUTPUT}" MATCHES "FLAC_") - find_library(FLAC_LIBRARY - NAMES flac FLAC - PATHS - ENV FLACDIR - ENV SDLSOUNDDIR - ENV SDLDIR - /opt - PATH_SUFFIXES - lib - ) - if(FLAC_LIBRARY) - set(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${FLAC_LIBRARY}) - endif() - endif() - - - # Hmmm...Speex seems to depend on Ogg. This might be a problem if - # the TRY_COMPILE attempt gets blocked at SPEEX before it can pull - # in the Ogg symbols. I'm not sure if I should duplicate the ogg stuff - # above for here or if two ogg entries will screw up things. - if("${MY_OUTPUT}" MATCHES "speex_") - find_library(SPEEX_LIBRARY - NAMES speex SPEEX - PATHS - ENV SPEEXDIR - ENV SDLSOUNDDIR - ENV SDLDIR - /opt - PATH_SUFFIXES - lib + ) + + # Calling + # target_link_libraries(DetermineSoundLibs "${SDL_SOUND_LIBRARY} ${SDL_LIBRARY}) + # causes problems when SDL_LIBRARY looks like + # /Library/Frameworks/SDL.framework;-framework Cocoa + # The ;-framework Cocoa seems to be confusing CMake once the OS X + # framework support was added. I was told that breaking up the list + # would fix the problem. + set(TMP_TRY_LIBS) + foreach(lib ${SDL_SOUND_LIBRARY} ${SDL_LIBRARY}) + string(APPEND TMP_TRY_LIBS " \"${lib}\"") + endforeach() + + + # Write the CMakeLists.txt and test project + # Weird, this is still sketchy. If I don't quote the variables + # in the TARGET_LINK_LIBRARIES, I seem to loose everything + # in the SDL_LIBRARY string after the "-framework". + # But if I quote the stuff in INCLUDE_DIRECTORIES, it doesn't work. + file(WRITE ${PROJECT_BINARY_DIR}/CMakeTmp/CMakeLists.txt + "cmake_minimum_required(VERSION ${CMAKE_VERSION}) + project(DetermineSoundLibs) + include_directories(${SDL_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR}) + add_executable(DetermineSoundLibs DetermineSoundLibs.c) + target_link_libraries(DetermineSoundLibs ${TMP_TRY_LIBS})" + ) + + try_compile( + MY_RESULT + ${PROJECT_BINARY_DIR}/CMakeTmp + ${PROJECT_BINARY_DIR}/CMakeTmp + DetermineSoundLibs + OUTPUT_VARIABLE MY_OUTPUT + ) + + + if(NOT MY_RESULT) + + # I expect that MPGLIB, VOC, WAV, AIFF, and SHN are compiled in statically. + # I think Timidity is also compiled in statically. + # I've never had to explcitly link against Quicktime, so I'll skip that for now. + + set(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARY}) + + # Find MikMod + if("${MY_OUTPUT}" MATCHES "MikMod_") + find_library(MIKMOD_LIBRARY + NAMES libmikmod-coreaudio mikmod + PATHS + ENV MIKMODDIR + ENV SDLSOUNDDIR + ENV SDLDIR + /opt + PATH_SUFFIXES + lib + ) + if(MIKMOD_LIBRARY) + set(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${MIKMOD_LIBRARY}) + endif(MIKMOD_LIBRARY) + endif("${MY_OUTPUT}" MATCHES "MikMod_") + + # Find ModPlug + if("${MY_OUTPUT}" MATCHES "MODPLUG_") + find_library(MODPLUG_LIBRARY + NAMES modplug + PATHS + ENV MODPLUGDIR + ENV SDLSOUNDDIR + ENV SDLDIR + /opt + PATH_SUFFIXES + lib + ) + if(MODPLUG_LIBRARY) + set(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${MODPLUG_LIBRARY}) + endif() + endif() + + + # Find Ogg and Vorbis + if("${MY_OUTPUT}" MATCHES "ov_") + find_library(VORBIS_LIBRARY + NAMES vorbis Vorbis VORBIS + PATHS + ENV VORBISDIR + ENV OGGDIR + ENV SDLSOUNDDIR + ENV SDLDIR + /opt + PATH_SUFFIXES + lib + ) + if(VORBIS_LIBRARY) + set(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${VORBIS_LIBRARY}) + endif() + + find_library(OGG_LIBRARY + NAMES ogg Ogg OGG + PATHS + ENV OGGDIR + ENV VORBISDIR + ENV SDLSOUNDDIR + ENV SDLDIR + /opt + PATH_SUFFIXES + lib ) - if(SPEEX_LIBRARY) - set(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${SPEEX_LIBRARY}) - endif() - - # Find OGG (needed for Speex) - # We might have already found Ogg for Vorbis, so skip it if so. - if(NOT OGG_LIBRARY) - find_library(OGG_LIBRARY - NAMES ogg Ogg OGG - PATHS - ENV OGGDIR - ENV VORBISDIR - ENV SPEEXDIR - ENV SDLSOUNDDIR - ENV SDLDIR - /opt - PATH_SUFFIXES lib - ) - if(OGG_LIBRARY) - set(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${OGG_LIBRARY}) - endif() - endif() - endif() - - set(SDL_SOUND_LIBRARIES ${SDL_SOUND_EXTRAS} ${SDL_SOUND_LIBRARIES_TMP}) - else() - set(SDL_SOUND_LIBRARIES ${SDL_SOUND_EXTRAS} ${SDL_SOUND_LIBRARY}) - endif() + if(OGG_LIBRARY) + set(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${OGG_LIBRARY}) + endif() + endif() + + + # Find SMPEG + if("${MY_OUTPUT}" MATCHES "SMPEG_") + find_library(SMPEG_LIBRARY + NAMES smpeg SMPEG Smpeg SMpeg + PATHS + ENV SMPEGDIR + ENV SDLSOUNDDIR + ENV SDLDIR + /opt + PATH_SUFFIXES + lib + ) + if(SMPEG_LIBRARY) + set(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${SMPEG_LIBRARY}) + endif() + endif() + + + # Find FLAC + if("${MY_OUTPUT}" MATCHES "FLAC_") + find_library(FLAC_LIBRARY + NAMES flac FLAC + PATHS + ENV FLACDIR + ENV SDLSOUNDDIR + ENV SDLDIR + /opt + PATH_SUFFIXES + lib + ) + if(FLAC_LIBRARY) + set(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${FLAC_LIBRARY}) + endif() + endif() + + + # Hmmm...Speex seems to depend on Ogg. This might be a problem if + # the TRY_COMPILE attempt gets blocked at SPEEX before it can pull + # in the Ogg symbols. I'm not sure if I should duplicate the ogg stuff + # above for here or if two ogg entries will screw up things. + if("${MY_OUTPUT}" MATCHES "speex_") + find_library(SPEEX_LIBRARY + NAMES speex SPEEX + PATHS + ENV SPEEXDIR + ENV SDLSOUNDDIR + ENV SDLDIR + /opt + PATH_SUFFIXES + lib + ) + if(SPEEX_LIBRARY) + set(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${SPEEX_LIBRARY}) + endif() + + # Find OGG (needed for Speex) + # We might have already found Ogg for Vorbis, so skip it if so. + if(NOT OGG_LIBRARY) + find_library(OGG_LIBRARY + NAMES ogg Ogg OGG + PATHS + ENV OGGDIR + ENV VORBISDIR + ENV SPEEXDIR + ENV SDLSOUNDDIR + ENV SDLDIR + /opt + PATH_SUFFIXES lib + ) + if(OGG_LIBRARY) + set(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${OGG_LIBRARY}) + endif() + endif() + endif() + + set(SDL_SOUND_LIBRARIES ${SDL_SOUND_EXTRAS} ${SDL_SOUND_LIBRARIES_TMP}) + else() + set(SDL_SOUND_LIBRARIES ${SDL_SOUND_EXTRAS} ${SDL_SOUND_LIBRARY}) + endif() endif() if(SDL_SOUND_INCLUDE_DIR AND EXISTS "${SDL_SOUND_INCLUDE_DIR}/SDL_sound.h") diff --git a/Modules/FindTclsh.cmake b/Modules/FindTclsh.cmake index e3bd110..82be473 100644 --- a/Modules/FindTclsh.cmake +++ b/Modules/FindTclsh.cmake @@ -84,11 +84,11 @@ find_program(TCL_TCLSH ) if(TCL_TCLSH) - execute_process(COMMAND "${CMAKE_COMMAND}" -E echo puts "\$tcl_version" - COMMAND "${TCL_TCLSH}" - OUTPUT_VARIABLE TCLSH_VERSION_STRING - ERROR_QUIET - OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process(COMMAND "${CMAKE_COMMAND}" -E echo puts "\$tcl_version" + COMMAND "${TCL_TCLSH}" + OUTPUT_VARIABLE TCLSH_VERSION_STRING + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) endif() include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) diff --git a/Modules/Findosg_functions.cmake b/Modules/Findosg_functions.cmake index 40df4d5..563b6bd 100644 --- a/Modules/Findosg_functions.cmake +++ b/Modules/Findosg_functions.cmake @@ -20,19 +20,19 @@ include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake) # OSG_FIND_PATH # function(OSG_FIND_PATH module header) - string(TOUPPER ${module} module_uc) - - # Try the user's environment request before anything else. - find_path(${module_uc}_INCLUDE_DIR ${header} - HINTS - ENV ${module_uc}_DIR - ENV OSG_DIR - ENV OSGDIR - ENV OSG_ROOT - ${${module_uc}_DIR} - ${OSG_DIR} - PATH_SUFFIXES include - ) + string(TOUPPER ${module} module_uc) + + # Try the user's environment request before anything else. + find_path(${module_uc}_INCLUDE_DIR ${header} + HINTS + ENV ${module_uc}_DIR + ENV OSG_DIR + ENV OSGDIR + ENV OSG_ROOT + ${${module_uc}_DIR} + ${OSG_DIR} + PATH_SUFFIXES include + ) endfunction() @@ -40,38 +40,38 @@ endfunction() # OSG_FIND_LIBRARY # function(OSG_FIND_LIBRARY module library) - string(TOUPPER ${module} module_uc) - - find_library(${module_uc}_LIBRARY_RELEASE - NAMES ${library} - HINTS - ENV ${module_uc}_DIR - ENV OSG_DIR - ENV OSGDIR - ENV OSG_ROOT - ${${module_uc}_DIR} - ${OSG_DIR} - PATH_SUFFIXES lib - ) - - find_library(${module_uc}_LIBRARY_DEBUG - NAMES ${library}d - HINTS - ENV ${module_uc}_DIR - ENV OSG_DIR - ENV OSGDIR - ENV OSG_ROOT - ${${module_uc}_DIR} - ${OSG_DIR} - PATH_SUFFIXES lib - ) - - select_library_configurations(${module_uc}) - - # the variables set by select_library_configurations go out of scope - # here, so we need to set them again - set(${module_uc}_LIBRARY ${${module_uc}_LIBRARY} PARENT_SCOPE) - set(${module_uc}_LIBRARIES ${${module_uc}_LIBRARIES} PARENT_SCOPE) + string(TOUPPER ${module} module_uc) + + find_library(${module_uc}_LIBRARY_RELEASE + NAMES ${library} + HINTS + ENV ${module_uc}_DIR + ENV OSG_DIR + ENV OSGDIR + ENV OSG_ROOT + ${${module_uc}_DIR} + ${OSG_DIR} + PATH_SUFFIXES lib + ) + + find_library(${module_uc}_LIBRARY_DEBUG + NAMES ${library}d + HINTS + ENV ${module_uc}_DIR + ENV OSG_DIR + ENV OSGDIR + ENV OSG_ROOT + ${${module_uc}_DIR} + ${OSG_DIR} + PATH_SUFFIXES lib + ) + + select_library_configurations(${module_uc}) + + # the variables set by select_library_configurations go out of scope + # here, so we need to set them again + set(${module_uc}_LIBRARY ${${module_uc}_LIBRARY} PARENT_SCOPE) + set(${module_uc}_LIBRARIES ${${module_uc}_LIBRARIES} PARENT_SCOPE) endfunction() # @@ -79,8 +79,8 @@ endfunction() # Just a convenience function for calling MARK_AS_ADVANCED # function(OSG_MARK_AS_ADVANCED _module) - string(TOUPPER ${_module} _module_UC) - mark_as_advanced(${_module_UC}_INCLUDE_DIR) - mark_as_advanced(${_module_UC}_LIBRARY) - mark_as_advanced(${_module_UC}_LIBRARY_DEBUG) + string(TOUPPER ${_module} _module_UC) + mark_as_advanced(${_module_UC}_INCLUDE_DIR) + mark_as_advanced(${_module_UC}_LIBRARY) + mark_as_advanced(${_module_UC}_LIBRARY_DEBUG) endfunction() diff --git a/Modules/KDE3Macros.cmake b/Modules/KDE3Macros.cmake index b3f31ed..1c353ba 100644 --- a/Modules/KDE3Macros.cmake +++ b/Modules/KDE3Macros.cmake @@ -26,105 +26,106 @@ include(AddFileDependencies) #create the kidl and skeletion file for dcop stuff #usage: KDE_ADD_COP_SKELS(foo_SRCS ${dcop_headers}) macro(KDE3_ADD_DCOP_SKELS _sources) - foreach (_current_FILE ${ARGN}) + foreach (_current_FILE ${ARGN}) - get_filename_component(_tmp_FILE ${_current_FILE} ABSOLUTE) - get_filename_component(_basename ${_tmp_FILE} NAME_WE) + get_filename_component(_tmp_FILE ${_current_FILE} ABSOLUTE) + get_filename_component(_basename ${_tmp_FILE} NAME_WE) - set(_skel ${CMAKE_CURRENT_BINARY_DIR}/${_basename}_skel.cpp) - set(_kidl ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.kidl) + set(_skel ${CMAKE_CURRENT_BINARY_DIR}/${_basename}_skel.cpp) + set(_kidl ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.kidl) - if (NOT HAVE_${_basename}_KIDL_RULE) - set(HAVE_${_basename}_KIDL_RULE ON) + if (NOT HAVE_${_basename}_KIDL_RULE) + set(HAVE_${_basename}_KIDL_RULE ON) - add_custom_command(OUTPUT ${_kidl} - COMMAND ${KDE3_DCOPIDL_EXECUTABLE} - ARGS ${_tmp_FILE} > ${_kidl} - DEPENDS ${_tmp_FILE} - ) + add_custom_command(OUTPUT ${_kidl} + COMMAND ${KDE3_DCOPIDL_EXECUTABLE} + ARGS ${_tmp_FILE} > ${_kidl} + DEPENDS ${_tmp_FILE} + ) - endif () + endif () - if (NOT HAVE_${_basename}_SKEL_RULE) - set(HAVE_${_basename}_SKEL_RULE ON) + if (NOT HAVE_${_basename}_SKEL_RULE) + set(HAVE_${_basename}_SKEL_RULE ON) - add_custom_command(OUTPUT ${_skel} - COMMAND ${KDE3_DCOPIDL2CPP_EXECUTABLE} - ARGS --c++-suffix cpp --no-signals --no-stub ${_kidl} - DEPENDS ${_kidl} - ) + add_custom_command(OUTPUT ${_skel} + COMMAND ${KDE3_DCOPIDL2CPP_EXECUTABLE} + ARGS --c++-suffix cpp --no-signals --no-stub ${_kidl} + DEPENDS ${_kidl} + ) - endif () + endif () - set(${_sources} ${${_sources}} ${_skel}) + set(${_sources} ${${_sources}} ${_skel}) - endforeach () + endforeach () endmacro() macro(KDE3_ADD_DCOP_STUBS _sources) - foreach (_current_FILE ${ARGN}) + foreach (_current_FILE ${ARGN}) - get_filename_component(_tmp_FILE ${_current_FILE} ABSOLUTE) + get_filename_component(_tmp_FILE ${_current_FILE} ABSOLUTE) - get_filename_component(_basename ${_tmp_FILE} NAME_WE) + get_filename_component(_basename ${_tmp_FILE} NAME_WE) - set(_stub_CPP ${CMAKE_CURRENT_BINARY_DIR}/${_basename}_stub.cpp) - set(_kidl ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.kidl) + set(_stub_CPP ${CMAKE_CURRENT_BINARY_DIR}/${_basename}_stub.cpp) + set(_kidl ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.kidl) - if (NOT HAVE_${_basename}_KIDL_RULE) - set(HAVE_${_basename}_KIDL_RULE ON) + if (NOT HAVE_${_basename}_KIDL_RULE) + set(HAVE_${_basename}_KIDL_RULE ON) - add_custom_command(OUTPUT ${_kidl} - COMMAND ${KDE3_DCOPIDL_EXECUTABLE} - ARGS ${_tmp_FILE} > ${_kidl} - DEPENDS ${_tmp_FILE} - ) + add_custom_command(OUTPUT ${_kidl} + COMMAND ${KDE3_DCOPIDL_EXECUTABLE} + ARGS ${_tmp_FILE} > ${_kidl} + DEPENDS ${_tmp_FILE} + ) - endif () + endif () - if (NOT HAVE_${_basename}_STUB_RULE) - set(HAVE_${_basename}_STUB_RULE ON) + if (NOT HAVE_${_basename}_STUB_RULE) + set(HAVE_${_basename}_STUB_RULE ON) - add_custom_command(OUTPUT ${_stub_CPP} - COMMAND ${KDE3_DCOPIDL2CPP_EXECUTABLE} - ARGS --c++-suffix cpp --no-signals --no-skel ${_kidl} - DEPENDS ${_kidl} - ) + add_custom_command(OUTPUT ${_stub_CPP} + COMMAND ${KDE3_DCOPIDL2CPP_EXECUTABLE} + ARGS --c++-suffix cpp --no-signals --no-skel ${_kidl} + DEPENDS ${_kidl} + ) - endif () + endif () - set(${_sources} ${${_sources}} ${_stub_CPP}) + set(${_sources} ${${_sources}} ${_stub_CPP}) - endforeach () + endforeach () endmacro() macro(KDE3_ADD_KCFG_FILES _sources) - foreach (_current_FILE ${ARGN}) + foreach (_current_FILE ${ARGN}) - get_filename_component(_tmp_FILE ${_current_FILE} ABSOLUTE) + get_filename_component(_tmp_FILE ${_current_FILE} ABSOLUTE) - get_filename_component(_basename ${_tmp_FILE} NAME_WE) + get_filename_component(_basename ${_tmp_FILE} NAME_WE) - file(READ ${_tmp_FILE} _contents) - string(REGEX REPLACE "^(.*\n)?File=([^\n]+)\n.*$" "\\2" _kcfg_FILE "${_contents}") + file(READ ${_tmp_FILE} _contents) + string(REGEX REPLACE "^(.*\n)?File=([^\n]+)\n.*$" "\\2" _kcfg_FILE "${_contents}") - set(_src_FILE ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.cpp) - set(_header_FILE ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.h) + set(_src_FILE ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.cpp) + set(_header_FILE ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.h) - add_custom_command(OUTPUT ${_src_FILE} - COMMAND ${KDE3_KCFGC_EXECUTABLE} - ARGS ${CMAKE_CURRENT_SOURCE_DIR}/${_kcfg_FILE} ${_tmp_FILE} - DEPENDS ${_tmp_FILE} ${CMAKE_CURRENT_SOURCE_DIR}/${_kcfg_FILE} ) + add_custom_command(OUTPUT ${_src_FILE} + COMMAND ${KDE3_KCFGC_EXECUTABLE} + ARGS ${CMAKE_CURRENT_SOURCE_DIR}/${_kcfg_FILE} ${_tmp_FILE} + DEPENDS ${_tmp_FILE} ${CMAKE_CURRENT_SOURCE_DIR}/${_kcfg_FILE} + ) - set(${_sources} ${${_sources}} ${_src_FILE}) + set(${_sources} ${${_sources}} ${_src_FILE}) - endforeach () + endforeach () endmacro() @@ -132,22 +133,22 @@ endmacro() #create the moc files and add them to the list of sources #usage: KDE_ADD_MOC_FILES(foo_SRCS ${moc_headers}) macro(KDE3_ADD_MOC_FILES _sources) - foreach (_current_FILE ${ARGN}) + foreach (_current_FILE ${ARGN}) - get_filename_component(_tmp_FILE ${_current_FILE} ABSOLUTE) + get_filename_component(_tmp_FILE ${_current_FILE} ABSOLUTE) - get_filename_component(_basename ${_tmp_FILE} NAME_WE) - set(_moc ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.moc.cpp) + get_filename_component(_basename ${_tmp_FILE} NAME_WE) + set(_moc ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.moc.cpp) - add_custom_command(OUTPUT ${_moc} - COMMAND ${QT_MOC_EXECUTABLE} - ARGS ${_tmp_FILE} -o ${_moc} - DEPENDS ${_tmp_FILE} - ) + add_custom_command(OUTPUT ${_moc} + COMMAND ${QT_MOC_EXECUTABLE} + ARGS ${_tmp_FILE} -o ${_moc} + DEPENDS ${_tmp_FILE} + ) - set(${_sources} ${${_sources}} ${_moc}) + set(${_sources} ${${_sources}} ${_moc}) - endforeach () + endforeach () endmacro() @@ -156,186 +157,186 @@ get_filename_component( KDE3_MODULE_DIR ${CMAKE_CURRENT_LIST_FILE} PATH) #create the implementation files from the ui files and add them to the list of sources #usage: KDE_ADD_UI_FILES(foo_SRCS ${ui_files}) macro(KDE3_ADD_UI_FILES _sources ) - foreach (_current_FILE ${ARGN}) - - get_filename_component(_tmp_FILE ${_current_FILE} ABSOLUTE) - - get_filename_component(_basename ${_tmp_FILE} NAME_WE) - set(_header ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.h) - set(_src ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.cpp) - set(_moc ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.moc.cpp) - - add_custom_command(OUTPUT ${_header} - COMMAND ${QT_UIC_EXECUTABLE} - ARGS -L ${KDE3_LIB_DIR}/kde3/plugins/designer -nounload -o ${_header} ${CMAKE_CURRENT_SOURCE_DIR}/${_current_FILE} - DEPENDS ${_tmp_FILE} - ) - - add_custom_command(OUTPUT ${_src} - COMMAND ${CMAKE_COMMAND} - ARGS - -DKDE_UIC_PLUGIN_DIR:FILEPATH=${KDE3_LIB_DIR}/kde3/plugins/designer - -DKDE_UIC_EXECUTABLE:FILEPATH=${QT_UIC_EXECUTABLE} - -DKDE_UIC_FILE:FILEPATH=${_tmp_FILE} - -DKDE_UIC_CPP_FILE:FILEPATH=${_src} - -DKDE_UIC_H_FILE:FILEPATH=${_header} - -P ${KDE3_MODULE_DIR}/kde3uic.cmake - DEPENDS ${_header} - ) - - add_custom_command(OUTPUT ${_moc} - COMMAND ${QT_MOC_EXECUTABLE} - ARGS ${_header} -o ${_moc} - DEPENDS ${_header} - ) - - set(${_sources} ${${_sources}} ${_src} ${_moc} ) - - endforeach () + foreach (_current_FILE ${ARGN}) + + get_filename_component(_tmp_FILE ${_current_FILE} ABSOLUTE) + + get_filename_component(_basename ${_tmp_FILE} NAME_WE) + set(_header ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.h) + set(_src ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.cpp) + set(_moc ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.moc.cpp) + + add_custom_command(OUTPUT ${_header} + COMMAND ${QT_UIC_EXECUTABLE} + ARGS -L ${KDE3_LIB_DIR}/kde3/plugins/designer -nounload -o ${_header} ${CMAKE_CURRENT_SOURCE_DIR}/${_current_FILE} + DEPENDS ${_tmp_FILE} + ) + + add_custom_command(OUTPUT ${_src} + COMMAND ${CMAKE_COMMAND} + ARGS + -DKDE_UIC_PLUGIN_DIR:FILEPATH=${KDE3_LIB_DIR}/kde3/plugins/designer + -DKDE_UIC_EXECUTABLE:FILEPATH=${QT_UIC_EXECUTABLE} + -DKDE_UIC_FILE:FILEPATH=${_tmp_FILE} + -DKDE_UIC_CPP_FILE:FILEPATH=${_src} + -DKDE_UIC_H_FILE:FILEPATH=${_header} + -P ${KDE3_MODULE_DIR}/kde3uic.cmake + DEPENDS ${_header} + ) + + add_custom_command(OUTPUT ${_moc} + COMMAND ${QT_MOC_EXECUTABLE} + ARGS ${_header} -o ${_moc} + DEPENDS ${_header} + ) + + set(${_sources} ${${_sources}} ${_src} ${_moc} ) + + endforeach () endmacro() macro(KDE3_AUTOMOC) - set(_matching_FILES ) - foreach (_current_FILE ${ARGN}) + set(_matching_FILES ) + foreach (_current_FILE ${ARGN}) - get_filename_component(_abs_FILE ${_current_FILE} ABSOLUTE) + get_filename_component(_abs_FILE ${_current_FILE} ABSOLUTE) - # if "SKIP_AUTOMOC" is set to true, we will not handle this file here. - # here. this is required to make bouic work correctly: - # we need to add generated .cpp files to the sources (to compile them), - # but we cannot let automoc handle them, as the .cpp files don't exist yet when - # cmake is run for the very first time on them -> however the .cpp files might - # exist at a later run. at that time we need to skip them, so that we don't add two - # different rules for the same moc file - get_source_file_property(_skip ${_abs_FILE} SKIP_AUTOMOC) + # if "SKIP_AUTOMOC" is set to true, we will not handle this file here. + # here. this is required to make bouic work correctly: + # we need to add generated .cpp files to the sources (to compile them), + # but we cannot let automoc handle them, as the .cpp files don't exist yet when + # cmake is run for the very first time on them -> however the .cpp files might + # exist at a later run. at that time we need to skip them, so that we don't add two + # different rules for the same moc file + get_source_file_property(_skip ${_abs_FILE} SKIP_AUTOMOC) - if (EXISTS ${_abs_FILE} AND NOT _skip) + if (EXISTS ${_abs_FILE} AND NOT _skip) - file(STRINGS ${_abs_FILE} _match REGEX "#include +[^ ]+\\.moc[\">]") + file(STRINGS ${_abs_FILE} _match REGEX "#include +[^ ]+\\.moc[\">]") - get_filename_component(_abs_PATH ${_abs_FILE} PATH) + get_filename_component(_abs_PATH ${_abs_FILE} PATH) - foreach (_current_MOC_INC IN LISTS _match) - string(REGEX MATCH "[^ <\"]+\\.moc" _current_MOC "${_current_MOC_INC}") + foreach (_current_MOC_INC IN LISTS _match) + string(REGEX MATCH "[^ <\"]+\\.moc" _current_MOC "${_current_MOC_INC}") - get_filename_component(_basename ${_current_MOC} NAME_WE) -# set(_header ${CMAKE_CURRENT_SOURCE_DIR}/${_basename}.h) - set(_header ${_abs_PATH}/${_basename}.h) - set(_moc ${CMAKE_CURRENT_BINARY_DIR}/${_current_MOC}) + get_filename_component(_basename ${_current_MOC} NAME_WE) +# set(_header ${CMAKE_CURRENT_SOURCE_DIR}/${_basename}.h) + set(_header ${_abs_PATH}/${_basename}.h) + set(_moc ${CMAKE_CURRENT_BINARY_DIR}/${_current_MOC}) - add_custom_command(OUTPUT ${_moc} - COMMAND ${QT_MOC_EXECUTABLE} - ARGS ${_header} -o ${_moc} - DEPENDS ${_header} - ) + add_custom_command(OUTPUT ${_moc} + COMMAND ${QT_MOC_EXECUTABLE} + ARGS ${_header} -o ${_moc} + DEPENDS ${_header} + ) - ADD_FILE_DEPENDENCIES(${_abs_FILE} ${_moc}) + ADD_FILE_DEPENDENCIES(${_abs_FILE} ${_moc}) - endforeach () - unset(_match) - unset(_header) - unset(_moc) - endif () - endforeach () + endforeach () + unset(_match) + unset(_header) + unset(_moc) + endif () + endforeach () endmacro() # only used internally by KDE3_INSTALL_ICONS macro (_KDE3_ADD_ICON_INSTALL_RULE _install_SCRIPT _install_PATH _group _orig_NAME _install_NAME) - # if the string doesn't match the pattern, the result is the full string, so all three have the same content - if (NOT ${_group} STREQUAL ${_install_NAME} ) - set(_icon_GROUP "actions") + # if the string doesn't match the pattern, the result is the full string, so all three have the same content + if (NOT ${_group} STREQUAL ${_install_NAME} ) + set(_icon_GROUP "actions") - if (${_group} STREQUAL "mime") - set(_icon_GROUP "mimetypes") - endif () + if (${_group} STREQUAL "mime") + set(_icon_GROUP "mimetypes") + endif () - if (${_group} STREQUAL "filesys") - set(_icon_GROUP "filesystems") - endif () + if (${_group} STREQUAL "filesys") + set(_icon_GROUP "filesystems") + endif () - if (${_group} STREQUAL "device") - set(_icon_GROUP "devices") - endif () + if (${_group} STREQUAL "device") + set(_icon_GROUP "devices") + endif () - if (${_group} STREQUAL "app") - set(_icon_GROUP "apps") - endif () + if (${_group} STREQUAL "app") + set(_icon_GROUP "apps") + endif () - if (${_group} STREQUAL "action") - set(_icon_GROUP "actions") - endif () + if (${_group} STREQUAL "action") + set(_icon_GROUP "actions") + endif () -# message(STATUS "icon: ${_current_ICON} size: ${_size} group: ${_group} name: ${_name}" ) - install(FILES ${_orig_NAME} DESTINATION ${_install_PATH}/${_icon_GROUP}/ RENAME ${_install_NAME} ) - endif () + # message(STATUS "icon: ${_current_ICON} size: ${_size} group: ${_group} name: ${_name}" ) + install(FILES ${_orig_NAME} DESTINATION ${_install_PATH}/${_icon_GROUP}/ RENAME ${_install_NAME} ) + endif () endmacro () macro (KDE3_INSTALL_ICONS _theme ) - set(_defaultpath "${CMAKE_INSTALL_PREFIX}/share/icons") - # first the png icons - file(GLOB _icons *.png) - foreach (_current_ICON ${_icons} ) - string(REGEX REPLACE "^.*/[a-zA-Z]+([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" "\\1" _size "${_current_ICON}") - string(REGEX REPLACE "^.*/[a-zA-Z]+([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" "\\2" _group "${_current_ICON}") - string(REGEX REPLACE "^.*/[a-zA-Z]+([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" "\\3" _name "${_current_ICON}") - _KDE3_ADD_ICON_INSTALL_RULE(${CMAKE_CURRENT_BINARY_DIR}/install_icons.cmake - ${_defaultpath}/${_theme}/${_size}x${_size} - ${_group} ${_current_ICON} ${_name}) - endforeach () - - # and now the svg icons - file(GLOB _icons *.svgz) - foreach (_current_ICON ${_icons} ) - string(REGEX REPLACE "^.*/crsc\\-([a-z]+)\\-(.+\\.svgz)$" "\\1" _group "${_current_ICON}") - string(REGEX REPLACE "^.*/crsc\\-([a-z]+)\\-(.+\\.svgz)$" "\\2" _name "${_current_ICON}") - _KDE3_ADD_ICON_INSTALL_RULE(${CMAKE_CURRENT_BINARY_DIR}/install_icons.cmake - ${_defaultpath}/${_theme}/scalable - ${_group} ${_current_ICON} ${_name}) - endforeach () + set(_defaultpath "${CMAKE_INSTALL_PREFIX}/share/icons") + # first the png icons + file(GLOB _icons *.png) + foreach (_current_ICON ${_icons} ) + string(REGEX REPLACE "^.*/[a-zA-Z]+([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" "\\1" _size "${_current_ICON}") + string(REGEX REPLACE "^.*/[a-zA-Z]+([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" "\\2" _group "${_current_ICON}") + string(REGEX REPLACE "^.*/[a-zA-Z]+([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" "\\3" _name "${_current_ICON}") + _KDE3_ADD_ICON_INSTALL_RULE(${CMAKE_CURRENT_BINARY_DIR}/install_icons.cmake + ${_defaultpath}/${_theme}/${_size}x${_size} + ${_group} ${_current_ICON} ${_name}) + endforeach () + + # and now the svg icons + file(GLOB _icons *.svgz) + foreach (_current_ICON ${_icons} ) + string(REGEX REPLACE "^.*/crsc\\-([a-z]+)\\-(.+\\.svgz)$" "\\1" _group "${_current_ICON}") + string(REGEX REPLACE "^.*/crsc\\-([a-z]+)\\-(.+\\.svgz)$" "\\2" _name "${_current_ICON}") + _KDE3_ADD_ICON_INSTALL_RULE(${CMAKE_CURRENT_BINARY_DIR}/install_icons.cmake + ${_defaultpath}/${_theme}/scalable + ${_group} ${_current_ICON} ${_name}) + endforeach () endmacro () macro(KDE3_INSTALL_LIBTOOL_FILE _target) - get_target_property(_target_location ${_target} LOCATION) - - get_filename_component(_laname ${_target_location} NAME_WE) - get_filename_component(_soname ${_target_location} NAME) - set(_laname ${CMAKE_CURRENT_BINARY_DIR}/${_laname}.la) - - file(WRITE ${_laname} "# ${_laname} - a libtool library file, generated by cmake \n") - file(APPEND ${_laname} "# The name that we can dlopen(3).\n") - file(APPEND ${_laname} "dlname='${_soname}'\n") - file(APPEND ${_laname} "# Names of this library\n") - if(CYGWIN) - file(APPEND ${_laname} "library_names='${_soname}'\n") - else() - file(APPEND ${_laname} "library_names='${_soname} ${_soname} ${_soname}'\n") - endif() - file(APPEND ${_laname} "# The name of the static archive\n") - file(APPEND ${_laname} "old_library=''\n") - file(APPEND ${_laname} "# Libraries that this one depends upon.\n") - file(APPEND ${_laname} "dependency_libs=''\n") + get_target_property(_target_location ${_target} LOCATION) + + get_filename_component(_laname ${_target_location} NAME_WE) + get_filename_component(_soname ${_target_location} NAME) + set(_laname ${CMAKE_CURRENT_BINARY_DIR}/${_laname}.la) + + file(WRITE ${_laname} "# ${_laname} - a libtool library file, generated by cmake \n") + file(APPEND ${_laname} "# The name that we can dlopen(3).\n") + file(APPEND ${_laname} "dlname='${_soname}'\n") + file(APPEND ${_laname} "# Names of this library\n") + if(CYGWIN) + file(APPEND ${_laname} "library_names='${_soname}'\n") + else() + file(APPEND ${_laname} "library_names='${_soname} ${_soname} ${_soname}'\n") + endif() + file(APPEND ${_laname} "# The name of the static archive\n") + file(APPEND ${_laname} "old_library=''\n") + file(APPEND ${_laname} "# Libraries that this one depends upon.\n") + file(APPEND ${_laname} "dependency_libs=''\n") # file(APPEND ${_laname} "dependency_libs='${${_target}_LIB_DEPENDS}'\n") - file(APPEND ${_laname} "# Version information.\ncurrent=0\nage=0\nrevision=0\n") - file(APPEND ${_laname} "# Is this an already installed library?\ninstalled=yes\n") - file(APPEND ${_laname} "# Should we warn about portability when linking against -modules?\nshouldnotlink=yes\n") - file(APPEND ${_laname} "# Files to dlopen/dlpreopen\ndlopen=''\ndlpreopen=''\n") - file(APPEND ${_laname} "# Directory that this library needs to be installed in:\n") - file(APPEND ${_laname} "libdir='${CMAKE_INSTALL_PREFIX}/lib/kde3'\n") - - install_files(${KDE3_LIBTOOL_DIR} FILES ${_laname}) + file(APPEND ${_laname} "# Version information.\ncurrent=0\nage=0\nrevision=0\n") + file(APPEND ${_laname} "# Is this an already installed library?\ninstalled=yes\n") + file(APPEND ${_laname} "# Should we warn about portability when linking against -modules?\nshouldnotlink=yes\n") + file(APPEND ${_laname} "# Files to dlopen/dlpreopen\ndlopen=''\ndlpreopen=''\n") + file(APPEND ${_laname} "# Directory that this library needs to be installed in:\n") + file(APPEND ${_laname} "libdir='${CMAKE_INSTALL_PREFIX}/lib/kde3'\n") + + install_files(${KDE3_LIBTOOL_DIR} FILES ${_laname}) endmacro() macro(KDE3_CREATE_FINAL_FILE _filename) - file(WRITE ${_filename} "//autogenerated file\n") - foreach (_current_FILE ${ARGN}) - file(APPEND ${_filename} "#include \"${_current_FILE}\"\n") - endforeach () + file(WRITE ${_filename} "//autogenerated file\n") + foreach (_current_FILE ${ARGN}) + file(APPEND ${_filename} "#include \"${_current_FILE}\"\n") + endforeach () endmacro() @@ -346,24 +347,24 @@ option(KDE3_BUILD_TESTS "Build the tests") macro(KDE3_ADD_KPART _target_NAME _with_PREFIX) #is the first argument is "WITH_PREFIX" then keep the standard "lib" prefix, otherwise SET the prefix empty - if (${_with_PREFIX} STREQUAL "WITH_PREFIX") - set(_first_SRC) - else () - set(_first_SRC ${_with_PREFIX}) - endif () + if (${_with_PREFIX} STREQUAL "WITH_PREFIX") + set(_first_SRC) + else () + set(_first_SRC ${_with_PREFIX}) + endif () # if (KDE3_ENABLE_FINAL) # KDE3_CREATE_FINAL_FILE(${_target_NAME}_final.cpp ${_first_SRC} ${ARGN}) # add_library(${_target_NAME} MODULE ${_target_NAME}_final.cpp) # else () - add_library(${_target_NAME} MODULE ${_first_SRC} ${ARGN}) + add_library(${_target_NAME} MODULE ${_first_SRC} ${ARGN}) # endif () - if(_first_SRC) - set_target_properties(${_target_NAME} PROPERTIES PREFIX "") - endif() + if(_first_SRC) + set_target_properties(${_target_NAME} PROPERTIES PREFIX "") + endif() - KDE3_INSTALL_LIBTOOL_FILE(${_target_NAME}) + KDE3_INSTALL_LIBTOOL_FILE(${_target_NAME}) endmacro() @@ -374,13 +375,13 @@ macro(KDE3_ADD_KDEINIT_EXECUTABLE _target_NAME ) # KDE3_CREATE_FINAL_FILE(${_target_NAME}_final.cpp ${ARGN}) # add_library(kdeinit_${_target_NAME} SHARED ${_target_NAME}_final.cpp) # else () - add_library(kdeinit_${_target_NAME} SHARED ${ARGN} ) + add_library(kdeinit_${_target_NAME} SHARED ${ARGN} ) # endif () - configure_file(${KDE3_MODULE_DIR}/kde3init_dummy.cpp.in ${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_dummy.cpp) + configure_file(${KDE3_MODULE_DIR}/kde3init_dummy.cpp.in ${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_dummy.cpp) - add_executable( ${_target_NAME} ${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_dummy.cpp ) - target_link_libraries( ${_target_NAME} kdeinit_${_target_NAME} ) + add_executable( ${_target_NAME} ${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_dummy.cpp ) + target_link_libraries( ${_target_NAME} kdeinit_${_target_NAME} ) endmacro() @@ -391,7 +392,7 @@ macro(KDE3_ADD_EXECUTABLE _target_NAME ) # KDE3_CREATE_FINAL_FILE(${_target_NAME}_final.cpp ${ARGN}) # add_executable(${_target_NAME} ${_target_NAME}_final.cpp) # else () - add_executable(${_target_NAME} ${ARGN} ) + add_executable(${_target_NAME} ${ARGN} ) # endif () endmacro() diff --git a/Modules/MacroAddFileDependencies.cmake b/Modules/MacroAddFileDependencies.cmake index 39393d6..ca60b57 100644 --- a/Modules/MacroAddFileDependencies.cmake +++ b/Modules/MacroAddFileDependencies.cmake @@ -18,13 +18,13 @@ OBJECT_DEPENDS depend_files) instead. macro (MACRO_ADD_FILE_DEPENDENCIES _file) - get_source_file_property(_deps ${_file} OBJECT_DEPENDS) - if (_deps) - set(_deps ${_deps} ${ARGN}) - else () - set(_deps ${ARGN}) - endif () - - set_source_files_properties(${_file} PROPERTIES OBJECT_DEPENDS "${_deps}") + get_source_file_property(_deps ${_file} OBJECT_DEPENDS) + if (_deps) + set(_deps ${_deps} ${ARGN}) + else () + set(_deps ${ARGN}) + endif () + + set_source_files_properties(${_file} PROPERTIES OBJECT_DEPENDS "${_deps}") endmacro () diff --git a/Modules/Platform/SunOS.cmake b/Modules/Platform/SunOS.cmake index e19e89a..78eccf7 100644 --- a/Modules/Platform/SunOS.cmake +++ b/Modules/Platform/SunOS.cmake @@ -1,10 +1,10 @@ if(CMAKE_SYSTEM MATCHES "SunOS-4") - set(CMAKE_C_COMPILE_OPTIONS_PIC "-PIC") - set(CMAKE_C_COMPILE_OPTIONS_PIE "-PIE") - set(CMAKE_SHARED_LIBRARY_C_FLAGS "-PIC") - set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared -Wl,-r") - set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-R") - set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") + set(CMAKE_C_COMPILE_OPTIONS_PIC "-PIC") + set(CMAKE_C_COMPILE_OPTIONS_PIE "-PIE") + set(CMAKE_SHARED_LIBRARY_C_FLAGS "-PIC") + set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared -Wl,-r") + set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-R") + set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") endif() include(Platform/UnixPaths) diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake index ed0e7fb..776b209 100644 --- a/Modules/Platform/Windows-MSVC.cmake +++ b/Modules/Platform/Windows-MSVC.cmake @@ -17,7 +17,7 @@ set(MSVC 1) # and still cmake didn't fail in CMakeFindBinUtils.cmake (because it isn't rerun) # hardcode CMAKE_LINKER here to link, so it behaves as it did before, Alex if(NOT DEFINED CMAKE_LINKER) - set(CMAKE_LINKER link) + set(CMAKE_LINKER link) endif() if(CMAKE_VERBOSE_MAKEFILE) diff --git a/Modules/Qt4Macros.cmake b/Modules/Qt4Macros.cmake index 5c48970..33cacf1 100644 --- a/Modules/Qt4Macros.cmake +++ b/Modules/Qt4Macros.cmake @@ -140,20 +140,20 @@ endfunction () macro (QT4_GENERATE_MOC infile outfile ) -# get include dirs and flags - QT4_GET_MOC_FLAGS(moc_flags) - get_filename_component(abs_infile ${infile} ABSOLUTE) - set(_outfile "${outfile}") - if(NOT IS_ABSOLUTE "${outfile}") - set(_outfile "${CMAKE_CURRENT_BINARY_DIR}/${outfile}") - endif() - - if (${ARGC} GREATER 3 AND "x${ARGV2}" STREQUAL "xTARGET") - set(moc_target ${ARGV3}) - endif() - QT4_CREATE_MOC_COMMAND(${abs_infile} ${_outfile} "${moc_flags}" "" "${moc_target}") - set_property(SOURCE ${outfile} PROPERTY SKIP_AUTOMOC TRUE) # don't run automoc on this file - set_property(SOURCE ${outfile} PROPERTY SKIP_AUTOUIC TRUE) # don't run autouic on this file + # get include dirs and flags + QT4_GET_MOC_FLAGS(moc_flags) + get_filename_component(abs_infile ${infile} ABSOLUTE) + set(_outfile "${outfile}") + if(NOT IS_ABSOLUTE "${outfile}") + set(_outfile "${CMAKE_CURRENT_BINARY_DIR}/${outfile}") + endif() + + if (${ARGC} GREATER 3 AND "x${ARGV2}" STREQUAL "xTARGET") + set(moc_target ${ARGV3}) + endif() + QT4_CREATE_MOC_COMMAND(${abs_infile} ${_outfile} "${moc_flags}" "" "${moc_target}") + set_property(SOURCE ${outfile} PROPERTY SKIP_AUTOMOC TRUE) # don't run automoc on this file + set_property(SOURCE ${outfile} PROPERTY SKIP_AUTOUIC TRUE) # don't run autouic on this file endmacro () @@ -414,49 +414,49 @@ endmacro() macro(QT4_CREATE_TRANSLATION _qm_files) - QT4_EXTRACT_OPTIONS(_lupdate_files _lupdate_options _lupdate_target ${ARGN}) - set(_my_sources) - set(_my_dirs) - set(_my_tsfiles) - set(_ts_pro) - foreach (_file ${_lupdate_files}) - get_filename_component(_ext ${_file} EXT) - get_filename_component(_abs_FILE ${_file} ABSOLUTE) - if(_ext MATCHES "ts") - list(APPEND _my_tsfiles ${_abs_FILE}) - else() - if(NOT _ext) - list(APPEND _my_dirs ${_abs_FILE}) - else() - list(APPEND _my_sources ${_abs_FILE}) - endif() - endif() - endforeach() - foreach(_ts_file ${_my_tsfiles}) - if(_my_sources) - # make a .pro file to call lupdate on, so we don't make our commands too - # long for some systems - get_filename_component(_ts_name ${_ts_file} NAME_WE) - set(_ts_pro ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${_ts_name}_lupdate.pro) - set(_pro_srcs) - foreach(_pro_src ${_my_sources}) - string(APPEND _pro_srcs " \\\n \"${_pro_src}\"") - endforeach() - set(_pro_includes) - get_directory_property(_inc_DIRS INCLUDE_DIRECTORIES) - list(REMOVE_DUPLICATES _inc_DIRS) - foreach(_pro_include ${_inc_DIRS}) - get_filename_component(_abs_include "${_pro_include}" ABSOLUTE) - string(APPEND _pro_includes " \\\n \"${_abs_include}\"") - endforeach() - file(GENERATE OUTPUT ${_ts_pro} CONTENT "SOURCES =${_pro_srcs}\nINCLUDEPATH =${_pro_includes}\n") - endif() - add_custom_command(OUTPUT ${_ts_file} + QT4_EXTRACT_OPTIONS(_lupdate_files _lupdate_options _lupdate_target ${ARGN}) + set(_my_sources) + set(_my_dirs) + set(_my_tsfiles) + set(_ts_pro) + foreach (_file ${_lupdate_files}) + get_filename_component(_ext ${_file} EXT) + get_filename_component(_abs_FILE ${_file} ABSOLUTE) + if(_ext MATCHES "ts") + list(APPEND _my_tsfiles ${_abs_FILE}) + else() + if(NOT _ext) + list(APPEND _my_dirs ${_abs_FILE}) + else() + list(APPEND _my_sources ${_abs_FILE}) + endif() + endif() + endforeach() + foreach(_ts_file ${_my_tsfiles}) + if(_my_sources) + # make a .pro file to call lupdate on, so we don't make our commands too + # long for some systems + get_filename_component(_ts_name ${_ts_file} NAME_WE) + set(_ts_pro ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${_ts_name}_lupdate.pro) + set(_pro_srcs) + foreach(_pro_src ${_my_sources}) + string(APPEND _pro_srcs " \\\n \"${_pro_src}\"") + endforeach() + set(_pro_includes) + get_directory_property(_inc_DIRS INCLUDE_DIRECTORIES) + list(REMOVE_DUPLICATES _inc_DIRS) + foreach(_pro_include ${_inc_DIRS}) + get_filename_component(_abs_include "${_pro_include}" ABSOLUTE) + string(APPEND _pro_includes " \\\n \"${_abs_include}\"") + endforeach() + file(GENERATE OUTPUT ${_ts_pro} CONTENT "SOURCES =${_pro_srcs}\nINCLUDEPATH =${_pro_includes}\n") + endif() + add_custom_command(OUTPUT ${_ts_file} COMMAND Qt4::lupdate ARGS ${_lupdate_options} ${_ts_pro} ${_my_dirs} -ts ${_ts_file} DEPENDS ${_my_sources} ${_ts_pro} VERBATIM) - endforeach() - QT4_ADD_TRANSLATION(${_qm_files} ${_my_tsfiles}) + endforeach() + QT4_ADD_TRANSLATION(${_qm_files} ${_my_tsfiles}) endmacro() diff --git a/Modules/UseEcos.cmake b/Modules/UseEcos.cmake index 9f84847..1e82f16 100644 --- a/Modules/UseEcos.cmake +++ b/Modules/UseEcos.cmake @@ -32,38 +32,38 @@ internal use only: # first check that ecosconfig is available find_program(ECOSCONFIG_EXECUTABLE NAMES ecosconfig) if(NOT ECOSCONFIG_EXECUTABLE) - message(SEND_ERROR "ecosconfig was not found. Either include it in the system path or set it manually using ccmake.") + message(SEND_ERROR "ecosconfig was not found. Either include it in the system path or set it manually using ccmake.") else() - message(STATUS "Found ecosconfig: ${ECOSCONFIG_EXECUTABLE}") + message(STATUS "Found ecosconfig: ${ECOSCONFIG_EXECUTABLE}") endif() # check that ECOS_REPOSITORY is set correctly if (NOT EXISTS $ENV{ECOS_REPOSITORY}/ecos.db) - message(SEND_ERROR "The environment variable ECOS_REPOSITORY is not set correctly. Set it to the directory which contains the file ecos.db") + message(SEND_ERROR "The environment variable ECOS_REPOSITORY is not set correctly. Set it to the directory which contains the file ecos.db") else () - message(STATUS "ECOS_REPOSITORY is set to $ENV{ECOS_REPOSITORY}") + message(STATUS "ECOS_REPOSITORY is set to $ENV{ECOS_REPOSITORY}") endif () # check that tclsh (coming with TCL) is available, otherwise ecosconfig doesn't work find_package(Tclsh) if (NOT TCL_TCLSH) - message(SEND_ERROR "The TCL tclsh was not found. Please install TCL, it is required for building eCos applications.") + message(SEND_ERROR "The TCL tclsh was not found. Please install TCL, it is required for building eCos applications.") else () - message(STATUS "tlcsh found: ${TCL_TCLSH}") + message(STATUS "tlcsh found: ${TCL_TCLSH}") endif () #add the globale include-diretories #usage: ECOS_ADD_INCLUDE_DIRECTORIES() macro(ECOS_ADD_INCLUDE_DIRECTORIES) #check for ProjectSources.txt one level higher - if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../ProjectSources.txt) - include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../) - else () - include_directories(${CMAKE_CURRENT_SOURCE_DIR}/) - endif () + if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../ProjectSources.txt) + include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../) + else () + include_directories(${CMAKE_CURRENT_SOURCE_DIR}/) + endif () #the ecos include directory - include_directories(${CMAKE_CURRENT_BINARY_DIR}/ecos/install/include/) + include_directories(${CMAKE_CURRENT_BINARY_DIR}/ecos/install/include/) endmacro() @@ -71,47 +71,47 @@ endmacro() #we want to compile for the xscale processor, in this case the following macro has to be called #usage: ECOS_USE_ARM_ELF_TOOLS() macro (ECOS_USE_ARM_ELF_TOOLS) - set(CMAKE_CXX_COMPILER "arm-elf-c++") - set(CMAKE_COMPILER_IS_GNUCXX 1) - set(CMAKE_C_COMPILER "arm-elf-gcc") - set(CMAKE_AR "arm-elf-ar") - set(CMAKE_RANLIB "arm-elf-ranlib") + set(CMAKE_CXX_COMPILER "arm-elf-c++") + set(CMAKE_COMPILER_IS_GNUCXX 1) + set(CMAKE_C_COMPILER "arm-elf-gcc") + set(CMAKE_AR "arm-elf-ar") + set(CMAKE_RANLIB "arm-elf-ranlib") #for linking - set(ECOS_LD_MCPU "-mcpu=xscale") + set(ECOS_LD_MCPU "-mcpu=xscale") #for compiling - add_definitions(-mcpu=xscale -mapcs-frame) + add_definitions(-mcpu=xscale -mapcs-frame) #for the obj-tools - set(ECOS_ARCH_PREFIX "arm-elf-") + set(ECOS_ARCH_PREFIX "arm-elf-") endmacro () #usage: ECOS_USE_PPC_EABI_TOOLS() macro (ECOS_USE_PPC_EABI_TOOLS) - set(CMAKE_CXX_COMPILER "powerpc-eabi-c++") - set(CMAKE_COMPILER_IS_GNUCXX 1) - set(CMAKE_C_COMPILER "powerpc-eabi-gcc") - set(CMAKE_AR "powerpc-eabi-ar") - set(CMAKE_RANLIB "powerpc-eabi-ranlib") + set(CMAKE_CXX_COMPILER "powerpc-eabi-c++") + set(CMAKE_COMPILER_IS_GNUCXX 1) + set(CMAKE_C_COMPILER "powerpc-eabi-gcc") + set(CMAKE_AR "powerpc-eabi-ar") + set(CMAKE_RANLIB "powerpc-eabi-ranlib") #for linking - set(ECOS_LD_MCPU "") + set(ECOS_LD_MCPU "") #for compiling - add_definitions() + add_definitions() #for the obj-tools - set(ECOS_ARCH_PREFIX "powerpc-eabi-") + set(ECOS_ARCH_PREFIX "powerpc-eabi-") endmacro () #usage: ECOS_USE_I386_ELF_TOOLS() macro (ECOS_USE_I386_ELF_TOOLS) - set(CMAKE_CXX_COMPILER "i386-elf-c++") - set(CMAKE_COMPILER_IS_GNUCXX 1) - set(CMAKE_C_COMPILER "i386-elf-gcc") - set(CMAKE_AR "i386-elf-ar") - set(CMAKE_RANLIB "i386-elf-ranlib") + set(CMAKE_CXX_COMPILER "i386-elf-c++") + set(CMAKE_COMPILER_IS_GNUCXX 1) + set(CMAKE_C_COMPILER "i386-elf-gcc") + set(CMAKE_AR "i386-elf-ar") + set(CMAKE_RANLIB "i386-elf-ranlib") #for linking - set(ECOS_LD_MCPU "") + set(ECOS_LD_MCPU "") #for compiling - add_definitions() + add_definitions() #for the obj-tools - set(ECOS_ARCH_PREFIX "i386-elf-") + set(ECOS_ARCH_PREFIX "i386-elf-") endmacro () @@ -122,13 +122,13 @@ endmacro () #followed by all source files #usage: ECOS_ADJUST_DIRECTORY(adjusted_SRCS ${my_srcs}) macro(ECOS_ADJUST_DIRECTORY _target_FILES ) - foreach (_current_FILE ${ARGN}) - get_filename_component(_abs_FILE ${_current_FILE} ABSOLUTE) + foreach (_current_FILE ${ARGN}) + get_filename_component(_abs_FILE ${_current_FILE} ABSOLUTE) if (NOT ${_abs_FILE} STREQUAL ${_current_FILE}) - get_filename_component(_abs_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../${_current_FILE} ABSOLUTE) + get_filename_component(_abs_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../${_current_FILE} ABSOLUTE) endif () - list(APPEND ${_target_FILES} ${_abs_FILE}) - endforeach () + list(APPEND ${_target_FILES} ${_abs_FILE}) + endforeach () endmacro() # the default ecos config file name @@ -139,29 +139,29 @@ set(ECOS_CONFIG_FILE ecos.ecc) #adds the command for compiling ecos macro(ECOS_ADD_TARGET_LIB) # when building out-of-source, create the ecos/ subdir - if(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/ecos) - file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/ecos) - endif() + if(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/ecos) + file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/ecos) + endif() #sources depend on target.ld - set_source_files_properties( - ${ARGN} - PROPERTIES - OBJECT_DEPENDS - ${CMAKE_CURRENT_BINARY_DIR}/ecos/install/lib/target.ld - ) - - add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/ecos/install/lib/target.ld - COMMAND sh -c \"make -C ${CMAKE_CURRENT_BINARY_DIR}/ecos || exit -1\; if [ -e ${CMAKE_CURRENT_BINARY_DIR}/ecos/install/lib/target.ld ] \; then touch ${CMAKE_CURRENT_BINARY_DIR}/ecos/install/lib/target.ld\; fi\" - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/ecos/makefile - ) - - add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/ecos/makefile - COMMAND sh -c \" cd ${CMAKE_CURRENT_BINARY_DIR}/ecos\; ${ECOSCONFIG_EXECUTABLE} --config=${CMAKE_CURRENT_SOURCE_DIR}/ecos/${ECOS_CONFIG_FILE} tree || exit -1\;\" - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/ecos/${ECOS_CONFIG_FILE} - ) - - add_custom_target( ecos make -C ${CMAKE_CURRENT_BINARY_DIR}/ecos/ DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/ecos/makefile ) + set_source_files_properties( + ${ARGN} + PROPERTIES + OBJECT_DEPENDS + ${CMAKE_CURRENT_BINARY_DIR}/ecos/install/lib/target.ld + ) + + add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/ecos/install/lib/target.ld + COMMAND sh -c \"make -C ${CMAKE_CURRENT_BINARY_DIR}/ecos || exit -1\; if [ -e ${CMAKE_CURRENT_BINARY_DIR}/ecos/install/lib/target.ld ] \; then touch ${CMAKE_CURRENT_BINARY_DIR}/ecos/install/lib/target.ld\; fi\" + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/ecos/makefile + ) + + add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/ecos/makefile + COMMAND sh -c \" cd ${CMAKE_CURRENT_BINARY_DIR}/ecos\; ${ECOSCONFIG_EXECUTABLE} --config=${CMAKE_CURRENT_SOURCE_DIR}/ecos/${ECOS_CONFIG_FILE} tree || exit -1\;\" + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/ecos/${ECOS_CONFIG_FILE} + ) + + add_custom_target( ecos make -C ${CMAKE_CURRENT_BINARY_DIR}/ecos/ DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/ecos/makefile ) endmacro() # get the directory of the current file, used later on in the file @@ -173,64 +173,64 @@ get_filename_component( ECOS_CMAKE_MODULE_DIR ${CMAKE_CURRENT_LIST_FILE} PATH) #has been adjusted beforehand by calling ECOS_ADJUST_DIRECTORY() #usage: ECOS_ADD_EXECUTABLE(my_app ${adjusted_SRCS}) macro(ECOS_ADD_EXECUTABLE _exe_NAME ) - #definitions, valid for all ecos projects - #the optimization and "-g" for debugging has to be enabled - #in the project-specific CMakeLists.txt - add_definitions(-D__ECOS__=1 -D__ECOS=1) - set(ECOS_DEFINITIONS -Wall -Wno-long-long -pipe -fno-builtin) + #definitions, valid for all ecos projects + #the optimization and "-g" for debugging has to be enabled + #in the project-specific CMakeLists.txt + add_definitions(-D__ECOS__=1 -D__ECOS=1) + set(ECOS_DEFINITIONS -Wall -Wno-long-long -pipe -fno-builtin) #the executable depends on ecos target.ld - ECOS_ADD_TARGET_LIB(${ARGN}) + ECOS_ADD_TARGET_LIB(${ARGN}) # when using nmake makefiles, the custom buildtype suppresses the default cl.exe flags # and the rules for creating objects are adjusted for gcc - set(CMAKE_BUILD_TYPE CUSTOM_ECOS_BUILD) - set(CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>") - set(CMAKE_CXX_COMPILE_OBJECT "<CMAKE_CXX_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>") + set(CMAKE_BUILD_TYPE CUSTOM_ECOS_BUILD) + set(CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>") + set(CMAKE_CXX_COMPILE_OBJECT "<CMAKE_CXX_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>") # special link commands for ecos-executables - set(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_CXX_COMPILER> <CMAKE_CXX_LINK_FLAGS> <OBJECTS> -o <TARGET> ${_ecos_EXTRA_LIBS} -nostdlib -nostartfiles -L${CMAKE_CURRENT_BINARY_DIR}/ecos/install/lib -Ttarget.ld ${ECOS_LD_MCPU}") - set(CMAKE_C_LINK_EXECUTABLE "<CMAKE_C_COMPILER> <CMAKE_C_LINK_FLAGS> <OBJECTS> -o <TARGET> ${_ecos_EXTRA_LIBS} -nostdlib -nostartfiles -L${CMAKE_CURRENT_BINARY_DIR}/ecos/install/lib -Ttarget.ld ${ECOS_LD_MCPU}") + set(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_CXX_COMPILER> <CMAKE_CXX_LINK_FLAGS> <OBJECTS> -o <TARGET> ${_ecos_EXTRA_LIBS} -nostdlib -nostartfiles -L${CMAKE_CURRENT_BINARY_DIR}/ecos/install/lib -Ttarget.ld ${ECOS_LD_MCPU}") + set(CMAKE_C_LINK_EXECUTABLE "<CMAKE_C_COMPILER> <CMAKE_C_LINK_FLAGS> <OBJECTS> -o <TARGET> ${_ecos_EXTRA_LIBS} -nostdlib -nostartfiles -L${CMAKE_CURRENT_BINARY_DIR}/ecos/install/lib -Ttarget.ld ${ECOS_LD_MCPU}") # some strict compiler flags - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wstrict-prototypes") - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Woverloaded-virtual -fno-rtti -Wctor-dtor-privacy -fno-strict-aliasing -fno-exceptions") + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wstrict-prototypes") + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Woverloaded-virtual -fno-rtti -Wctor-dtor-privacy -fno-strict-aliasing -fno-exceptions") - add_executable(${_exe_NAME} ${ARGN}) - set_target_properties(${_exe_NAME} PROPERTIES SUFFIX ".elf") + add_executable(${_exe_NAME} ${ARGN}) + set_target_properties(${_exe_NAME} PROPERTIES SUFFIX ".elf") #create a binary file - add_custom_command( - TARGET ${_exe_NAME} - POST_BUILD - COMMAND ${ECOS_ARCH_PREFIX}objcopy - ARGS -O binary ${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.elf ${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.bin - ) + add_custom_command( + TARGET ${_exe_NAME} + POST_BUILD + COMMAND ${ECOS_ARCH_PREFIX}objcopy + ARGS -O binary ${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.elf ${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.bin + ) #and an srec file - add_custom_command( - TARGET ${_exe_NAME} - POST_BUILD - COMMAND ${ECOS_ARCH_PREFIX}objcopy - ARGS -O srec ${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.elf ${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.srec - ) + add_custom_command( + TARGET ${_exe_NAME} + POST_BUILD + COMMAND ${ECOS_ARCH_PREFIX}objcopy + ARGS -O srec ${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.elf ${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.srec + ) #add the created files to the clean-files - set_directory_properties( - PROPERTIES - ADDITIONAL_MAKE_CLEAN_FILES "${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.bin;${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.srec;${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.lst;" - ) - - add_custom_target(ecosclean ${CMAKE_COMMAND} -DECOS_DIR=${CMAKE_CURRENT_BINARY_DIR}/ecos/ -P ${ECOS_CMAKE_MODULE_DIR}/ecos_clean.cmake ) - add_custom_target(normalclean ${CMAKE_MAKE_PROGRAM} clean WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - add_dependencies (ecosclean normalclean) - - - add_custom_target( listing - COMMAND echo -e \"\\n--- Symbols sorted by address ---\\n\" > ${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.lst - COMMAND ${ECOS_ARCH_PREFIX}nm -S -C -n ${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.elf >> ${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.lst - COMMAND echo -e \"\\n--- Symbols sorted by size ---\\n\" >> ${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.lst - COMMAND ${ECOS_ARCH_PREFIX}nm -S -C -r --size-sort ${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.elf >> ${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.lst - COMMAND echo -e \"\\n--- Full assembly listing ---\\n\" >> ${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.lst - COMMAND ${ECOS_ARCH_PREFIX}objdump -S -x -d -C ${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.elf >> ${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.lst ) + set_directory_properties( + PROPERTIES + ADDITIONAL_MAKE_CLEAN_FILES "${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.bin;${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.srec;${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.lst;" + ) + + add_custom_target(ecosclean ${CMAKE_COMMAND} -DECOS_DIR=${CMAKE_CURRENT_BINARY_DIR}/ecos/ -P ${ECOS_CMAKE_MODULE_DIR}/ecos_clean.cmake ) + add_custom_target(normalclean ${CMAKE_MAKE_PROGRAM} clean WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + add_dependencies (ecosclean normalclean) + + + add_custom_target( listing + COMMAND echo -e \"\\n--- Symbols sorted by address ---\\n\" > ${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.lst + COMMAND ${ECOS_ARCH_PREFIX}nm -S -C -n ${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.elf >> ${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.lst + COMMAND echo -e \"\\n--- Symbols sorted by size ---\\n\" >> ${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.lst + COMMAND ${ECOS_ARCH_PREFIX}nm -S -C -r --size-sort ${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.elf >> ${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.lst + COMMAND echo -e \"\\n--- Full assembly listing ---\\n\" >> ${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.lst + COMMAND ${ECOS_ARCH_PREFIX}objdump -S -x -d -C ${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.elf >> ${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.lst ) endmacro() diff --git a/Modules/ecos_clean.cmake b/Modules/ecos_clean.cmake index 21126f6..480b1ce 100644 --- a/Modules/ecos_clean.cmake +++ b/Modules/ecos_clean.cmake @@ -7,10 +7,10 @@ file(GLOB _files ${ECOS_DIR}/*) # remove all directories, which consist of lower-case letters only # this skips e.g. CVS/ and .subversion/ foreach(_entry ${_files}) - if(IS_DIRECTORY ${_entry}) - get_filename_component(dir ${_entry} NAME) - if(${dir} MATCHES "^[a-z]+$") - file(REMOVE_RECURSE ${_entry}) - endif() - endif() + if(IS_DIRECTORY ${_entry}) + get_filename_component(dir ${_entry} NAME) + if(${dir} MATCHES "^[a-z]+$") + file(REMOVE_RECURSE ${_entry}) + endif() + endif() endforeach() |