diff options
Diffstat (limited to 'Modules')
298 files changed, 2876 insertions, 1210 deletions
diff --git a/Modules/AddFileDependencies.cmake b/Modules/AddFileDependencies.cmake index ae2e803..f971e37 100644 --- a/Modules/AddFileDependencies.cmake +++ b/Modules/AddFileDependencies.cmake @@ -12,7 +12,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) MACRO(ADD_FILE_DEPENDENCIES _file) diff --git a/Modules/BundleUtilities.cmake b/Modules/BundleUtilities.cmake index 136171f..2e23ab6 100644 --- a/Modules/BundleUtilities.cmake +++ b/Modules/BundleUtilities.cmake @@ -14,6 +14,7 @@ # set_bundle_key_values # get_bundle_keys # copy_resolved_item_into_bundle +# copy_resolved_framework_into_bundle # fixup_bundle_item # verify_bundle_prerequisites # verify_bundle_symlinks @@ -95,6 +96,16 @@ # Copy a resolved item into the bundle if necessary. Copy is not necessary if # the resolved_item is "the same as" the resolved_embedded_item. # +# COPY_RESOLVED_FRAMEWORK_INTO_BUNDLE(<resolved_item> <resolved_embedded_item>) +# Copy a resolved framework into the bundle if necessary. Copy is not necessary +# if the resolved_item is "the same as" the resolved_embedded_item. +# +# By default, BU_COPY_FULL_FRAMEWORK_CONTENTS is not set. If you want full +# frameworks embedded in your bundles, set BU_COPY_FULL_FRAMEWORK_CONTENTS to +# ON before calling fixup_bundle. By default, +# COPY_RESOLVED_FRAMEWORK_INTO_BUNDLE copies the framework dylib itself plus +# the framework Resources directory. +# # FIXUP_BUNDLE_ITEM(<resolved_embedded_item> <exepath> <dirs>) # Get the direct/non-system prerequisites of the resolved embedded item. For # each prerequisite, change the way it is referenced to the value of the @@ -128,7 +139,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # The functions defined in this file depend on the get_prerequisites function @@ -467,6 +478,48 @@ function(copy_resolved_item_into_bundle resolved_item resolved_embedded_item) endfunction(copy_resolved_item_into_bundle) +function(copy_resolved_framework_into_bundle resolved_item resolved_embedded_item) + if(WIN32) + # ignore case on Windows + string(TOLOWER "${resolved_item}" resolved_item_compare) + string(TOLOWER "${resolved_embedded_item}" resolved_embedded_item_compare) + else() + set(resolved_item_compare "${resolved_item}") + set(resolved_embedded_item_compare "${resolved_embedded_item}") + endif() + + if("${resolved_item_compare}" STREQUAL "${resolved_embedded_item_compare}") + message(STATUS "warning: resolved_item == resolved_embedded_item - not copying...") + else() + if(BU_COPY_FULL_FRAMEWORK_CONTENTS) + # Full Framework (everything): + get_filename_component(resolved_dir "${resolved_item}" PATH) + get_filename_component(resolved_dir "${resolved_dir}/../.." ABSOLUTE) + get_filename_component(resolved_embedded_dir "${resolved_embedded_item}" PATH) + get_filename_component(resolved_embedded_dir "${resolved_embedded_dir}/../.." ABSOLUTE) + #message(STATUS "copying COMMAND ${CMAKE_COMMAND} -E copy_directory '${resolved_dir}' '${resolved_embedded_dir}'") + execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory "${resolved_dir}" "${resolved_embedded_dir}") + else() + # Framework lib itself: + #message(STATUS "copying COMMAND ${CMAKE_COMMAND} -E copy ${resolved_item} ${resolved_embedded_item}") + execute_process(COMMAND ${CMAKE_COMMAND} -E copy "${resolved_item}" "${resolved_embedded_item}") + + # Plus Resources, if they exist: + string(REGEX REPLACE "^(.*)/[^/]+/[^/]+/[^/]+$" "\\1/Resources" resolved_resources "${resolved_item}") + string(REGEX REPLACE "^(.*)/[^/]+/[^/]+/[^/]+$" "\\1/Resources" resolved_embedded_resources "${resolved_embedded_item}") + if(EXISTS "${resolved_resources}") + #message(STATUS "copying COMMAND ${CMAKE_COMMAND} -E copy_directory '${resolved_resources}' '${resolved_embedded_resources}'") + execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory "${resolved_resources}" "${resolved_embedded_resources}") + endif() + endif() + endif() + + if(UNIX AND NOT APPLE) + file(RPATH_REMOVE FILE "${resolved_embedded_item}") + endif(UNIX AND NOT APPLE) +endfunction(copy_resolved_framework_into_bundle) + + function(fixup_bundle_item resolved_embedded_item exepath dirs) # This item's key is "ikey": # @@ -537,8 +590,14 @@ function(fixup_bundle app libs dirs) endif(show_status) if(${${key}_COPYFLAG}) - copy_resolved_item_into_bundle("${${key}_RESOLVED_ITEM}" - "${${key}_RESOLVED_EMBEDDED_ITEM}") + set(item "${${key}_ITEM}") + if(item MATCHES "[^/]+\\.framework/") + copy_resolved_framework_into_bundle("${${key}_RESOLVED_ITEM}" + "${${key}_RESOLVED_EMBEDDED_ITEM}") + else() + copy_resolved_item_into_bundle("${${key}_RESOLVED_ITEM}" + "${${key}_RESOLVED_EMBEDDED_ITEM}") + endif() endif(${${key}_COPYFLAG}) endforeach(key) diff --git a/Modules/CMake.cmake b/Modules/CMake.cmake index cbdaa35..53a0ddf 100644 --- a/Modules/CMake.cmake +++ b/Modules/CMake.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # This file is used by cmake.cxx to compute the CMAKE_ROOT location. diff --git a/Modules/CMakeASM-ATTInformation.cmake b/Modules/CMakeASM-ATTInformation.cmake index 51c445b..abf560b 100644 --- a/Modules/CMakeASM-ATTInformation.cmake +++ b/Modules/CMakeASM-ATTInformation.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # support for AT&T syntax assemblers, e.g. GNU as diff --git a/Modules/CMakeASMInformation.cmake b/Modules/CMakeASMInformation.cmake index 0fad25d..b94303e 100644 --- a/Modules/CMakeASMInformation.cmake +++ b/Modules/CMakeASMInformation.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) MESSAGE(STATUS "Loaded CMakeASM${ASM_DIALECT}Information - ASM${ASM_DIALECT} support is still experimental, please report issues") @@ -28,18 +28,25 @@ IF("${CMAKE_BASE_NAME}" STREQUAL "as") SET(CMAKE_BASE_NAME gas) ENDIF("${CMAKE_BASE_NAME}" STREQUAL "as") -INCLUDE(Platform/${CMAKE_BASE_NAME} OPTIONAL) +# Load compiler-specific information. +SET(_INCLUDED_FILE "") +IF(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID) + INCLUDE(Compiler/${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}-ASM${ASM_DIALECT} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE) +ENDIF(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID) +IF(NOT _INCLUDED_FILE) + INCLUDE(Platform/${CMAKE_BASE_NAME} OPTIONAL) +ENDIF(NOT _INCLUDED_FILE) IF(CMAKE_SYSTEM_PROCESSOR) - INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE) + INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}-ASM${ASM_DIALECT}-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE) + IF(NOT _INCLUDED_FILE) + INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL) + ENDIF(NOT _INCLUDED_FILE) ENDIF(CMAKE_SYSTEM_PROCESSOR) -IF(NOT _INCLUDED_FILE) - INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_C_COMPILER_ID}-ASM-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL) -ENDIF(NOT _INCLUDED_FILE) -INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE) +INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}-ASM${ASM_DIALECT} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE) IF(NOT _INCLUDED_FILE) - INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_C_COMPILER_ID}-ASM OPTIONAL) + INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL) ENDIF(NOT _INCLUDED_FILE) # Set default assembler file extensions: diff --git a/Modules/CMakeASM_MASMInformation.cmake b/Modules/CMakeASM_MASMInformation.cmake index 2f27d2a..4e1386f 100644 --- a/Modules/CMakeASM_MASMInformation.cmake +++ b/Modules/CMakeASM_MASMInformation.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # support for the MS assembler, masm and masm64 diff --git a/Modules/CMakeBackwardCompatibilityC.cmake b/Modules/CMakeBackwardCompatibilityC.cmake index c6537cf..00e5688 100644 --- a/Modules/CMakeBackwardCompatibilityC.cmake +++ b/Modules/CMakeBackwardCompatibilityC.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # Nothing here yet diff --git a/Modules/CMakeBackwardCompatibilityCXX.cmake b/Modules/CMakeBackwardCompatibilityCXX.cmake index a4175e8..707bbde 100644 --- a/Modules/CMakeBackwardCompatibilityCXX.cmake +++ b/Modules/CMakeBackwardCompatibilityCXX.cmake @@ -16,7 +16,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) IF(NOT CMAKE_SKIP_COMPATIBILITY_TESTS) diff --git a/Modules/CMakeBorlandFindMake.cmake b/Modules/CMakeBorlandFindMake.cmake index d908168..1ef28df 100644 --- a/Modules/CMakeBorlandFindMake.cmake +++ b/Modules/CMakeBorlandFindMake.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) SET (CMAKE_MAKE_PROGRAM "make" CACHE STRING diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in index 5d004c7..accda32 100644 --- a/Modules/CMakeCCompilerId.c.in +++ b/Modules/CMakeCCompilerId.c.in @@ -9,6 +9,9 @@ #if defined(__INTEL_COMPILER) || defined(__ICC) # define COMPILER_ID "Intel" +#elif defined(__clang__) +# define COMPILER_ID "Clang" + #elif defined(__BORLANDC__) # define COMPILER_ID "Borland" diff --git a/Modules/CMakeCInformation.cmake b/Modules/CMakeCInformation.cmake index fb4f0e8..578aff9 100644 --- a/Modules/CMakeCInformation.cmake +++ b/Modules/CMakeCInformation.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # This file sets the basic flags for the C language in CMake. diff --git a/Modules/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in index 00ab8e2..4a32823 100644 --- a/Modules/CMakeCXXCompilerId.cpp.in +++ b/Modules/CMakeCXXCompilerId.cpp.in @@ -11,6 +11,9 @@ #elif defined(__INTEL_COMPILER) || defined(__ICC) # define COMPILER_ID "Intel" +#elif defined(__clang__) +# define COMPILER_ID "Clang" + #elif defined(__BORLANDC__) # define COMPILER_ID "Borland" diff --git a/Modules/CMakeCXXInformation.cmake b/Modules/CMakeCXXInformation.cmake index 0a7e990..869894c 100644 --- a/Modules/CMakeCXXInformation.cmake +++ b/Modules/CMakeCXXInformation.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # This file sets the basic flags for the C++ language in CMake. diff --git a/Modules/CMakeCommonLanguageInclude.cmake b/Modules/CMakeCommonLanguageInclude.cmake index 80d5678..237f8dd 100644 --- a/Modules/CMakeCommonLanguageInclude.cmake +++ b/Modules/CMakeCommonLanguageInclude.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # this file has flags that are shared across languages and sets diff --git a/Modules/CMakeDependentOption.cmake b/Modules/CMakeDependentOption.cmake index 4d978c4..8b8dc07 100644 --- a/Modules/CMakeDependentOption.cmake +++ b/Modules/CMakeDependentOption.cmake @@ -22,7 +22,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) MACRO(CMAKE_DEPENDENT_OPTION option doc default depends force) diff --git a/Modules/CMakeDetermineASM-ATTCompiler.cmake b/Modules/CMakeDetermineASM-ATTCompiler.cmake index 99c591b..9dd2f11 100644 --- a/Modules/CMakeDetermineASM-ATTCompiler.cmake +++ b/Modules/CMakeDetermineASM-ATTCompiler.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # determine the compiler to use for ASM using AT&T syntax, e.g. GNU as diff --git a/Modules/CMakeDetermineASMCompiler.cmake b/Modules/CMakeDetermineASMCompiler.cmake index adf1408..06dd6b8 100644 --- a/Modules/CMakeDetermineASMCompiler.cmake +++ b/Modules/CMakeDetermineASMCompiler.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # determine the compiler to use for ASM programs @@ -38,9 +38,9 @@ ELSE(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER) # we only get here if CMAKE_ASM${ASM_DIALECT}_COMPILER was specified using -D or a pre-made CMakeCache.txt # (e.g. via ctest) or set in CMAKE_TOOLCHAIN_FILE # - # if a compiler was specified by the user but without path, + # if a compiler was specified by the user but without path, # now try to find it with the full path - # if it is found, force it into the cache, + # if it is found, force it into the cache, # if not, don't overwrite the setting (which was given by the user) with "NOTFOUND" GET_FILENAME_COMPONENT(_CMAKE_USER_ASM${ASM_DIALECT}_COMPILER_PATH "${CMAKE_ASM${ASM_DIALECT}_COMPILER}" PATH) IF(NOT _CMAKE_USER_ASM${ASM_DIALECT}_COMPILER_PATH) @@ -57,11 +57,30 @@ IF (NOT _CMAKE_TOOLCHAIN_LOCATION) GET_FILENAME_COMPONENT(_CMAKE_TOOLCHAIN_LOCATION "${CMAKE_ASM${ASM_DIALECT}_COMPILER}" PATH) ENDIF (NOT _CMAKE_TOOLCHAIN_LOCATION) -# If we have a gas/as cross compiler, they have usually some prefix, like + +IF(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER_ID) + + # Table of per-vendor compiler id flags with expected output. + LIST(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS GNU ) + SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_GNU "--version") + SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_GNU "GNU assembler") + + CMAKE_DETERMINE_COMPILER_ID_VENDOR(ASM${ASM_DIALECT}) + + IF(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID) + MESSAGE(STATUS "The ASM${ASM_DIALECT} compiler identification is ${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}") + ELSE(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID) + MESSAGE(STATUS "The ASM${ASM_DIALECT} compiler identification is unknown") + ENDIF(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID) + +ENDIF() + + +# If we have a gas/as cross compiler, they have usually some prefix, like # e.g. powerpc-linux-gas, arm-elf-gas or i586-mingw32msvc-gas . # The other tools of the toolchain usually have the same prefix # NAME_WE cannot be used since then this test will fail for names lile -# "arm-unknown-nto-qnx6.3.0-gas.exe", where BASENAME would be +# "arm-unknown-nto-qnx6.3.0-gas.exe", where BASENAME would be # "arm-unknown-nto-qnx6" instead of the correct "arm-unknown-nto-qnx6.3.0-" IF (NOT _CMAKE_TOOLCHAIN_PREFIX) GET_FILENAME_COMPONENT(COMPILER_BASENAME "${CMAKE_ASM${ASM_DIALECT}_COMPILER}" NAME) @@ -86,7 +105,7 @@ SET(_CMAKE_ASM_COMPILER_ARG1 "${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARG1}") SET(_CMAKE_ASM_COMPILER_ENV_VAR "${CMAKE_ASM${ASM_DIALECT}_COMPILER_ENV_VAR}") # configure variables set in this file for fast reload later on -CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeASMCompiler.cmake.in +CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeASMCompiler.cmake.in ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeASM${ASM_DIALECT}Compiler.cmake IMMEDIATE @ONLY) SET(_CMAKE_ASM_COMPILER) diff --git a/Modules/CMakeDetermineASM_MASMCompiler.cmake b/Modules/CMakeDetermineASM_MASMCompiler.cmake index 8223ea0..e23f7db 100644 --- a/Modules/CMakeDetermineASM_MASMCompiler.cmake +++ b/Modules/CMakeDetermineASM_MASMCompiler.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # Find the MS assembler (masm or masm64) diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake index 17fa05f..639b426 100644 --- a/Modules/CMakeDetermineCCompiler.cmake +++ b/Modules/CMakeDetermineCCompiler.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # determine the compiler to use for C programs diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake index 1170106..555d20e 100644 --- a/Modules/CMakeDetermineCXXCompiler.cmake +++ b/Modules/CMakeDetermineCXXCompiler.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # determine the compiler to use for C++ programs diff --git a/Modules/CMakeDetermineCompilerABI.cmake b/Modules/CMakeDetermineCompilerABI.cmake index aa4733b..d6df305 100644 --- a/Modules/CMakeDetermineCompilerABI.cmake +++ b/Modules/CMakeDetermineCompilerABI.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # Function to compile a source file to identify the compiler ABI. diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 4a800a8..bf78a5b 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # Function to compile a source file to identify the compiler. This is @@ -63,7 +63,7 @@ FUNCTION(CMAKE_DETERMINE_COMPILER_ID lang flagvar src) SET(CMAKE_${lang}_COMPILER_ID "${CMAKE_${lang}_COMPILER_ID}" PARENT_SCOPE) SET(CMAKE_${lang}_PLATFORM_ID "${CMAKE_${lang}_PLATFORM_ID}" PARENT_SCOPE) - SET(MSVC_${lang}_ARCHITECTURE_ID "${MSVC_${lang}_ARCHITECTURE_ID}" + SET(MSVC_${lang}_ARCHITECTURE_ID "${MSVC_${lang}_ARCHITECTURE_ID}" PARENT_SCOPE) ENDFUNCTION(CMAKE_DETERMINE_COMPILER_ID) @@ -247,7 +247,7 @@ FUNCTION(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file) # Return the information extracted. SET(CMAKE_${lang}_COMPILER_ID "${CMAKE_${lang}_COMPILER_ID}" PARENT_SCOPE) SET(CMAKE_${lang}_PLATFORM_ID "${CMAKE_${lang}_PLATFORM_ID}" PARENT_SCOPE) - SET(MSVC_${lang}_ARCHITECTURE_ID "${MSVC_${lang}_ARCHITECTURE_ID}" + SET(MSVC_${lang}_ARCHITECTURE_ID "${MSVC_${lang}_ARCHITECTURE_ID}" PARENT_SCOPE) SET(CMAKE_EXECUTABLE_FORMAT "${CMAKE_EXECUTABLE_FORMAT}" PARENT_SCOPE) ENDFUNCTION(CMAKE_DETERMINE_COMPILER_ID_CHECK lang) @@ -261,6 +261,17 @@ ENDFUNCTION(CMAKE_DETERMINE_COMPILER_ID_CHECK lang) # We try running the compiler with the flag for each vendor and # matching its regular expression in the output. FUNCTION(CMAKE_DETERMINE_COMPILER_ID_VENDOR lang) + + IF(NOT CMAKE_${lang}_COMPILER_ID_DIR) + # We get here when this function is called not from within CMAKE_DETERMINE_COMPILER_ID() + # This is done e.g. for detecting the compiler ID for assemblers. + # Compute the directory in which to run the test and Create a clean working directory. + SET(CMAKE_${lang}_COMPILER_ID_DIR ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CompilerId${lang}) + FILE(REMOVE_RECURSE ${CMAKE_${lang}_COMPILER_ID_DIR}) + FILE(MAKE_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR}) + ENDIF(NOT CMAKE_${lang}_COMPILER_ID_DIR) + + FOREACH(vendor ${CMAKE_${lang}_COMPILER_ID_VENDORS}) SET(flags ${CMAKE_${lang}_COMPILER_ID_VENDOR_FLAGS_${vendor}}) SET(regex ${CMAKE_${lang}_COMPILER_ID_VENDOR_REGEX_${vendor}}) @@ -272,6 +283,7 @@ FUNCTION(CMAKE_DETERMINE_COMPILER_ID_VENDOR lang) WORKING_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR} OUTPUT_VARIABLE output ERROR_VARIABLE output RESULT_VARIABLE result + TIMEOUT 10 ) IF("${output}" MATCHES "${regex}") FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log @@ -280,9 +292,15 @@ FUNCTION(CMAKE_DETERMINE_COMPILER_ID_VENDOR lang) SET(CMAKE_${lang}_COMPILER_ID "${vendor}" PARENT_SCOPE) BREAK() ELSE() - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log - "Checking whether the ${lang} compiler is ${vendor} using \"${flags}\" " - "did not match \"${regex}\":\n${output}") + IF("${result}" MATCHES "timeout") + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Checking whether the ${lang} compiler is ${vendor} using \"${flags}\" " + "terminated after 10 s due to timeout.") + ELSE() + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Checking whether the ${lang} compiler is ${vendor} using \"${flags}\" " + "did not match \"${regex}\":\n${output}") + ENDIF() ENDIF() ENDFOREACH() ENDFUNCTION(CMAKE_DETERMINE_COMPILER_ID_VENDOR) diff --git a/Modules/CMakeDetermineFortranCompiler.cmake b/Modules/CMakeDetermineFortranCompiler.cmake index 34477a1..03ddd78 100644 --- a/Modules/CMakeDetermineFortranCompiler.cmake +++ b/Modules/CMakeDetermineFortranCompiler.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # determine the compiler to use for Fortran programs diff --git a/Modules/CMakeDetermineJavaCompiler.cmake b/Modules/CMakeDetermineJavaCompiler.cmake index 483db6b..aefcaba 100644 --- a/Modules/CMakeDetermineJavaCompiler.cmake +++ b/Modules/CMakeDetermineJavaCompiler.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # determine the compiler to use for Java programs diff --git a/Modules/CMakeDetermineRCCompiler.cmake b/Modules/CMakeDetermineRCCompiler.cmake index e1b6df2..094b893 100644 --- a/Modules/CMakeDetermineRCCompiler.cmake +++ b/Modules/CMakeDetermineRCCompiler.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # determine the compiler to use for C programs diff --git a/Modules/CMakeDetermineSystem.cmake b/Modules/CMakeDetermineSystem.cmake index 623caf9..5589dfc 100644 --- a/Modules/CMakeDetermineSystem.cmake +++ b/Modules/CMakeDetermineSystem.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # This module is used by the Makefile generator to determin the following variables: diff --git a/Modules/CMakeDetermineVSServicePack.cmake b/Modules/CMakeDetermineVSServicePack.cmake index a5bb528..8e4eb34 100644 --- a/Modules/CMakeDetermineVSServicePack.cmake +++ b/Modules/CMakeDetermineVSServicePack.cmake @@ -33,7 +33,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # [INTERNAL] diff --git a/Modules/CMakeExportBuildSettings.cmake b/Modules/CMakeExportBuildSettings.cmake index f7d7de1..8d316b9 100644 --- a/Modules/CMakeExportBuildSettings.cmake +++ b/Modules/CMakeExportBuildSettings.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # This module is purposely no longer documented. It does nothing useful. diff --git a/Modules/CMakeFindBinUtils.cmake b/Modules/CMakeFindBinUtils.cmake index d27c978..64ec403 100644 --- a/Modules/CMakeFindBinUtils.cmake +++ b/Modules/CMakeFindBinUtils.cmake @@ -26,7 +26,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # if it's the MS C/CXX compiler, search for link diff --git a/Modules/CMakeFindCodeBlocks.cmake b/Modules/CMakeFindCodeBlocks.cmake index 0dbe20f..c72c8f7 100644 --- a/Modules/CMakeFindCodeBlocks.cmake +++ b/Modules/CMakeFindCodeBlocks.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # This file is included in CMakeSystemSpecificInformation.cmake if diff --git a/Modules/CMakeFindEclipseCDT4.cmake b/Modules/CMakeFindEclipseCDT4.cmake index f479285..836e4c9 100644 --- a/Modules/CMakeFindEclipseCDT4.cmake +++ b/Modules/CMakeFindEclipseCDT4.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # This file is included in CMakeSystemSpecificInformation.cmake if @@ -22,8 +22,8 @@ FIND_PROGRAM(CMAKE_ECLIPSE_EXECUTABLE NAMES eclipse DOC "The Eclipse executable" # so that Eclipse ca find the headers at runtime and parsing etc. works better # This is done here by actually running gcc with the options so it prints its # system include directories, which are parsed then and stored in the cache. -MACRO(_DETERMINE_GCC_SYSTEM_INCLUDE_DIRS _lang _result _resultDefines) - SET(${_result}) +MACRO(_DETERMINE_GCC_SYSTEM_INCLUDE_DIRS _lang _resultIncludeDirs _resultDefines) + SET(${_resultIncludeDirs}) SET(_gccOutput) FILE(WRITE "${CMAKE_BINARY_DIR}/CMakeFiles/dummy" "\n" ) EXECUTE_PROCESS(COMMAND ${CMAKE_C_COMPILER} -v -E -x ${_lang} -dD dummy @@ -32,24 +32,43 @@ MACRO(_DETERMINE_GCC_SYSTEM_INCLUDE_DIRS _lang _result _resultDefines) OUTPUT_VARIABLE _gccStdout ) FILE(REMOVE "${CMAKE_BINARY_DIR}/CMakeFiles/dummy") + # First find the system include dirs: IF( "${_gccOutput}" MATCHES "> search starts here[^\n]+\n *(.+) *\n *End of (search) list" ) - SET(${_result} ${CMAKE_MATCH_1}) - STRING(REPLACE "\n" " " ${_result} "${${_result}}") - SEPARATE_ARGUMENTS(${_result}) + + # split the output into lines and then remove leading and trailing spaces from each of them: + STRING(REGEX MATCHALL "[^\n]+\n" _includeLines "${CMAKE_MATCH_1}") + FOREACH(nextLine ${_includeLines}) + STRING(STRIP "${nextLine}" _includePath) + LIST(APPEND ${_resultIncludeDirs} "${_includePath}") + ENDFOREACH(nextLine) + ENDIF( "${_gccOutput}" MATCHES "> search starts here[^\n]+\n *(.+) *\n *End of (search) list" ) - - IF( "${_gccStdout}" MATCHES "built-in>\"\n(.+)# 1 +\"dummy\"" ) - SET(_builtinDefines ${CMAKE_MATCH_1}) - # Remove the '# 1 "<command-line>"' lines - STRING(REGEX REPLACE "# 1[^\n]+\n" "" _filteredOutput "${_builtinDefines}") - # Remove the "#define " parts from the output: - STRING(REGEX REPLACE "#define " "" _defineRemoved "${_filteredOutput}") - # Replace the line breaks with spaces, so we can use separate arguments afterwards - STRING(REGEX REPLACE "\n" " " _defineRemoved "${_defineRemoved}") - # Remove space at the end, this would produce empty list items - STRING(REGEX REPLACE " +$" "" ${_resultDefines} "${_defineRemoved}") - SEPARATE_ARGUMENTS(${_resultDefines}) - ENDIF( "${_gccStdout}" MATCHES "built-in>\"\n(.+)# 1 +\"dummy\"" ) + + + # now find the builtin macros: + STRING(REGEX MATCHALL "#define[^\n]+\n" _defineLines "${_gccStdout}") +# A few example lines which the regexp below has to match properly: +# #define MAX(a,b) ((a) > (b) ? (a) : (b)) +# #define __fastcall __attribute__((__fastcall__)) +# #define FOO (23) +# #define __UINTMAX_TYPE__ long long unsigned int +# #define __UINTMAX_TYPE__ long long unsigned int +# #define __i386__ 1 + + FOREACH(nextLine ${_defineLines}) + STRING(REGEX MATCH "^#define +([A-Za-z_][A-Za-z0-9_]*)(\\([^\\)]+\\))? +(.+) *$" _dummy "${nextLine}") + SET(_name "${CMAKE_MATCH_1}${CMAKE_MATCH_2}") + STRING(STRIP "${CMAKE_MATCH_3}" _value) + #MESSAGE(STATUS "m1: -${CMAKE_MATCH_1}- m2: -${CMAKE_MATCH_2}- m3: -${CMAKE_MATCH_3}-") + + LIST(APPEND ${_resultDefines} "${_name}") + IF(_value) + LIST(APPEND ${_resultDefines} "${_value}") + ELSE() + LIST(APPEND ${_resultDefines} " ") + ENDIF() + ENDFOREACH(nextLine) + ENDMACRO(_DETERMINE_GCC_SYSTEM_INCLUDE_DIRS _lang) # Save the current LC_ALL, LC_MESSAGES, and LANG environment variables and set them diff --git a/Modules/CMakeFindFrameworks.cmake b/Modules/CMakeFindFrameworks.cmake index 1bc8935..001da20 100644 --- a/Modules/CMakeFindFrameworks.cmake +++ b/Modules/CMakeFindFrameworks.cmake @@ -10,7 +10,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) IF(NOT CMAKE_FIND_FRAMEWORKS_INCLUDED) diff --git a/Modules/CMakeFindKDevelop3.cmake b/Modules/CMakeFindKDevelop3.cmake index 1c77365..331dc6e 100644 --- a/Modules/CMakeFindKDevelop3.cmake +++ b/Modules/CMakeFindKDevelop3.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # This file is included in CMakeSystemSpecificInformation.cmake if diff --git a/Modules/CMakeFindWMake.cmake b/Modules/CMakeFindWMake.cmake index e4bbb3d..6972c4c 100644 --- a/Modules/CMakeFindWMake.cmake +++ b/Modules/CMakeFindWMake.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) SET (CMAKE_MAKE_PROGRAM "wmake" CACHE STRING diff --git a/Modules/CMakeFindXCode.cmake b/Modules/CMakeFindXCode.cmake index 240f936..53967b5 100644 --- a/Modules/CMakeFindXCode.cmake +++ b/Modules/CMakeFindXCode.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) FIND_PROGRAM(CMAKE_MAKE_PROGRAM diff --git a/Modules/CMakeForceCompiler.cmake b/Modules/CMakeForceCompiler.cmake index b7a681a..2a839fd 100644 --- a/Modules/CMakeForceCompiler.cmake +++ b/Modules/CMakeForceCompiler.cmake @@ -39,7 +39,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) MACRO(CMAKE_FORCE_C_COMPILER compiler id) diff --git a/Modules/CMakeFortranInformation.cmake b/Modules/CMakeFortranInformation.cmake index 97a5e7e..cdb8038 100644 --- a/Modules/CMakeFortranInformation.cmake +++ b/Modules/CMakeFortranInformation.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # This file sets the basic flags for the Fortran language in CMake. diff --git a/Modules/CMakeGenericSystem.cmake b/Modules/CMakeGenericSystem.cmake index c0f3aa6..7d2d8cd 100644 --- a/Modules/CMakeGenericSystem.cmake +++ b/Modules/CMakeGenericSystem.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) SET(CMAKE_SHARED_LIBRARY_C_FLAGS "") # -pic diff --git a/Modules/CMakeImportBuildSettings.cmake b/Modules/CMakeImportBuildSettings.cmake index 968bc79..848d894 100644 --- a/Modules/CMakeImportBuildSettings.cmake +++ b/Modules/CMakeImportBuildSettings.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # This module is purposely no longer documented. It does nothing useful. diff --git a/Modules/CMakeJOMFindMake.cmake b/Modules/CMakeJOMFindMake.cmake index a72420a..617f3bb 100644 --- a/Modules/CMakeJOMFindMake.cmake +++ b/Modules/CMakeJOMFindMake.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) diff --git a/Modules/CMakeJavaInformation.cmake b/Modules/CMakeJavaInformation.cmake index f537da5..e9bc9be 100644 --- a/Modules/CMakeJavaInformation.cmake +++ b/Modules/CMakeJavaInformation.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # This should be included before the _INIT variables are diff --git a/Modules/CMakeMSYSFindMake.cmake b/Modules/CMakeMSYSFindMake.cmake index e95f74f..95492a0 100644 --- a/Modules/CMakeMSYSFindMake.cmake +++ b/Modules/CMakeMSYSFindMake.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) FIND_PROGRAM(CMAKE_MAKE_PROGRAM make diff --git a/Modules/CMakeMinGWFindMake.cmake b/Modules/CMakeMinGWFindMake.cmake index 68e8442..f760d74 100644 --- a/Modules/CMakeMinGWFindMake.cmake +++ b/Modules/CMakeMinGWFindMake.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) FIND_PROGRAM(CMAKE_MAKE_PROGRAM mingw32-make.exe PATHS diff --git a/Modules/CMakeNMakeFindMake.cmake b/Modules/CMakeNMakeFindMake.cmake index 84ea56d..f647217 100644 --- a/Modules/CMakeNMakeFindMake.cmake +++ b/Modules/CMakeNMakeFindMake.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) diff --git a/Modules/CMakeParseArguments.cmake b/Modules/CMakeParseArguments.cmake new file mode 100644 index 0000000..7ce4c49 --- /dev/null +++ b/Modules/CMakeParseArguments.cmake @@ -0,0 +1,138 @@ +# CMAKE_PARSE_ARGUMENTS(<prefix> <options> <one_value_keywords> <multi_value_keywords> args...) +# +# CMAKE_PARSE_ARGUMENTS() is intended to be used in macros or functions for +# parsing the arguments given to that macro or function. +# It processes the arguments and defines a set of variables which hold the +# values of the respective options. +# +# The <options> argument contains all options for the respective macro, +# i.e. keywords which can be used when calling the macro without any value +# following, like e.g. the OPTIONAL keyword of the install() command. +# +# The <one_value_keywords> argument contains all keywords for this macro +# which are followed by one value, like e.g. DESTINATION keyword of the +# install() command. +# +# The <multi_value_keywords> argument contains all keywords for this macro +# which can be followed by more than one value, like e.g. the TARGETS or +# FILES keywords of the install() command. +# +# When done, CMAKE_PARSE_ARGUMENTS() will have defined for each of the +# keywords listed in <options>, <one_value_keywords> and +# <multi_value_keywords> a variable composed of the given <prefix> +# followed by "_" and the name of the respective keyword. +# These variables will then hold the respective value from the argument list. +# For the <options> keywords this will be TRUE or FALSE. +# +# All remaining arguments are collected in a variable +# <prefix>_UNPARSED_ARGUMENTS, this can be checked afterwards to see whether +# your macro was called with unrecognized parameters. +# +# As an example here a my_install() macro, which takes similar arguments as the +# real install() command: +# +# function(MY_INSTALL) +# set(options OPTIONAL FAST) +# set(oneValueArgs DESTINATION RENAME) +# set(multiValueArgs TARGETS CONFIGURATIONS) +# cmake_parse_arguments(MY_INSTALL "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} ) +# ... +# +# Assume my_install() has been called like this: +# my_install(TARGETS foo bar DESTINATION bin OPTIONAL blub) +# +# After the cmake_parse_arguments() call the macro will have set the following +# variables: +# MY_INSTALL_OPTIONAL = TRUE +# MY_INSTALL_FAST = FALSE (this option was not used when calling my_install() +# MY_INSTALL_DESTINATION = "bin" +# MY_INSTALL_RENAME = "" (was not used) +# MY_INSTALL_TARGETS = "foo;bar" +# MY_INSTALL_CONFIGURATIONS = "" (was not used) +# MY_INSTALL_UNPARSED_ARGUMENTS = "blub" (no value expected after "OPTIONAL" +# +# You can the continue and process these variables. +# +# Keywords terminate lists of values, e.g. if directly after a one_value_keyword +# another recognized keyword follows, this is interpreted as the beginning of +# the new option. +# E.g. my_install(TARGETS foo DESTINATION OPTIONAL) would result in +# MY_INSTALL_DESTINATION set to "OPTIONAL", but MY_INSTALL_DESTINATION would +# be empty and MY_INSTALL_OPTIONAL would be set to TRUE therefor. + +#============================================================================= +# Copyright 2010 Alexander Neundorf <neundorf@kde.org> +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + + +if(__CMAKE_PARSE_ARGUMENTS_INCLUDED) + return() +endif() +set(__CMAKE_PARSE_ARGUMENTS_INCLUDED TRUE) + + +function(CMAKE_PARSE_ARGUMENTS prefix _optionNames _singleArgNames _multiArgNames) + # first set all result variables to empty/FALSE + foreach(arg_name ${_singleArgNames} ${_multiArgNames}) + set(${prefix}_${arg_name}) + endforeach(arg_name) + + foreach(option ${_optionNames}) + set(${prefix}_${option} FALSE) + endforeach(option) + + set(${prefix}_UNPARSED_ARGUMENTS) + + set(insideValues FALSE) + set(currentArgName) + + # now iterate over all arguments and fill the result variables + foreach(currentArg ${ARGN}) + list(FIND _optionNames "${currentArg}" optionIndex) # ... then this marks the end of the arguments belonging to this keyword + list(FIND _singleArgNames "${currentArg}" singleArgIndex) # ... then this marks the end of the arguments belonging to this keyword + list(FIND _multiArgNames "${currentArg}" multiArgIndex) # ... then this marks the end of the arguments belonging to this keyword + + if(${optionIndex} EQUAL -1 AND ${singleArgIndex} EQUAL -1 AND ${multiArgIndex} EQUAL -1) + if(insideValues) + if("${insideValues}" STREQUAL "SINGLE") + set(${prefix}_${currentArgName} ${currentArg}) + set(insideValues FALSE) + elseif("${insideValues}" STREQUAL "MULTI") + list(APPEND ${prefix}_${currentArgName} ${currentArg}) + endif() + else(insideValues) + list(APPEND ${prefix}_UNPARSED_ARGUMENTS ${currentArg}) + endif(insideValues) + else() + if(NOT ${optionIndex} EQUAL -1) + set(${prefix}_${currentArg} TRUE) + set(insideValues FALSE) + elseif(NOT ${singleArgIndex} EQUAL -1) + set(currentArgName ${currentArg}) + set(${prefix}_${currentArgName}) + set(insideValues "SINGLE") + elseif(NOT ${multiArgIndex} EQUAL -1) + set(currentArgName ${currentArg}) + set(${prefix}_${currentArgName}) + set(insideValues "MULTI") + endif() + endif() + + endforeach(currentArg) + + # propagate the result variables to the caller: + foreach(arg_name ${_singleArgNames} ${_multiArgNames} ${_optionNames}) + set(${prefix}_${arg_name} ${${prefix}_${arg_name}} PARENT_SCOPE) + endforeach(arg_name) + set(${prefix}_UNPARSED_ARGUMENTS ${${prefix}_UNPARSED_ARGUMENTS} PARENT_SCOPE) + +endfunction(CMAKE_PARSE_ARGUMENTS _options _singleArgs _multiArgs) diff --git a/Modules/CMakeParseImplicitLinkInfo.cmake b/Modules/CMakeParseImplicitLinkInfo.cmake index 1761d28..defdb47 100644 --- a/Modules/CMakeParseImplicitLinkInfo.cmake +++ b/Modules/CMakeParseImplicitLinkInfo.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # Function parse implicit linker options. diff --git a/Modules/CMakePrintSystemInformation.cmake b/Modules/CMakePrintSystemInformation.cmake index 3f33ce8..2c5d0f2 100644 --- a/Modules/CMakePrintSystemInformation.cmake +++ b/Modules/CMakePrintSystemInformation.cmake @@ -13,7 +13,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) MESSAGE("CMAKE_SYSTEM is ${CMAKE_SYSTEM} ${CMAKE_SYSTEM_NAME} ${CMAKE_SYSTEM_VERSION}") diff --git a/Modules/CMakeRCInformation.cmake b/Modules/CMakeRCInformation.cmake index f6509fb..fcd0099 100644 --- a/Modules/CMakeRCInformation.cmake +++ b/Modules/CMakeRCInformation.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) diff --git a/Modules/CMakeSystemSpecificInformation.cmake b/Modules/CMakeSystemSpecificInformation.cmake index 75d737f..faa9e36 100644 --- a/Modules/CMakeSystemSpecificInformation.cmake +++ b/Modules/CMakeSystemSpecificInformation.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # This file is included by cmGlobalGenerator::EnableLanguage. diff --git a/Modules/CMakeTestASM-ATTCompiler.cmake b/Modules/CMakeTestASM-ATTCompiler.cmake index 9ba306a..3b7a74f 100644 --- a/Modules/CMakeTestASM-ATTCompiler.cmake +++ b/Modules/CMakeTestASM-ATTCompiler.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # This file is used by EnableLanguage in cmGlobalGenerator to diff --git a/Modules/CMakeTestASMCompiler.cmake b/Modules/CMakeTestASMCompiler.cmake index d62a79a..54def81 100644 --- a/Modules/CMakeTestASMCompiler.cmake +++ b/Modules/CMakeTestASMCompiler.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # This file is used by EnableLanguage in cmGlobalGenerator to diff --git a/Modules/CMakeTestASM_MASMCompiler.cmake b/Modules/CMakeTestASM_MASMCompiler.cmake index 63207e3..84ca98f 100644 --- a/Modules/CMakeTestASM_MASMCompiler.cmake +++ b/Modules/CMakeTestASM_MASMCompiler.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # This file is used by EnableLanguage in cmGlobalGenerator to diff --git a/Modules/CMakeTestCCompiler.cmake b/Modules/CMakeTestCCompiler.cmake index bac9932..038c2fd 100644 --- a/Modules/CMakeTestCCompiler.cmake +++ b/Modules/CMakeTestCCompiler.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) INCLUDE(CMakeTestCompilerCommon) diff --git a/Modules/CMakeTestCXXCompiler.cmake b/Modules/CMakeTestCXXCompiler.cmake index 06ef301..c1a3b3a 100644 --- a/Modules/CMakeTestCXXCompiler.cmake +++ b/Modules/CMakeTestCXXCompiler.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) INCLUDE(CMakeTestCompilerCommon) diff --git a/Modules/CMakeTestCompilerCommon.cmake b/Modules/CMakeTestCompilerCommon.cmake index 4307627..fd8a105 100644 --- a/Modules/CMakeTestCompilerCommon.cmake +++ b/Modules/CMakeTestCompilerCommon.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) function(PrintTestCompilerStatus LANG MSG) diff --git a/Modules/CMakeTestFortranCompiler.cmake b/Modules/CMakeTestFortranCompiler.cmake index 61d6336..33f62eb 100644 --- a/Modules/CMakeTestFortranCompiler.cmake +++ b/Modules/CMakeTestFortranCompiler.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) INCLUDE(CMakeTestCompilerCommon) diff --git a/Modules/CMakeTestJavaCompiler.cmake b/Modules/CMakeTestJavaCompiler.cmake index 546d9b9..cfd3e24 100644 --- a/Modules/CMakeTestJavaCompiler.cmake +++ b/Modules/CMakeTestJavaCompiler.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # This file is used by EnableLanguage in cmGlobalGenerator to diff --git a/Modules/CMakeTestRCCompiler.cmake b/Modules/CMakeTestRCCompiler.cmake index 194f860..a5c8d11 100644 --- a/Modules/CMakeTestRCCompiler.cmake +++ b/Modules/CMakeTestRCCompiler.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # This file is used by EnableLanguage in cmGlobalGenerator to diff --git a/Modules/CMakeUnixFindMake.cmake b/Modules/CMakeUnixFindMake.cmake index 8c9e031..39962c0 100644 --- a/Modules/CMakeUnixFindMake.cmake +++ b/Modules/CMakeUnixFindMake.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) FIND_PROGRAM(CMAKE_MAKE_PROGRAM NAMES gmake make smake) diff --git a/Modules/CMakeVS10FindMake.cmake b/Modules/CMakeVS10FindMake.cmake index 460de25..af5f3a7 100644 --- a/Modules/CMakeVS10FindMake.cmake +++ b/Modules/CMakeVS10FindMake.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # We use MSBuild as the build tool for VS 10 diff --git a/Modules/CMakeVS6BackwardCompatibility.cmake b/Modules/CMakeVS6BackwardCompatibility.cmake index 8370896..438f64f 100644 --- a/Modules/CMakeVS6BackwardCompatibility.cmake +++ b/Modules/CMakeVS6BackwardCompatibility.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # hard code these for fast backwards compatibility tests diff --git a/Modules/CMakeVS6FindMake.cmake b/Modules/CMakeVS6FindMake.cmake index 0dd21a8..dccf8c4 100644 --- a/Modules/CMakeVS6FindMake.cmake +++ b/Modules/CMakeVS6FindMake.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) FIND_PROGRAM(CMAKE_MAKE_PROGRAM @@ -22,3 +22,4 @@ FIND_PROGRAM(CMAKE_MAKE_PROGRAM ) MARK_AS_ADVANCED(CMAKE_MAKE_PROGRAM) SET(MSVC60 1) +SET(MSVC_VERSION 1200) diff --git a/Modules/CMakeVS71FindMake.cmake b/Modules/CMakeVS71FindMake.cmake index 8fd332c..2381adb 100644 --- a/Modules/CMakeVS71FindMake.cmake +++ b/Modules/CMakeVS71FindMake.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) FIND_PROGRAM(CMAKE_MAKE_PROGRAM @@ -23,3 +23,4 @@ FIND_PROGRAM(CMAKE_MAKE_PROGRAM ) MARK_AS_ADVANCED(CMAKE_MAKE_PROGRAM) SET(MSVC71 1) +SET(MSVC_VERSION 1310) diff --git a/Modules/CMakeVS7BackwardCompatibility.cmake b/Modules/CMakeVS7BackwardCompatibility.cmake index 3c78953..df0b3bb 100644 --- a/Modules/CMakeVS7BackwardCompatibility.cmake +++ b/Modules/CMakeVS7BackwardCompatibility.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # hard code these for fast backwards compatibility tests diff --git a/Modules/CMakeVS7FindMake.cmake b/Modules/CMakeVS7FindMake.cmake index 7f65a28..665158c 100644 --- a/Modules/CMakeVS7FindMake.cmake +++ b/Modules/CMakeVS7FindMake.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) FIND_PROGRAM(CMAKE_MAKE_PROGRAM @@ -22,3 +22,4 @@ FIND_PROGRAM(CMAKE_MAKE_PROGRAM ) MARK_AS_ADVANCED(CMAKE_MAKE_PROGRAM) SET(MSVC70 1) +SET(MSVC_VERSION 1300) diff --git a/Modules/CMakeVS8FindMake.cmake b/Modules/CMakeVS8FindMake.cmake index 6f45ed5..bb08180 100644 --- a/Modules/CMakeVS8FindMake.cmake +++ b/Modules/CMakeVS8FindMake.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # VCExpress does not support cross compiling, which is necessary for Win CE @@ -28,9 +28,6 @@ FIND_PROGRAM(CMAKE_MAKE_PROGRAM "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 8/Common7/IDE" "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio8/Common7/IDE" "/Program Files/Microsoft Visual Studio 8/Common7/IDE/" - PATHS - "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio .NET/Common7/IDE" - "$ENV{ProgramFiles}/Microsoft Visual Studio .NET/Common7/IDE" ) MARK_AS_ADVANCED(CMAKE_MAKE_PROGRAM) SET(MSVC80 1) diff --git a/Modules/CMakeVS9FindMake.cmake b/Modules/CMakeVS9FindMake.cmake index 2741f77..9e3c39e 100644 --- a/Modules/CMakeVS9FindMake.cmake +++ b/Modules/CMakeVS9FindMake.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # VCExpress does not support cross compiling, which is necessary for Win CE @@ -33,10 +33,6 @@ FIND_PROGRAM(CMAKE_MAKE_PROGRAM "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio9/Common7/IDE" "/Program Files/Microsoft Visual Studio 9.0/Common7/IDE/" "/Program Files/Microsoft Visual Studio 9/Common7/IDE/" - PATHS - "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio .NET/Common7/IDE" - "$ENV{ProgramFiles}/Microsoft Visual Studio .NET/Common7/IDE" - ) MARK_AS_ADVANCED(CMAKE_MAKE_PROGRAM) SET(MSVC90 1) diff --git a/Modules/CMakeVerifyManifest.cmake b/Modules/CMakeVerifyManifest.cmake index dbba464..7578369 100644 --- a/Modules/CMakeVerifyManifest.cmake +++ b/Modules/CMakeVerifyManifest.cmake @@ -26,7 +26,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake index 2991ada..7033e31 100644 --- a/Modules/CPack.cmake +++ b/Modules/CPack.cmake @@ -19,9 +19,41 @@ # described below, for more information about component-specific # installations. # -# Before including the CPack module, there are a variety of variables -# that can be set to customize the resulting installers. The most -# commonly-used variables are: +# The CPACK_GENERATOR variable has different meanings in different +# contexts. In your CMakeLists.txt file, CPACK_GENERATOR is a +# *list of generators*: when run with no other arguments, CPack +# will iterate over that list and produce one package for each +# generator. In a CPACK_PROJECT_CONFIG_FILE, though, CPACK_GENERATOR +# is a *string naming a single generator*. If you need per-cpack- +# generator logic to control *other* cpack settings, then you need +# a CPACK_PROJECT_CONFIG_FILE. +# +# The CMake source tree itself contains a CPACK_PROJECT_CONFIG_FILE. +# See the top level file CMakeCPackOptions.cmake.in for an example. +# +# If set, the CPACK_PROJECT_CONFIG_FILE is included automatically +# on a per-generator basis. It only need contain overrides. +# +# Here's how it works: +# - cpack runs +# - it includes CPackConfig.cmake +# - it iterates over the generators listed in that file's +# CPACK_GENERATOR list variable (unless told to use just a +# specific one via -G on the command line...) +# +# - foreach generator, it then +# - sets CPACK_GENERATOR to the one currently being iterated +# - includes the CPACK_PROJECT_CONFIG_FILE +# - produces the package for that generator +# +# This is the key: For each generator listed in CPACK_GENERATOR +# in CPackConfig.cmake, cpack will *reset* CPACK_GENERATOR +# internally to *the one currently being used* and then include +# the CPACK_PROJECT_CONFIG_FILE. +# +# Before including this CPack module in your CMakeLists.txt file, +# there are a variety of variables that can be set to customize +# the resulting installers. The most commonly-used variables are: # # CPACK_PACKAGE_NAME - The name of the package (or application). If # not specified, defaults to the project name. @@ -48,6 +80,11 @@ # CPACK_PACKAGE_INSTALL_DIRECTORY - Installation directory on the # target system, e.g., "CMake 2.5". # +# CPACK_PROJECT_CONFIG_FILE - File included at cpack time, once per +# generator after setting CPACK_GENERATOR to the actual generator +# being used. Allows per-generator setting of CPACK_* variables at +# cpack time. +# # CPACK_RESOURCE_FILE_LICENSE - License file for the project, which # will typically be displayed to the user (often with an explicit # "Accept" button, for graphical installers) prior to installation. @@ -459,7 +496,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # Pick a configuration file diff --git a/Modules/CPackDeb.cmake b/Modules/CPackDeb.cmake index f5ca592..07d6ff9 100644 --- a/Modules/CPackDeb.cmake +++ b/Modules/CPackDeb.cmake @@ -1,15 +1,18 @@ # - The builtin (binary) CPack Deb generator (Unix only) # CPackDeb may be used to create Deb package using CPack. # CPackDeb is a CPack generator thus it uses the CPACK_XXX variables -# used by CPack : http://www.cmake.org/Wiki/CMake:CPackConfiguration +# used by CPack : http://www.cmake.org/Wiki/CMake:CPackConfiguration. +# CPackDeb generator should work on any linux host but it will +# produce better deb package when Debian specific tools 'dpkg-xxx' +# are usable on the build system. # -# However CPackRPM has specific features which are controlled by -# the specifics CPACK_RPM_XXX variables.You'll find a detailed usage on -# the wiki: +# CPackDeb has specific features which are controlled by +# the specifics CPACK_DEBIAN_XXX variables.You'll find a detailed usage on +# the wiki: # http://www.cmake.org/Wiki/CMake:CPackPackageGenerators#DEB_.28UNIX_only.29 # However as a handy reminder here comes the list of specific variables: # -# CPACK_DEBIAN_PACKAGE_NAME +# CPACK_DEBIAN_PACKAGE_NAME # Mandatory : YES # Default : CPACK_PACKAGE_NAME (lower case) # The debian package summary @@ -19,12 +22,12 @@ # The debian package version # CPACK_DEBIAN_PACKAGE_ARCHITECTURE) # Mandatory : YES -# Default : Output of dpkg --print-architecture or i386 +# Default : Output of dpkg --print-architecture (or i386 if dpkg is not found) # The debian package architecture # CPACK_DEBIAN_PACKAGE_DEPENDS # Mandatory : NO # Default : - -# May be used to set deb dependencies. +# May be used to set deb dependencies. # CPACK_DEBIAN_PACKAGE_MAINTAINER # Mandatory : YES # Default : CPACK_PACKAGE_CONTACT @@ -41,6 +44,25 @@ # Mandatory : YES # Default : 'optional' # The debian package priority +# CPACK_DEBIAN_PACKAGE_HOMEPAGE +# Mandatory : NO +# Default : - +# The URL of the web site for this package +# CPACK_DEBIAN_PACKAGE_SHLIBDEPS +# Mandatory : NO +# Default : OFF +# May be set to ON in order to use dpkg-shlibdeps to generate +# better package dependency list. +# You may need set CMAKE_INSTALL_RPATH toi appropriate value +# if you use this feature, because if you don't dpkg-shlibdeps +# may fail to find your own shared libs. +# See http://www.cmake.org/Wiki/CMake_RPATH_handling. +# CPACK_DEBIAN_PACKAGE_DEBUG +# Mandatory : NO +# Default : - +# May be set when invoking cpack in order to trace debug informations +# during CPackDeb run. + #============================================================================= # Copyright 2007-2009 Kitware, Inc. @@ -53,7 +75,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # CPack script for creating Debian package @@ -69,6 +91,103 @@ IF(NOT UNIX) MESSAGE(FATAL_ERROR "CPackDeb.cmake may only be used under UNIX.") ENDIF(NOT UNIX) +# CPACK_DEBIAN_PACKAGE_SHLIBDEPS +# If specify OFF, only user depends are used +IF(NOT DEFINED CPACK_DEBIAN_PACKAGE_SHLIBDEPS) + SET(CPACK_DEBIAN_PACKAGE_SHLIBDEPS OFF) +ENDIF(NOT DEFINED CPACK_DEBIAN_PACKAGE_SHLIBDEPS) + +IF(CPACK_DEBIAN_PACKAGE_SHLIBDEPS) + # dpkg-shlibdeps is a Debian utility for generating dependency list + FIND_PROGRAM(SHLIBDEPS_EXECUTABLE dpkg-shlibdeps) + + # Check version of the dpkg-shlibdeps tool using CPackRPM method + IF(SHLIBDEPS_EXECUTABLE) + EXECUTE_PROCESS(COMMAND ${SHLIBDEPS_EXECUTABLE} --version + OUTPUT_VARIABLE _TMP_VERSION + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + STRING(REGEX MATCH "dpkg-shlibdeps version ([0-9]+\\.[0-9]+\\.[0-9]+)" + SHLIBDEPS_EXECUTABLE_VERSION + ${_TMP_VERSION}) + SET(SHLIBDEPS_EXECUTABLE_VERSION "${CMAKE_MATCH_1}") + IF(CPACK_DEBIAN_PACKAGE_DEBUG) + MESSAGE( "CPackDeb Debug: dpkg-shlibdeps version is <${SHLIBDEPS_EXECUTABLE_VERSION}>") + ENDIF(CPACK_DEBIAN_PACKAGE_DEBUG) + + # Generating binary list - Get type of all install files + EXECUTE_PROCESS(COMMAND find -type f + COMMAND xargs file + WORKING_DIRECTORY "${CPACK_TEMPORARY_DIRECTORY}" + OUTPUT_VARIABLE CPACK_DEB_INSTALL_FILES) + + # Convert to CMake list + STRING(REGEX REPLACE "\n" ";" CPACK_DEB_INSTALL_FILES ${CPACK_DEB_INSTALL_FILES}) + + # Only dynamically linked ELF files are included + # Extract only file name infront of ":" + FOREACH ( _FILE ${CPACK_DEB_INSTALL_FILES}) + IF ( ${_FILE} MATCHES "ELF.*dynamically linked") + STRING(REGEX MATCH "(^.*):" _FILE_NAME ${_FILE}) + LIST(APPEND CPACK_DEB_BINARY_FILES ${CMAKE_MATCH_1}) + ENDIF() + ENDFOREACH() + + MESSAGE( "CPackDeb: - Generating dependency list") + + # Create blank control file for running dpkg-shlibdeps + # There might be some other way to invoke dpkg-shlibdeps without creating this file + # but standard debian package should not have anything that can collide with this file or directory + FILE(MAKE_DIRECTORY ${CPACK_TEMPORARY_DIRECTORY}/debian) + FILE(WRITE ${CPACK_TEMPORARY_DIRECTORY}/debian/control "") + + # Execute dpkg-shlibdeps + # --ignore-missing-info : allow dpkg-shlibdeps to run even if some libs do not belong to a package + # -O : print to STDOUT + EXECUTE_PROCESS(COMMAND ${SHLIBDEPS_EXECUTABLE} --ignore-missing-info -O ${CPACK_DEB_BINARY_FILES} + WORKING_DIRECTORY "${CPACK_TEMPORARY_DIRECTORY}" + OUTPUT_VARIABLE SHLIBDEPS_OUTPUT + RESULT_VARIABLE SHLIBDEPS_RESULT + ERROR_VARIABLE SHLIBDEPS_ERROR + OUTPUT_STRIP_TRAILING_WHITESPACE ) + IF(CPACK_DEBIAN_PACKAGE_DEBUG) + # dpkg-shlibdeps will throw some warnings if some input files are not binary + MESSAGE( "CPackDeb Debug: dpkg-shlibdeps warnings \n${SHLIBDEPS_ERROR}") + ENDIF(CPACK_DEBIAN_PACKAGE_DEBUG) + IF (NOT SHLIBDEPS_RESULT EQUAL 0) + MESSAGE (FATAL_ERROR "CPackDeb: dpkg-shlibdeps: ${SHLIBDEPS_ERROR}") + ENDIF (NOT SHLIBDEPS_RESULT EQUAL 0) + + #Get rid of prefix generated by dpkg-shlibdeps + string (REGEX REPLACE "^.*Depends=" "" CPACK_DEBIAN_PACKAGE_AUTO_DEPENDS ${SHLIBDEPS_OUTPUT}) + + IF(CPACK_DEBIAN_PACKAGE_DEBUG) + MESSAGE( "CPackDeb Debug: Found dependency: ${CPACK_DEBIAN_PACKAGE_AUTO_DEPENDS}") + ENDIF(CPACK_DEBIAN_PACKAGE_DEBUG) + + # Remove blank control file + # Might not be safe if package actual contain file or directory named debian + FILE(REMOVE_RECURSE "${CPACK_TEMPORARY_DIRECTORY}/debian") + + # Append user depend if set + IF (CPACK_DEBIAN_PACKAGE_DEPENDS) + SET (CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_AUTO_DEPENDS}, ${CPACK_DEBIAN_PACKAGE_DEPENDS}") + ELSE (CPACK_DEBIAN_PACKAGE_DEPENDS) + SET (CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_AUTO_DEPENDS}") + ENDIF (CPACK_DEBIAN_PACKAGE_DEPENDS) + + ELSE (SHLIBDEPS_EXECUTABLE) + IF(CPACK_DEBIAN_PACKAGE_DEBUG) + MESSAGE( "CPackDeb Debug: Using only user-provided depends because dpkg-shlibdeps is not found.") + ENDIF(CPACK_DEBIAN_PACKAGE_DEBUG) + ENDIF(SHLIBDEPS_EXECUTABLE) + +ELSE (CPACK_DEBIAN_PACKAGE_SHLIBDEPS) + IF(CPACK_DEBIAN_PACKAGE_DEBUG) + MESSAGE( "CPackDeb Debug: Using only user-provided depends") + ENDIF(CPACK_DEBIAN_PACKAGE_DEBUG) +ENDIF(CPACK_DEBIAN_PACKAGE_SHLIBDEPS) + # Let's define the control file found in debian package: # Binary package: @@ -84,7 +203,7 @@ ENDIF(NOT CPACK_DEBIAN_PACKAGE_NAME) # Version: (mandatory) IF(NOT CPACK_DEBIAN_PACKAGE_VERSION) IF(NOT CPACK_PACKAGE_VERSION) - MESSAGE(FATAL_ERROR "Debian package requires a package version") + MESSAGE(FATAL_ERROR "CPackDeb: Debian package requires a package version") ENDIF(NOT CPACK_PACKAGE_VERSION) SET(CPACK_DEBIAN_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION}) ENDIF(NOT CPACK_DEBIAN_PACKAGE_VERSION) @@ -95,7 +214,7 @@ IF(NOT CPACK_DEBIAN_PACKAGE_ARCHITECTURE) # $ dpkg --print-architecture FIND_PROGRAM(DPKG_CMD dpkg) IF(NOT DPKG_CMD) - MESSAGE(STATUS "Can not find dpkg in your path, default to i386.") + MESSAGE(STATUS "CPackDeb: Can not find dpkg in your path, default to i386.") SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE i386) ENDIF(NOT DPKG_CMD) EXECUTE_PROCESS(COMMAND "${DPKG_CMD}" --print-architecture @@ -116,7 +235,7 @@ ENDIF(NOT CPACK_DEBIAN_PACKAGE_DEPENDS) # Maintainer: (mandatory) IF(NOT CPACK_DEBIAN_PACKAGE_MAINTAINER) IF(NOT CPACK_PACKAGE_CONTACT) - MESSAGE(FATAL_ERROR "Debian package requires a maintainer for a package, set CPACK_PACKAGE_CONTACT or CPACK_DEBIAN_PACKAGE_MAINTAINER") + MESSAGE(FATAL_ERROR "CPackDeb: Debian package requires a maintainer for a package, set CPACK_PACKAGE_CONTACT or CPACK_DEBIAN_PACKAGE_MAINTAINER") ENDIF(NOT CPACK_PACKAGE_CONTACT) SET(CPACK_DEBIAN_PACKAGE_MAINTAINER ${CPACK_PACKAGE_CONTACT}) ENDIF(NOT CPACK_DEBIAN_PACKAGE_MAINTAINER) @@ -124,7 +243,7 @@ ENDIF(NOT CPACK_DEBIAN_PACKAGE_MAINTAINER) # Description: (mandatory) IF(NOT CPACK_DEBIAN_PACKAGE_DESCRIPTION) IF(NOT CPACK_PACKAGE_DESCRIPTION_SUMMARY) - MESSAGE(FATAL_ERROR "Debian package requires a summary for a package, set CPACK_PACKAGE_DESCRIPTION_SUMMARY or CPACK_DEBIAN_PACKAGE_DESCRIPTION") + MESSAGE(FATAL_ERROR "CPackDeb: Debian package requires a summary for a package, set CPACK_PACKAGE_DESCRIPTION_SUMMARY or CPACK_DEBIAN_PACKAGE_DESCRIPTION") ENDIF(NOT CPACK_PACKAGE_DESCRIPTION_SUMMARY) SET(CPACK_DEBIAN_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION_SUMMARY}) ENDIF(NOT CPACK_DEBIAN_PACKAGE_DESCRIPTION) @@ -147,13 +266,13 @@ ENDIF(NOT CPACK_DEBIAN_PACKAGE_PRIORITY ) # CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA # This variable allow advanced user to add custom script to the control.tar.gz (inside the .deb archive) -# Typical examples are: +# Typical examples are: # - conffiles # - postinst # - postrm # - prerm" # Usage: -# SET(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA +# SET(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA # "${CMAKE_CURRENT_SOURCE_DIR/prerm;${CMAKE_CURRENT_SOURCE_DIR}/postrm") diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake index 3bf8e0e..439ab4f 100644 --- a/Modules/CPackRPM.cmake +++ b/Modules/CPackRPM.cmake @@ -4,14 +4,14 @@ # used by CPack : http://www.cmake.org/Wiki/CMake:CPackConfiguration # # However CPackRPM has specific features which are controlled by -# the specifics CPACK_RPM_XXX variables. You'll find a detailed usage on -# the wiki: +# the specifics CPACK_RPM_XXX variables. You'll find a detailed usage on +# the wiki: # http://www.cmake.org/Wiki/CMake:CPackPackageGenerators#RPM_.28Unix_Only.29 # However as a handy reminder here comes the list of specific variables: # -# CPACK_RPM_PACKAGE_SUMMARY +# CPACK_RPM_PACKAGE_SUMMARY # Mandatory : YES -# Default : CPACK_PACKAGE_DESCRIPTION +# Default : CPACK_PACKAGE_DESCRIPTION_SUMMARY # The RPM package summary # CPACK_RPM_PACKAGE_NAME # Mandatory : YES @@ -24,14 +24,14 @@ # CPACK_RPM_PACKAGE_ARCHITECTURE # Mandatory : NO # Default : - -# The RPM package architecture. This may be set to "noarch" if you +# The RPM package architecture. This may be set to "noarch" if you # know you are building a noarch package. # CPACK_RPM_PACKAGE_RELEASE # Mandatory : YES # Default : 1 -# The RPM package release. This is the numbering of the RPM package -# itself, i.e. the version of the packaging and not the version of the -# content (see CPACK_RPM_PACKAGE_VERSION). One may change the default +# The RPM package release. This is the numbering of the RPM package +# itself, i.e. the version of the packaging and not the version of the +# content (see CPACK_RPM_PACKAGE_VERSION). One may change the default # value if the previous packaging was buggy and/or you want to put here # a fancy Linux distro specific numbering. # CPACK_RPM_PACKAGE_LICENSE @@ -42,10 +42,14 @@ # Mandatory : YES # Default : "unknown" # The RPM package group. -# CPACK_RPM_PACKAGE_VENDOR +# CPACK_RPM_PACKAGE_VENDOR # Mandatory : YES # Default : CPACK_PACKAGE_VENDOR if set or "unknown" -# The RPM package group. +# The RPM package vendor. +# CPACK_RPM_PACKAGE_URL +# Mandatory : NO +# Default : - +# The projects URL. # CPACK_RPM_PACKAGE_DESCRIPTION # Mandatory : YES # Default : CPACK_PACKAGE_DESCRIPTION_FILE if set or "no package description available" @@ -61,18 +65,39 @@ # Mandatory : NO # Default : - # May be used to set RPM dependencies (requires). -# Note that you must enclose the complete requires string between quotes, +# Note that you must enclose the complete requires string between quotes, # for example: # set(CPACK_RPM_PACKAGE_REQUIRES "python >= 2.5.0, cmake >= 2.8") -# CPACK_RPM_PACKAGES_PROVIDES +# CPACK_RPM_PACKAGE_SUGGESTS +# Mandatory : NO +# Default : - +# May be used to set weak RPM dependencies (suggests). +# Note that you must enclose the complete requires string between quotes. +# CPACK_RPM_PACKAGE_PROVIDES # Mandatory : NO # Default : - # May be used to set RPM dependencies (provides). +# CPACK_RPM_PACKAGE_OBSOLETES +# Mandatory : NO +# Default : - +# May be used to set RPM packages that are obsoleted by this one. +# CPACK_RPM_PACKAGE_RELOCATABLE +# Mandatory : NO +# Default : - +# If this variable is set to TRUE or ON CPackRPM will try +# to build a relocatable RPM package. A relocatable RPM may +# be installed using rpm --prefix or --relocate in order to +# install it at an alternate place see rpm(8). +# Note that currently this may fail if the package contains +# files installed with absolute path or CPACK_SET_DESTDIR is set to ON. +# If CPACK_SET_DESTDIR is set then you will get a warning message +# but if there is file installed with absolute path you'll get +# unexpected behavior. # CPACK_RPM_SPEC_INSTALL_POST # Mandatory : NO # Default : - -# May be used to set an RPM post-install command inside the spec file. -# For example setting it to "/bin/true" may be used to prevent +# May be used to set an RPM post-install command inside the spec file. +# For example setting it to "/bin/true" may be used to prevent # rpmbuild to strip binaries. # CPACK_RPM_SPEC_MORE_DEFINE # Mandatory : NO @@ -81,19 +106,19 @@ # CPACK_RPM_PACKAGE_DEBUG # Mandatory : NO # Default : - -# May be set when invoking cpack in order to trace debug informations -# during CPack RPM run. For example you may launch CPack like this +# May be set when invoking cpack in order to trace debug information +# during CPack RPM run. For example you may launch CPack like this # cpack -D CPACK_RPM_PACKAGE_DEBUG=1 -G RPM # CPACK_RPM_USER_BINARY_SPECFILE # Mandatory : NO -# Default : - +# Default : - # May be set by the user in order to specify a USER binary spec file # to be used by CPackRPM instead of generating the file. # The specified file will be processed by CONFIGURE_FILE( @ONLY). # CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE # Mandatory : NO # Default : - -# If set CPack will generate a template for USER specified binary +# If set CPack will generate a template for USER specified binary # spec file and stop with an error. For example launch CPack like this # cpack -D CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE=1 -G RPM # The user may then use this file in order to hand-craft is own @@ -116,6 +141,12 @@ # put after the %post or %postun section # One may verify which scriptlet has been included with # rpm -qp --scripts package.rpm +# CPACK_RPM_CHANGELOG_FILE +# Mandatory : NO +# Default : - +# May be used to embbed a changelog in the spec file. +# The refered file will be read and directly put after the %changelog +# section. #============================================================================= # Copyright 2007-2009 Kitware, Inc. @@ -127,7 +158,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # Author: Eric Noulard with the help of Alexander Neundorf. @@ -141,23 +172,23 @@ IF(NOT UNIX) ENDIF(NOT UNIX) # rpmbuild is the basic command for building RPM package -# it may be a simple (symbolic) link to rpmb command. +# it may be a simple (symbolic) link to rpm command. FIND_PROGRAM(RPMBUILD_EXECUTABLE rpmbuild) -# Check version of the rpmbuild tool this would be easier to +# Check version of the rpmbuild tool this would be easier to # track bugs with users and CPackRPM debug mode. -# We may use RPM version in order to check for available version dependent features +# We may use RPM version in order to check for available version dependent features IF(RPMBUILD_EXECUTABLE) execute_process(COMMAND ${RPMBUILD_EXECUTABLE} --version OUTPUT_VARIABLE _TMP_VERSION ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) - string(REGEX REPLACE "^.*\ " "" + string(REGEX REPLACE "^.*\ " "" RPMBUILD_EXECUTABLE_VERSION - ${_TMP_VERSION}) + ${_TMP_VERSION}) IF(CPACK_RPM_PACKAGE_DEBUG) MESSAGE("CPackRPM:Debug: rpmbuild version is <${RPMBUILD_EXECUTABLE_VERSION}>") - ENDIF(CPACK_RPM_PACKAGE_DEBUG) + ENDIF(CPACK_RPM_PACKAGE_DEBUG) ENDIF(RPMBUILD_EXECUTABLE) IF(NOT RPMBUILD_EXECUTABLE) @@ -165,14 +196,14 @@ IF(NOT RPMBUILD_EXECUTABLE) ENDIF(NOT RPMBUILD_EXECUTABLE) # We may use RPM version in the future in order -# to shut down warning about space in buildtree +# to shut down warning about space in buildtree # some recent RPM version should support space in different places. # not checked [yet]. IF(CPACK_TOPLEVEL_DIRECTORY MATCHES ".* .*") MESSAGE(FATAL_ERROR "${RPMBUILD_EXECUTABLE} can't handle paths with spaces, use a build directory without spaces for building RPMs.") ENDIF(CPACK_TOPLEVEL_DIRECTORY MATCHES ".* .*") -# If rpmbuild is found +# If rpmbuild is found # we try to discover alien since we may be on non RPM distro like Debian. # In this case we may try to to use more advanced features # like generating RPM directly from DEB using alien. @@ -182,7 +213,7 @@ IF(ALIEN_EXECUTABLE) MESSAGE(STATUS "alien found, we may be on a Debian based distro.") ENDIF(ALIEN_EXECUTABLE) -# +# # Use user-defined RPM specific variables value # or generate reasonable default value from # CPACK_xxx generic values. @@ -197,10 +228,10 @@ IF(NOT CPACK_RPM_PACKAGE_SUMMARY) IF(NOT CPACK_PACKAGE_DESCRIPTION_SUMMARY) STRING(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_RPM_PACKAGE_SUMMARY) ELSE(NOT CPACK_PACKAGE_DESCRIPTION_SUMMARY) - SET(CPACK_RPM_PACKAGE_SUMMARY ${CPACK_PACKAGE_DESCRIPTION_SUMMARY}) + SET(CPACK_RPM_PACKAGE_SUMMARY ${CPACK_PACKAGE_DESCRIPTION_SUMMARY}) ENDIF(NOT CPACK_PACKAGE_DESCRIPTION_SUMMARY) ENDIF(NOT CPACK_RPM_PACKAGE_SUMMARY) - + # CPACK_RPM_PACKAGE_NAME (mandatory) IF(NOT CPACK_RPM_PACKAGE_NAME) STRING(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_RPM_PACKAGE_NAME) @@ -213,6 +244,11 @@ IF(NOT CPACK_RPM_PACKAGE_VERSION) ENDIF(NOT CPACK_PACKAGE_VERSION) SET(CPACK_RPM_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION}) ENDIF(NOT CPACK_RPM_PACKAGE_VERSION) +# Replace '-' in version with '_' +# '-' character is an Illegal RPM version character +# it is illegal because it is used to separate +# RPM "Version" from RPM "Release" +STRING(REPLACE "-" "_" CPACK_RPM_PACKAGE_VERSION ${CPACK_RPM_PACKAGE_VERSION}) # CPACK_RPM_PACKAGE_ARCHITECTURE (optional) IF(CPACK_RPM_PACKAGE_ARCHITECTURE) @@ -260,7 +296,7 @@ ENDIF(NOT CPACK_RPM_PACKAGE_VENDOR) # CPACK_RPM_PACKAGE_DESCRIPTION # The variable content may be either -# - explicitely given by tthe user or +# - explicitly given by the user or # - filled with the content of CPACK_PACKAGE_DESCRIPTION_FILE # if it is defined # - set to a default value @@ -294,25 +330,33 @@ IF (CPACK_RPM_COMPRESSION_TYPE) ELSE(CPACK_RPM_COMPRESSION_TYPE) SET(CPACK_RPM_COMPRESSION_TYPE_TMP "") ENDIF(CPACK_RPM_COMPRESSION_TYPE) -# CPACK_RPM_PACKAGE_REQUIRES -# Placeholder used to specify binary RPM dependencies (if any) -# see http://www.rpm.org/max-rpm/s1-rpm-depend-manual-dependencies.html -IF(CPACK_RPM_PACKAGE_REQUIRES) - IF(CPACK_RPM_PACKAGE_DEBUG) - MESSAGE("CPackRPM:Debug: User defined Requires:\n ${CPACK_RPM_PACKAGE_REQUIRES}") - ENDIF(CPACK_RPM_PACKAGE_DEBUG) - SET(TMP_RPM_REQUIRES "Requires: ${CPACK_RPM_PACKAGE_REQUIRES}") -ENDIF(CPACK_RPM_PACKAGE_REQUIRES) -# CPACK_RPM_PACKAGE_PROVIDES -# Placeholder used to specify binary RPM dependencies (if any) -# see http://www.rpm.org/max-rpm/s1-rpm-depend-manual-dependencies.html -IF(CPACK_RPM_PACKAGE_PROVIDES) - IF(CPACK_RPM_PACKAGE_DEBUG) - MESSAGE("CPackRPM:Debug: User defined Provides:\n ${CPACK_RPM_PACKAGE_PROVIDES}") - ENDIF(CPACK_RPM_PACKAGE_DEBUG) - SET(TMP_RPM_PROVIDES "Provides: ${CPACK_RPM_PACKAGE_PROVIDES}") -ENDIF(CPACK_RPM_PACKAGE_PROVIDES) +if(CPACK_RPM_PACKAGE_RELOCATABLE) + if(CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: Trying to build a relocatable package") + endif(CPACK_RPM_PACKAGE_DEBUG) + if(CPACK_SET_DESTDIR) + message(SEND_ERROR "CPackRPM:Warning: CPACK_SET_DESTDIR is set while requesting a relocatable package (CPACK_RPM_PACKAGE_RELOCATABLE is set): this is not supported, the package won't be relocatable.") + else(CPACK_SET_DESTDIR) + set(CPACK_RPM_PACKAGE_PREFIX ${CPACK_PACKAGING_INSTALL_PREFIX}) + endif(CPACK_SET_DESTDIR) +endif(CPACK_RPM_PACKAGE_RELOCATABLE) + +# check if additional fields for RPM spec header are given +FOREACH(_RPM_SPEC_HEADER URL REQUIRES SUGGESTS PROVIDES OBSOLETES PREFIX) + IF(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}) + STRING(LENGTH ${_RPM_SPEC_HEADER} _PACKAGE_HEADER_STRLENGTH) + MATH(EXPR _PACKAGE_HEADER_STRLENGTH "${_PACKAGE_HEADER_STRLENGTH} - 1") + STRING(SUBSTRING ${_RPM_SPEC_HEADER} 1 ${_PACKAGE_HEADER_STRLENGTH} _PACKAGE_HEADER_TAIL) + STRING(TOLOWER "${_PACKAGE_HEADER_TAIL}" _PACKAGE_HEADER_TAIL) + STRING(SUBSTRING ${_RPM_SPEC_HEADER} 0 1 _PACKAGE_HEADER_NAME) + SET(_PACKAGE_HEADER_NAME "${_PACKAGE_HEADER_NAME}${_PACKAGE_HEADER_TAIL}") + IF(CPACK_RPM_PACKAGE_DEBUG) + MESSAGE("CPackRPM:Debug: User defined ${_PACKAGE_HEADER_NAME}:\n ${CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}}") + ENDIF(CPACK_RPM_PACKAGE_DEBUG) + SET(TMP_RPM_${_RPM_SPEC_HEADER} "${_PACKAGE_HEADER_NAME}: ${CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}}") + ENDIF(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}) +ENDFOREACH(_RPM_SPEC_HEADER) # CPACK_RPM_SPEC_INSTALL_POST # May be used to define a RPM post intallation script @@ -348,7 +392,7 @@ endif(CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE) # CPACK_RPM_PRE_INSTALL_SCRIPT_FILE # CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE -# May be used to embbed a pre (un)installation script in the spec file. +# May be used to embed a pre (un)installation script in the spec file. # The refered script file(s) will be read and directly # put after the %pre or %preun section if(CPACK_RPM_PRE_INSTALL_SCRIPT_FILE) @@ -367,6 +411,19 @@ if(CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE) endif(EXISTS ${CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE}) endif(CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE) +# CPACK_RPM_CHANGELOG_FILE +# May be used to embed a changelog in the spec file. +# The refered file will be read and directly put after the %changelog section +if(CPACK_RPM_CHANGELOG_FILE) + if(EXISTS ${CPACK_RPM_CHANGELOG_FILE}) + file(READ ${CPACK_RPM_CHANGELOG_FILE} CPACK_RPM_SPEC_CHANGELOG) + else(EXISTS ${CPACK_RPM_CHANGELOG_FILE}) + message(SEND_ERROR "CPackRPM:Warning: CPACK_RPM_CHANGELOG_FILE <${CPACK_RPM_CHANGELOG_FILE}> does not exists - ignoring") + endif(EXISTS ${CPACK_RPM_CHANGELOG_FILE}) +else(CPACK_RPM_CHANGELOG_FILE) + set(CPACK_RPM_SPEC_CHANGELOG "* Sun Jul 4 2010 Erk <eric.noulard@gmail.com>\n Generated by CPack RPM (no Changelog file were provided)") +endif(CPACK_RPM_CHANGELOG_FILE) + # CPACK_RPM_SPEC_MORE_DEFINE # This is a generated spec rpm file spaceholder IF(CPACK_RPM_SPEC_MORE_DEFINE) @@ -396,18 +453,19 @@ SET(CPACK_RPM_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}") # Use files tree to construct files command (spec file) # We should not forget to include symlinks (thus -o -type l) -# We must remove the './' due to the local search (thus the sed) +# We must remove the './' due to the local search and escape the +# file name by enclosing it between double quotes (thus the sed) # Then we must authorize any man pages extension (adding * at the end) # because rpmbuild may automatically compress those files EXECUTE_PROCESS(COMMAND find -type f -o -type l - COMMAND sed {s/\\.//} - COMMAND sed {s/.*man.*\\/.*/&*/} + COMMAND sed {s:.*/man.*/.*:&*:} + COMMAND sed {s/\\.\\\(.*\\\)/\"\\1\"/} WORKING_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}" OUTPUT_VARIABLE CPACK_RPM_INSTALL_FILES) # The name of the final spec file to be used by rpmbuild SET(CPACK_RPM_BINARY_SPECFILE "${CPACK_RPM_ROOTDIR}/SPECS/${CPACK_RPM_PACKAGE_NAME}.spec") - + # Print out some debug information if we were asked for that IF(CPACK_RPM_PACKAGE_DEBUG) MESSAGE("CPackRPM:Debug: CPACK_TOPLEVEL_DIRECTORY = ${CPACK_TOPLEVEL_DIRECTORY}") @@ -420,7 +478,7 @@ IF(CPACK_RPM_PACKAGE_DEBUG) MESSAGE("CPackRPM:Debug: CPACK_PACKAGE_INSTALL_DIRECTORY = ${CPACK_PACKAGE_INSTALL_DIRECTORY}") MESSAGE("CPackRPM:Debug: CPACK_TEMPORARY_PACKAGE_FILE_NAME = ${CPACK_TEMPORARY_PACKAGE_FILE_NAME}") ENDIF(CPACK_RPM_PACKAGE_DEBUG) - + # USER generated spec file handling. # We should generate a spec file template: # - either because the user asked for it : CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE @@ -429,7 +487,7 @@ ENDIF(CPACK_RPM_PACKAGE_DEBUG) IF(CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE OR NOT CPACK_RPM_USER_BINARY_SPECFILE) FILE(WRITE ${CPACK_RPM_BINARY_SPECFILE}.in "# -*- rpm-spec -*- -Buildroot: \@CPACK_RPM_DIRECTORY\@/\@CPACK_PACKAGE_FILE_NAME\@ +BuildRoot: \@CPACK_RPM_DIRECTORY\@/\@CPACK_PACKAGE_FILE_NAME\@ Summary: \@CPACK_RPM_PACKAGE_SUMMARY\@ Name: \@CPACK_RPM_PACKAGE_NAME\@ Version: \@CPACK_RPM_PACKAGE_VERSION\@ @@ -437,11 +495,13 @@ Release: \@CPACK_RPM_PACKAGE_RELEASE\@ License: \@CPACK_RPM_PACKAGE_LICENSE\@ Group: \@CPACK_RPM_PACKAGE_GROUP\@ Vendor: \@CPACK_RPM_PACKAGE_VENDOR\@ +\@TMP_RPM_URL\@ \@TMP_RPM_REQUIRES\@ \@TMP_RPM_PROVIDES\@ +\@TMP_RPM_OBSOLETES\@ \@TMP_RPM_BUILDARCH\@ - -#p define prefix \@CMAKE_INSTALL_PREFIX\@ +\@TMP_RPM_PREFIX\@ + %define _rpmdir \@CPACK_RPM_DIRECTORY\@ %define _rpmfilename \@CPACK_RPM_FILE_NAME\@ %define _unpackaged_files_terminate_build 0 @@ -449,7 +509,7 @@ Vendor: \@CPACK_RPM_PACKAGE_VENDOR\@ \@TMP_RPM_SPEC_INSTALL_POST\@ \@CPACK_RPM_SPEC_MORE_DEFINE\@ \@CPACK_RPM_COMPRESSION_TYPE_TMP\@ - + %description \@CPACK_RPM_PACKAGE_DESCRIPTION\@ @@ -461,14 +521,14 @@ Vendor: \@CPACK_RPM_PACKAGE_VENDOR\@ mv $RPM_BUILD_ROOT \@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot #p build - + %install if [ -e $RPM_BUILD_ROOT ]; then - mv \@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot/* $RPM_BUILD_ROOT + mv \@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot/* $RPM_BUILD_ROOT else - mv \@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot $RPM_BUILD_ROOT -fi + mv \@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot $RPM_BUILD_ROOT +fi %clean @@ -489,61 +549,39 @@ fi ${CPACK_RPM_INSTALL_FILES} %changelog -* Sun Apr 4 2010 Erk <eric.noulard@gmail.com> - Add support for specifying RPM compression type -* Sat Nov 28 2009 Erk <eric.noulard@gmail.com> - Refix backup/restore install tree for OpenSuSE 11.2 -* Sun Nov 22 2009 Erk <eric.noulard@gmail.com> - Include symlinks in the file list. -* Sat Nov 14 2009 Erk <eric.noulard@gmail.com> - Replace prep and build step with backup and restore - of the previously CPack installed tree. This should - mimic what is expected in rpmbuild usual steps -* Wed Nov 11 2009 Erk <eric.noulard@gmail.com> - Add support for USER defined pre/post[un]install scripts -* Wed Oct 07 2009 Erk <eric.noulard@gmail.com> - Add user custom spec file support -* Sat Oct 03 2009 Kami <cmoidavid@gmail.com> - Update to handle more precisely the files section -* Mon Oct 03 2008 Erk <eric.noulard@gmail.com> - Update generator to handle optional dependencies using Requires - Update DEBUG output typos. -* Mon Aug 25 2008 Erk <eric.noulard@gmail.com> - Update generator to handle optional post-install -* Tue Aug 16 2007 Erk <eric.noulard@gmail.com> - Generated by CPack RPM Generator and associated macros +\@CPACK_RPM_SPEC_CHANGELOG\@ ") # Stop here if we were asked to only generate a template USER spec file # The generated file may then be used as a template by user who wants - # to customize their own spec file. + # to customize their own spec file. IF(CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE) MESSAGE(FATAL_ERROR "CPackRPM: STOP here Generated USER binary spec file templare is: ${CPACK_RPM_BINARY_SPECFILE}.in") ENDIF(CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE) ENDIF(CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE OR NOT CPACK_RPM_USER_BINARY_SPECFILE) # After that we may either use a user provided spec file -# or generate one using appropriate variables value. +# or generate one using appropriate variables value. IF(CPACK_RPM_USER_BINARY_SPECFILE) # User may have specified SPECFILE just use it MESSAGE("CPackRPM: Will use USER specified spec file: ${CPACK_RPM_USER_BINARY_SPECFILE}") # The user provided file is processed for @var replacement CONFIGURE_FILE(${CPACK_RPM_USER_BINARY_SPECFILE} ${CPACK_RPM_BINARY_SPECFILE} @ONLY) ELSE(CPACK_RPM_USER_BINARY_SPECFILE) - # No User specified spec file, will use the generated spec file - MESSAGE("CPackRPM: Will use GENERATED spec file: ${CPACK_RPM_BINARY_SPECFILE}") - # Note the just created file is processed for @var replacement + # No User specified spec file, will use the generated spec file + MESSAGE("CPackRPM: Will use GENERATED spec file: ${CPACK_RPM_BINARY_SPECFILE}") + # Note the just created file is processed for @var replacement CONFIGURE_FILE(${CPACK_RPM_BINARY_SPECFILE}.in ${CPACK_RPM_BINARY_SPECFILE} @ONLY) ENDIF(CPACK_RPM_USER_BINARY_SPECFILE) IF(RPMBUILD_EXECUTABLE) # Now call rpmbuild using the SPECFILE EXECUTE_PROCESS( - COMMAND "${RPMBUILD_EXECUTABLE}" -bb - --buildroot "${CPACK_RPM_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}" + COMMAND "${RPMBUILD_EXECUTABLE}" -bb + --buildroot "${CPACK_RPM_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}" "${CPACK_RPM_BINARY_SPECFILE}" WORKING_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}" ERROR_FILE "${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild.err" - OUTPUT_FILE "${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild.out") + OUTPUT_FILE "${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild.out") IF(CPACK_RPM_PACKAGE_DEBUG) MESSAGE("CPackRPM:Debug: You may consult rpmbuild logs in: ") MESSAGE("CPackRPM:Debug: - ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild.err") diff --git a/Modules/CPackZIP.cmake b/Modules/CPackZIP.cmake index b73bdf1..99963cf 100644 --- a/Modules/CPackZIP.cmake +++ b/Modules/CPackZIP.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) IF(CMAKE_BINARY_DIR) diff --git a/Modules/CTest.cmake b/Modules/CTest.cmake index 2d0702e..e3157fa 100644 --- a/Modules/CTest.cmake +++ b/Modules/CTest.cmake @@ -55,7 +55,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) OPTION(BUILD_TESTING "Build the testing tree." ON) @@ -163,6 +163,11 @@ IF(BUILD_TESTING) SET(DART_TESTING_TIMEOUT 1500 CACHE STRING "Maximum time allowed before CTest will kill the test.") + SET(CTEST_SUBMIT_RETRY_DELAY 5 CACHE STRING + "How long to wait between timed-out CTest submissions.") + SET(CTEST_SUBMIT_RETRY_COUNT 3 CACHE STRING + "How many times to retry timed-out CTest submissions.") + FIND_PROGRAM(MEMORYCHECK_COMMAND NAMES purify valgrind boundscheck PATHS @@ -262,7 +267,9 @@ IF(BUILD_TESTING) SCPCOMMAND SLURM_SBATCH_COMMAND SLURM_SRUN_COMMAND - SITE + SITE + CTEST_SUBMIT_RETRY_DELAY + CTEST_SUBMIT_RETRY_COUNT ) # BUILDNAME IF(NOT RUN_FROM_DART) diff --git a/Modules/CTestScriptMode.cmake b/Modules/CTestScriptMode.cmake index 4a93d23..e459c1d 100644 --- a/Modules/CTestScriptMode.cmake +++ b/Modules/CTestScriptMode.cmake @@ -11,7 +11,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # Determine the current system, so this information can be used diff --git a/Modules/CTestTargets.cmake b/Modules/CTestTargets.cmake index fc47ff8..835328c 100644 --- a/Modules/CTestTargets.cmake +++ b/Modules/CTestTargets.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) IF(NOT RUN_FROM_CTEST_OR_DART) diff --git a/Modules/CheckCCompilerFlag.cmake b/Modules/CheckCCompilerFlag.cmake index d5d8db9..0068617 100644 --- a/Modules/CheckCCompilerFlag.cmake +++ b/Modules/CheckCCompilerFlag.cmake @@ -17,7 +17,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) INCLUDE(CheckCSourceCompiles) diff --git a/Modules/CheckCSourceCompiles.cmake b/Modules/CheckCSourceCompiles.cmake index b2768c2..e8bfc0c 100644 --- a/Modules/CheckCSourceCompiles.cmake +++ b/Modules/CheckCSourceCompiles.cmake @@ -21,7 +21,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) MACRO(CHECK_C_SOURCE_COMPILES SOURCE VAR) diff --git a/Modules/CheckCSourceRuns.cmake b/Modules/CheckCSourceRuns.cmake index 50cd028..764c756 100644 --- a/Modules/CheckCSourceRuns.cmake +++ b/Modules/CheckCSourceRuns.cmake @@ -21,7 +21,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) MACRO(CHECK_C_SOURCE_RUNS SOURCE VAR) diff --git a/Modules/CheckCXXCompilerFlag.cmake b/Modules/CheckCXXCompilerFlag.cmake index 5d22ee5..d8e4715 100644 --- a/Modules/CheckCXXCompilerFlag.cmake +++ b/Modules/CheckCXXCompilerFlag.cmake @@ -17,7 +17,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) INCLUDE(CheckCXXSourceCompiles) diff --git a/Modules/CheckCXXSourceCompiles.cmake b/Modules/CheckCXXSourceCompiles.cmake index 5f16607..4502c6b 100644 --- a/Modules/CheckCXXSourceCompiles.cmake +++ b/Modules/CheckCXXSourceCompiles.cmake @@ -21,7 +21,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) MACRO(CHECK_CXX_SOURCE_COMPILES SOURCE VAR) diff --git a/Modules/CheckCXXSourceRuns.cmake b/Modules/CheckCXXSourceRuns.cmake index 3a3dafa..ace60d1 100644 --- a/Modules/CheckCXXSourceRuns.cmake +++ b/Modules/CheckCXXSourceRuns.cmake @@ -21,7 +21,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) MACRO(CHECK_CXX_SOURCE_RUNS SOURCE VAR) diff --git a/Modules/CheckFortranFunctionExists.cmake b/Modules/CheckFortranFunctionExists.cmake index 0e0f217..6e932d0 100644 --- a/Modules/CheckFortranFunctionExists.cmake +++ b/Modules/CheckFortranFunctionExists.cmake @@ -19,7 +19,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) macro(CHECK_FORTRAN_FUNCTION_EXISTS FUNCTION VARIABLE) diff --git a/Modules/CheckFunctionExists.cmake b/Modules/CheckFunctionExists.cmake index e8fd85d..e1a1777 100644 --- a/Modules/CheckFunctionExists.cmake +++ b/Modules/CheckFunctionExists.cmake @@ -22,7 +22,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) MACRO(CHECK_FUNCTION_EXISTS FUNCTION VARIABLE) diff --git a/Modules/CheckIncludeFile.cmake b/Modules/CheckIncludeFile.cmake index d1ea76a..eb732d2 100644 --- a/Modules/CheckIncludeFile.cmake +++ b/Modules/CheckIncludeFile.cmake @@ -25,7 +25,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) MACRO(CHECK_INCLUDE_FILE INCLUDE VARIABLE) diff --git a/Modules/CheckIncludeFileCXX.cmake b/Modules/CheckIncludeFileCXX.cmake index b1ac62a..c5d8f9a 100644 --- a/Modules/CheckIncludeFileCXX.cmake +++ b/Modules/CheckIncludeFileCXX.cmake @@ -25,7 +25,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) MACRO(CHECK_INCLUDE_FILE_CXX INCLUDE VARIABLE) diff --git a/Modules/CheckIncludeFiles.cmake b/Modules/CheckIncludeFiles.cmake index 21e97dc..75b5ca1 100644 --- a/Modules/CheckIncludeFiles.cmake +++ b/Modules/CheckIncludeFiles.cmake @@ -22,7 +22,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) MACRO(CHECK_INCLUDE_FILES INCLUDE VARIABLE) diff --git a/Modules/CheckLibraryExists.cmake b/Modules/CheckLibraryExists.cmake index 64f6455..caf4f4c 100644 --- a/Modules/CheckLibraryExists.cmake +++ b/Modules/CheckLibraryExists.cmake @@ -23,7 +23,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) MACRO(CHECK_LIBRARY_EXISTS LIBRARY FUNCTION LOCATION VARIABLE) diff --git a/Modules/CheckSizeOf.cmake b/Modules/CheckSizeOf.cmake index 0663ce4..f6d6636 100644 --- a/Modules/CheckSizeOf.cmake +++ b/Modules/CheckSizeOf.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) MESSAGE(SEND_ERROR diff --git a/Modules/CheckStructHasMember.cmake b/Modules/CheckStructHasMember.cmake index 32abe73..18e80e3 100644 --- a/Modules/CheckStructHasMember.cmake +++ b/Modules/CheckStructHasMember.cmake @@ -25,7 +25,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) INCLUDE(CheckCSourceCompiles) diff --git a/Modules/CheckSymbolExists.cmake b/Modules/CheckSymbolExists.cmake index d48b65f..40910f2 100644 --- a/Modules/CheckSymbolExists.cmake +++ b/Modules/CheckSymbolExists.cmake @@ -23,7 +23,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) MACRO(CHECK_SYMBOL_EXISTS SYMBOL FILES VARIABLE) diff --git a/Modules/CheckTypeSize.cmake b/Modules/CheckTypeSize.cmake index 6f4b437..5d5c931 100644 --- a/Modules/CheckTypeSize.cmake +++ b/Modules/CheckTypeSize.cmake @@ -43,7 +43,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) include(CheckIncludeFile) diff --git a/Modules/CheckVariableExists.cmake b/Modules/CheckVariableExists.cmake index 13104e5..9832891 100644 --- a/Modules/CheckVariableExists.cmake +++ b/Modules/CheckVariableExists.cmake @@ -23,7 +23,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) MACRO(CHECK_VARIABLE_EXISTS VAR VARIABLE) diff --git a/Modules/Compiler/Clang-C.cmake b/Modules/Compiler/Clang-C.cmake new file mode 100644 index 0000000..f7baf68 --- /dev/null +++ b/Modules/Compiler/Clang-C.cmake @@ -0,0 +1 @@ +include(Compiler/GNU-C) diff --git a/Modules/Compiler/Clang-CXX.cmake b/Modules/Compiler/Clang-CXX.cmake new file mode 100644 index 0000000..d3c403a --- /dev/null +++ b/Modules/Compiler/Clang-CXX.cmake @@ -0,0 +1 @@ +include(Compiler/GNU-CXX) diff --git a/Modules/Compiler/GNU.cmake b/Modules/Compiler/GNU.cmake index 63652b6..0bb31f9 100644 --- a/Modules/Compiler/GNU.cmake +++ b/Modules/Compiler/GNU.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # This module is shared by multiple languages; use include blocker. diff --git a/Modules/Compiler/PGI.cmake b/Modules/Compiler/PGI.cmake index c6960fc..162e3c9 100644 --- a/Modules/Compiler/PGI.cmake +++ b/Modules/Compiler/PGI.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # This module is shared by multiple languages; use include blocker. diff --git a/Modules/Compiler/PathScale.cmake b/Modules/Compiler/PathScale.cmake index a53112b..107f779 100644 --- a/Modules/Compiler/PathScale.cmake +++ b/Modules/Compiler/PathScale.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # This module is shared by multiple languages; use include blocker. diff --git a/Modules/Dart.cmake b/Modules/Dart.cmake index f125ceb..8705454 100644 --- a/Modules/Dart.cmake +++ b/Modules/Dart.cmake @@ -29,7 +29,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) OPTION(BUILD_TESTING "Build the testing tree." ON) diff --git a/Modules/DartConfiguration.tcl.in b/Modules/DartConfiguration.tcl.in index 85b4138..caf0afe 100644 --- a/Modules/DartConfiguration.tcl.in +++ b/Modules/DartConfiguration.tcl.in @@ -49,6 +49,7 @@ SVNUpdateOptions: @SVN_UPDATE_OPTIONS@ # Git options GITCommand: @GITCOMMAND@ GITUpdateOptions: @GIT_UPDATE_OPTIONS@ +GITUpdateCustom: @CTEST_GIT_UPDATE_CUSTOM@ # Generic update command UpdateCommand: @UPDATE_COMMAND@ @@ -83,3 +84,7 @@ CurlOptions: @CTEST_CURL_OPTIONS@ # warning, if you add new options here that have to do with submit, # you have to update cmCTestSubmitCommand.cxx +# For CTest submissions that timeout, these options +# specify behavior for retrying the submission +CTestSubmitRetryDelay: @CTEST_SUBMIT_RETRY_DELAY@ +CTestSubmitRetryCount: @CTEST_SUBMIT_RETRY_COUNT@ diff --git a/Modules/Documentation.cmake b/Modules/Documentation.cmake index ddb19ca..ffeb371 100644 --- a/Modules/Documentation.cmake +++ b/Modules/Documentation.cmake @@ -12,7 +12,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index 0302d5c..d76796f 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -16,7 +16,12 @@ # [CVS_TAG tag] # Tag to checkout from CVS repo # [SVN_REPOSITORY url] # URL of Subversion repo # [SVN_REVISION rev] # Revision to checkout from Subversion repo +# [SVN_USERNAME john ] # Username for Subversion checkout and update +# [SVN_PASSWORD doe ] # Password for Subversion checkout and update +# [GIT_REPOSITORY url] # URL of git repo +# [GIT_TAG tag] # Git branch name, commit id or tag # [URL /.../src.tgz] # Full path or URL of source +# [URL_MD5 md5] # MD5 checksum of file at URL # [TIMEOUT seconds] # Time allowed for file download operations # #--Update/Patch step---------- # [UPDATE_COMMAND cmd...] # Source work-tree update command @@ -34,10 +39,19 @@ # #--Install step--------------- # [INSTALL_DIR dir] # Installation prefix # [INSTALL_COMMAND cmd...] # Command to drive install after build -# #--Test step--------------- +# #--Test step------------------ # [TEST_BEFORE_INSTALL 1] # Add test step executed before install step # [TEST_AFTER_INSTALL 1] # Add test step executed after install step # [TEST_COMMAND cmd...] # Command to drive test +# #--Output logging------------- +# [LOG_DOWNLOAD 1] # Wrap download in script to log output +# [LOG_UPDATE 1] # Wrap update in script to log output +# [LOG_CONFIGURE 1] # Wrap configure in script to log output +# [LOG_BUILD 1] # Wrap build in script to log output +# [LOG_TEST 1] # Wrap test in script to log output +# [LOG_INSTALL 1] # Wrap install in script to log output +# #--Custom targets------------- +# [STEP_TARGETS st1 st2 ...] # Generate custom targets for these steps # ) # The *_DIR options specify directories for the project, with default # directories computed as follows. @@ -81,6 +95,7 @@ # [DEPENDS files...] # Files on which this step depends # [ALWAYS 1] # No stamp file, step always runs # [WORKING_DIRECTORY dir] # Working directory for command +# [LOG 1] # Wrap step in script to log output # ) # The command line, comment, and working directory of every standard # and custom step is processed to replace tokens @@ -96,6 +111,35 @@ # It stores property values in variables of the same name. # Property names correspond to the keyword argument names of # 'ExternalProject_Add'. +# +# The 'ExternalProject_Add_StepTargets' function generates custom targets for +# the steps listed: +# ExternalProject_Add_StepTargets(<name> [step1 [step2 [...]]]) +# +# If STEP_TARGETS is set then ExternalProject_Add_StepTargets is automatically +# called at the end of matching calls to ExternalProject_Add_Step. Pass +# STEP_TARGETS explicitly to individual ExternalProject_Add calls, or +# implicitly to all ExternalProject_Add calls by setting the directory property +# EP_STEP_TARGETS. +# +# If STEP_TARGETS is not set, clients may still manually call +# ExternalProject_Add_StepTargets after calling ExternalProject_Add or +# ExternalProject_Add_Step. +# +# This functionality is provided to make it easy to drive the steps +# independently of each other by specifying targets on build command lines. +# For example, you may be submitting to a sub-project based dashboard, where +# you want to drive the configure portion of the build, then submit to the +# dashboard, followed by the build portion, followed by tests. If you invoke +# a custom target that depends on a step halfway through the step dependency +# chain, then all the previous steps will also run to ensure everything is +# up to date. +# +# For example, to drive configure, build and test steps independently for each +# ExternalProject_Add call in your project, write the following line prior to +# any ExternalProject_Add calls in your CMakeLists file: +# +# set_property(DIRECTORY PROPERTY EP_STEP_TARGETS configure build test) #============================================================================= # Copyright 2008-2009 Kitware, Inc. @@ -107,23 +151,25 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # Pre-compute a regex to match documented keywords for each command. -file(STRINGS "${CMAKE_CURRENT_LIST_FILE}" lines LIMIT_COUNT 100 - REGEX "^# ( \\[[A-Z_]+ [^]]*\\] +#.*$|[A-Za-z_]+\\()") +math(EXPR _ep_documentation_line_count "${CMAKE_CURRENT_LIST_LINE} - 16") +file(STRINGS "${CMAKE_CURRENT_LIST_FILE}" lines + LIMIT_COUNT ${_ep_documentation_line_count} + REGEX "^# ( \\[[A-Z0-9_]+ [^]]*\\] +#.*$|[A-Za-z0-9_]+\\()") foreach(line IN LISTS lines) - if("${line}" MATCHES "^# [A-Za-z_]+\\(") + if("${line}" MATCHES "^# [A-Za-z0-9_]+\\(") if(_ep_func) set(_ep_keywords_${_ep_func} "${_ep_keywords_${_ep_func}})$") endif() - string(REGEX REPLACE "^# ([A-Za-z_]+)\\(.*" "\\1" _ep_func "${line}") + string(REGEX REPLACE "^# ([A-Za-z0-9_]+)\\(.*" "\\1" _ep_func "${line}") #message("function [${_ep_func}]") set(_ep_keywords_${_ep_func} "^(") set(_ep_keyword_sep) else() - string(REGEX REPLACE "^# \\[([A-Z_]+) .*" "\\1" _ep_key "${line}") + string(REGEX REPLACE "^# \\[([A-Z0-9_]+) .*" "\\1" _ep_key "${line}") #message(" keyword [${_ep_key}]") set(_ep_keywords_${_ep_func} "${_ep_keywords_${_ep_func}}${_ep_keyword_sep}${_ep_key}") @@ -141,25 +187,18 @@ function(_ep_parse_arguments f name ns args) # correctly based on target properties. # # We loop through ARGN and consider the namespace starting with an - # upper-case letter followed by at least two more upper-case letters - # or underscores to be keywords. + # upper-case letter followed by at least two more upper-case letters, + # numbers or underscores to be keywords. set(key) foreach(arg IN LISTS args) set(is_value 1) - if(arg MATCHES "^[A-Z][A-Z_][A-Z_]+$" AND + if(arg MATCHES "^[A-Z][A-Z0-9_][A-Z0-9_]+$" AND NOT ((arg STREQUAL "${key}") AND (key STREQUAL "COMMAND")) AND NOT arg MATCHES "^(TRUE|FALSE)$") if(_ep_keywords_${f} AND arg MATCHES "${_ep_keywords_${f}}") set(is_value 0) - else() - if(NOT (key STREQUAL "COMMAND") - AND NOT (key STREQUAL "CVS_MODULE") - AND NOT (key STREQUAL "DEPENDS") - ) - message(AUTHOR_WARNING "unknown ${f} keyword: ${arg}") - endif() endif() endif() @@ -202,8 +241,72 @@ define_property(DIRECTORY PROPERTY "EP_PREFIX" INHERITED "ExternalProject module." ) +define_property(DIRECTORY PROPERTY "EP_STEP_TARGETS" INHERITED + BRIEF_DOCS + "List of ExternalProject steps that automatically get corresponding targets" + FULL_DOCS + "See documentation of the ExternalProject_Add_StepTargets() function in the " + "ExternalProject module." + ) + + +function(_ep_write_gitclone_script script_filename source_dir git_EXECUTABLE git_repository git_tag src_name work_dir) + file(WRITE ${script_filename} +"if(\"${git_tag}\" STREQUAL \"\") + message(FATAL_ERROR \"Tag for git checkout should not be empty.\") +endif() + +execute_process( + COMMAND \${CMAKE_COMMAND} -E remove_directory \"${source_dir}\" + RESULT_VARIABLE error_code + ) +if(error_code) + message(FATAL_ERROR \"Failed to remove directory: '${source_dir}'\") +endif() + +execute_process( + COMMAND \"${git_EXECUTABLE}\" clone \"${git_repository}\" \"${src_name}\" + WORKING_DIRECTORY \"${work_dir}\" + RESULT_VARIABLE error_code + ) +if(error_code) + message(FATAL_ERROR \"Failed to clone repository: '${git_repository}'\") +endif() + +execute_process( + COMMAND \"${git_EXECUTABLE}\" checkout ${git_tag} + WORKING_DIRECTORY \"${work_dir}/${src_name}\" + RESULT_VARIABLE error_code + ) +if(error_code) + message(FATAL_ERROR \"Failed to checkout tag: '${git_tag}'\") +endif() + +execute_process( + COMMAND \"${git_EXECUTABLE}\" submodule init + WORKING_DIRECTORY \"${work_dir}/${src_name}\" + RESULT_VARIABLE error_code + ) +if(error_code) + message(FATAL_ERROR \"Failed to init submodules in: '${work_dir}/${src_name}'\") +endif() + +execute_process( + COMMAND \"${git_EXECUTABLE}\" submodule update --recursive + WORKING_DIRECTORY \"${work_dir}/${src_name}\" + RESULT_VARIABLE error_code + ) +if(error_code) + message(FATAL_ERROR \"Failed to update submodules in: '${work_dir}/${src_name}'\") +endif() -function(_ep_write_downloadfile_script script_filename remote local timeout) +" +) + +endfunction(_ep_write_gitclone_script) + + +function(_ep_write_downloadfile_script script_filename remote local timeout md5) if(timeout) set(timeout_args TIMEOUT ${timeout}) set(timeout_msg "${timeout} seconds") @@ -212,6 +315,12 @@ function(_ep_write_downloadfile_script script_filename remote local timeout) set(timeout_msg "none") endif() + if(md5) + set(md5_args EXPECTED_MD5 ${md5}) + else() + set(md5_args "# no EXPECTED_MD5") + endif() + file(WRITE ${script_filename} "message(STATUS \"downloading... src='${remote}' @@ -221,6 +330,8 @@ function(_ep_write_downloadfile_script script_filename remote local timeout) file(DOWNLOAD \"${remote}\" \"${local}\" + SHOW_PROGRESS + ${md5_args} ${timeout_args} STATUS status LOG log) @@ -243,23 +354,64 @@ message(STATUS \"downloading... done\") endfunction(_ep_write_downloadfile_script) -function(_ep_write_extractfile_script script_filename filename tmp directory) - set(args "") +function(_ep_write_verifyfile_script script_filename local md5) + file(WRITE ${script_filename} +"message(STATUS \"verifying file... + file='${local}'\") - if(filename MATCHES ".tar$") - set(args xf) +set(verified 0) + +# If an expected md5 checksum exists, compare against it: +# +if(NOT \"${md5}\" STREQUAL \"\") + execute_process(COMMAND \${CMAKE_COMMAND} -E md5sum \"${local}\" + OUTPUT_VARIABLE ov + OUTPUT_STRIP_TRAILING_WHITESPACE + RESULT_VARIABLE rv) + + if(NOT rv EQUAL 0) + message(FATAL_ERROR \"error: computing md5sum of '${local}' failed\") endif() - if(filename MATCHES ".tgz$") - set(args xfz) + string(REGEX MATCH \"^([0-9A-Fa-f]+)\" md5_actual \"\${ov}\") + + string(TOLOWER \"\${md5_actual}\" md5_actual) + string(TOLOWER \"${md5}\" md5) + + if(NOT \"\${md5}\" STREQUAL \"\${md5_actual}\") + message(FATAL_ERROR \"error: md5sum of '${local}' does not match expected value + md5_expected: \${md5} + md5_actual: \${md5_actual} +\") endif() - if(filename MATCHES ".tar.gz$") + set(verified 1) +endif() + +if(verified) + message(STATUS \"verifying file... done\") +else() + message(STATUS \"verifying file... warning: did not verify file - no URL_MD5 checksum argument? corrupt file?\") +endif() +" +) + +endfunction(_ep_write_verifyfile_script) + + +function(_ep_write_extractfile_script script_filename name filename directory) + set(args "") + + if(filename MATCHES "(\\.bz2|\\.tar\\.gz|\\.tgz|\\.zip)$") set(args xfz) endif() + if(filename MATCHES "\\.tar$") + set(args xf) + endif() + if(args STREQUAL "") - message(SEND_ERROR "error: do not know how to extract '${filename}' -- known types are .tar, .tgz and .tar.gz") + message(SEND_ERROR "error: do not know how to extract '${filename}' -- known types are .bz2, .tar, .tar.gz, .tgz and .zip") return() endif() @@ -267,20 +419,23 @@ function(_ep_write_extractfile_script script_filename filename tmp directory) "# Make file names absolute: # get_filename_component(filename \"${filename}\" ABSOLUTE) -get_filename_component(tmp \"${tmp}\" ABSOLUTE) get_filename_component(directory \"${directory}\" ABSOLUTE) message(STATUS \"extracting... src='\${filename}' dst='\${directory}'\") +if(NOT EXISTS \"\${filename}\") + message(FATAL_ERROR \"error: file to extract does not exist: '\${filename}'\") +endif() + # Prepare a space for extracting: # -set(i 1) -while(EXISTS \"\${tmp}/extract\${i}\") +set(i 1234) +while(EXISTS \"\${directory}/../ex-${name}\${i}\") math(EXPR i \"\${i} + 1\") endwhile() -set(ut_dir \"\${tmp}/extract\${i}\") +set(ut_dir \"\${directory}/../ex-${name}\${i}\") file(MAKE_DIRECTORY \"\${ut_dir}\") # Extract it: @@ -305,10 +460,12 @@ if(NOT n EQUAL 1 OR NOT IS_DIRECTORY \"\${contents}\") set(contents \"\${ut_dir}\") endif() -# Copy \"the one\" directory to the final directory: +# Move \"the one\" directory to the final directory: # -message(STATUS \"extracting... [copy]\") -file(COPY \"\${contents}/\" DESTINATION \${directory}) +message(STATUS \"extracting... [rename]\") +file(REMOVE_RECURSE \${directory}) +get_filename_component(contents \${contents} ABSOLUTE) +file(RENAME \${contents} \${directory}) # Clean up: # @@ -439,8 +596,9 @@ function(_ep_get_build_command name step cmd_var) if(cfg_cmd_id STREQUAL "cmake") # CMake project. Select build command based on generator. get_target_property(cmake_generator ${name} _EP_CMAKE_GENERATOR) - if("${cmake_generator}" MATCHES "Make" AND - "${cmake_generator}" STREQUAL "${CMAKE_GENERATOR}") + if("${CMAKE_GENERATOR}" MATCHES "Make" AND + ("${cmake_generator}" STREQUAL "${CMAKE_GENERATOR}" OR + NOT cmake_generator)) # The project uses the same Makefile generator. Use recursive make. set(cmd "$(MAKE)") if(step STREQUAL "INSTALL") @@ -469,7 +627,8 @@ function(_ep_get_build_command name step cmd_var) endif() else() # if(cfg_cmd_id STREQUAL "configure") # Non-CMake project. Guess "make" and "make install" and "make test". - set(cmd "make") + # But use "$(MAKE)" to get recursive parallel make. + set(cmd "$(MAKE)") if(step STREQUAL "INSTALL") set(args install) endif() @@ -490,6 +649,101 @@ function(_ep_get_build_command name step cmd_var) set(${cmd_var} "${cmd}" PARENT_SCOPE) endfunction(_ep_get_build_command) +function(_ep_write_log_script name step cmd_var) + ExternalProject_Get_Property(${name} stamp_dir) + set(command "${${cmd_var}}") + + set(make "") + set(code_cygpath_make "") + if("${command}" MATCHES "^\\$\\(MAKE\\)") + # GNU make recognizes the string "$(MAKE)" as recursive make, so + # ensure that it appears directly in the makefile. + string(REGEX REPLACE "^\\$\\(MAKE\\)" "\${make}" command "${command}") + set(make "-Dmake=$(MAKE)") + + if(WIN32 AND NOT CYGWIN) + set(code_cygpath_make " +if(\${make} MATCHES \"^/\") + execute_process( + COMMAND cygpath -w \${make} + OUTPUT_VARIABLE cygpath_make + ERROR_VARIABLE cygpath_make + RESULT_VARIABLE cygpath_error + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + if(NOT cygpath_error) + set(make \${cygpath_make}) + endif() +endif() +") + endif() + endif() + + set(config "") + if("${CMAKE_CFG_INTDIR}" MATCHES "^\\$") + string(REPLACE "${CMAKE_CFG_INTDIR}" "\${config}" command "${command}") + set(config "-Dconfig=${CMAKE_CFG_INTDIR}") + endif() + + # Wrap multiple 'COMMAND' lines up into a second-level wrapper + # script so all output can be sent to one log file. + if("${command}" MATCHES ";COMMAND;") + set(code_execute_process " +${code_cygpath_make} +execute_process(COMMAND \${command} RESULT_VARIABLE result) +if(result) + set(msg \"Command failed (\${result}):\\n\") + foreach(arg IN LISTS command) + set(msg \"\${msg} '\${arg}'\") + endforeach(arg) + message(FATAL_ERROR \"\${msg}\") +endif() +") + set(code "") + set(cmd "") + set(sep "") + foreach(arg IN LISTS command) + if("x${arg}" STREQUAL "xCOMMAND") + set(code "${code}set(command \"${cmd}\")${code_execute_process}") + set(cmd "") + set(sep "") + else() + set(cmd "${cmd}${sep}${arg}") + set(sep ";") + endif() + endforeach() + set(code "${code}set(command \"${cmd}\")${code_execute_process}") + file(WRITE ${stamp_dir}/${name}-${step}-impl.cmake "${code}") + set(command ${CMAKE_COMMAND} "-Dmake=\${make}" "-Dconfig=\${config}" -P ${stamp_dir}/${name}-${step}-impl.cmake) + endif() + + # Wrap the command in a script to log output to files. + set(script ${stamp_dir}/${name}-${step}.cmake) + set(logbase ${stamp_dir}/${name}-${step}) + file(WRITE ${script} " +${code_cygpath_make} +set(command \"${command}\") +execute_process( + COMMAND \${command} + RESULT_VARIABLE result + OUTPUT_FILE \"${logbase}-out.log\" + ERROR_FILE \"${logbase}-err.log\" + ) +if(result) + set(msg \"Command failed: \${result}\\n\") + foreach(arg IN LISTS command) + set(msg \"\${msg} '\${arg}'\") + endforeach(arg) + set(msg \"\${msg}\\nSee also\\n ${logbase}-*.log\\n\") + message(FATAL_ERROR \"\${msg}\") +else() + set(msg \"${name} ${step} command succeeded. See also ${logbase}-*.log\\n\") + message(STATUS \"\${msg}\") +endif() +") + set(command ${CMAKE_COMMAND} ${make} ${config} -P ${script}) + set(${cmd_var} "${command}" PARENT_SCOPE) +endfunction(_ep_write_log_script) # This module used to use "/${CMAKE_CFG_INTDIR}" directly and produced # makefiles with "/./" in paths for custom command dependencies. Which @@ -508,6 +762,19 @@ function(_ep_get_configuration_subdir_suffix suffix_var) endfunction(_ep_get_configuration_subdir_suffix) +function(ExternalProject_Add_StepTargets name) + set(steps ${ARGN}) + + _ep_get_configuration_subdir_suffix(cfgdir) + ExternalProject_Get_Property(${name} stamp_dir) + + foreach(step ${steps}) + add_custom_target(${name}-${step} + DEPENDS ${stamp_dir}${cfgdir}/${name}-${step}) + endforeach() +endfunction(ExternalProject_Add_StepTargets) + + function(ExternalProject_Add_Step name step) set(cmf_dir ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles) ExternalProject_Get_Property(${name} stamp_dir) @@ -579,6 +846,12 @@ function(ExternalProject_Add_Step name step) set(touch ${CMAKE_COMMAND} -E touch ${stamp_dir}${cfgdir}/${name}-${step}) endif() + # Wrap with log script? + get_property(log TARGET ${name} PROPERTY _EP_${step}_LOG) + if(command AND log) + _ep_write_log_script(${name} ${step} command) + endif() + add_custom_command( OUTPUT ${stamp_dir}${cfgdir}/${name}-${step} COMMENT ${comment} @@ -588,6 +861,18 @@ function(ExternalProject_Add_Step name step) WORKING_DIRECTORY ${work_dir} VERBATIM ) + + # Add custom "step target"? + get_property(step_targets TARGET ${name} PROPERTY _EP_STEP_TARGETS) + if(NOT step_targets) + get_property(step_targets DIRECTORY PROPERTY EP_STEP_TARGETS) + endif() + foreach(st ${step_targets}) + if("${st}" STREQUAL "${step}") + ExternalProject_Add_StepTargets(${name} ${step}) + break() + endif() + endforeach() endfunction(ExternalProject_Add_Step) @@ -609,6 +894,29 @@ function(_ep_add_mkdir_command name) endfunction(_ep_add_mkdir_command) +function(_ep_get_git_version git_EXECUTABLE git_version_var) + if(git_EXECUTABLE) + execute_process( + COMMAND "${git_EXECUTABLE}" --version + OUTPUT_VARIABLE ov + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + string(REGEX REPLACE "^git version (.+)$" "\\1" version "${ov}") + set(${git_version_var} "${version}" PARENT_SCOPE) + endif() +endfunction() + + +function(_ep_is_dir_empty dir empty_var) + file(GLOB gr "${dir}/*") + if("${gr}" STREQUAL "") + set(${empty_var} 1 PARENT_SCOPE) + else() + set(${empty_var} 0 PARENT_SCOPE) + endif() +endfunction() + + function(_ep_add_download_command name) ExternalProject_Get_Property(${name} source_dir stamp_dir download_dir tmp_dir) @@ -616,6 +924,7 @@ function(_ep_add_download_command name) get_property(cmd TARGET ${name} PROPERTY _EP_DOWNLOAD_COMMAND) get_property(cvs_repository TARGET ${name} PROPERTY _EP_CVS_REPOSITORY) get_property(svn_repository TARGET ${name} PROPERTY _EP_SVN_REPOSITORY) + get_property(git_repository TARGET ${name} PROPERTY _EP_GIT_REPOSITORY) get_property(url TARGET ${name} PROPERTY _EP_URL) # TODO: Perhaps file:// should be copied to download dir before extraction. @@ -661,8 +970,10 @@ function(_ep_add_download_command name) endif() get_property(svn_revision TARGET ${name} PROPERTY _EP_SVN_REVISION) + get_property(svn_username TARGET ${name} PROPERTY _EP_SVN_USERNAME) + get_property(svn_password TARGET ${name} PROPERTY _EP_SVN_PASSWORD) - set(repository ${svn_repository}) + set(repository "${svn_repository} user=${svn_username} password=${svn_password}") set(module) set(tag ${svn_revision}) configure_file( @@ -674,13 +985,55 @@ function(_ep_add_download_command name) get_filename_component(src_name "${source_dir}" NAME) get_filename_component(work_dir "${source_dir}" PATH) set(comment "Performing download step (SVN checkout) for '${name}'") - set(cmd ${Subversion_SVN_EXECUTABLE} co ${svn_repository} ${svn_revision} ${src_name}) + set(cmd ${Subversion_SVN_EXECUTABLE} co ${svn_repository} ${svn_revision} + --username=${svn_username} --password=${svn_password} ${src_name}) list(APPEND depends ${stamp_dir}/${name}-svninfo.txt) + elseif(git_repository) + find_package(Git) + if(NOT GIT_EXECUTABLE) + message(FATAL_ERROR "error: could not find git for clone of ${name}") + endif() + + # The git submodule update '--recursive' flag requires git >= v1.6.5 + # + _ep_get_git_version("${GIT_EXECUTABLE}" git_version) + if(git_version VERSION_LESS 1.6.5) + message(FATAL_ERROR "error: git version 1.6.5 or later required for 'git submodule update --recursive': git_version='${git_version}'") + endif() + + get_property(git_tag TARGET ${name} PROPERTY _EP_GIT_TAG) + if(NOT git_tag) + set(git_tag "master") + endif() + + set(repository ${git_repository}) + set(module) + set(tag ${git_tag}) + configure_file( + "${CMAKE_ROOT}/Modules/RepositoryInfo.txt.in" + "${stamp_dir}/${name}-gitinfo.txt" + @ONLY + ) + + get_filename_component(src_name "${source_dir}" NAME) + get_filename_component(work_dir "${source_dir}" PATH) + + # Since git clone doesn't succeed if the non-empty source_dir exists, + # create a cmake script to invoke as download command. + # The script will delete the source directory and then call git clone. + # + _ep_write_gitclone_script(${tmp_dir}/${name}-gitclone.cmake ${source_dir} + ${GIT_EXECUTABLE} ${git_repository} ${git_tag} ${src_name} ${work_dir} + ) + set(comment "Performing download step (git clone) for '${name}'") + set(cmd ${CMAKE_COMMAND} -P ${tmp_dir}/${name}-gitclone.cmake) + list(APPEND depends ${stamp_dir}/${name}-gitinfo.txt) elseif(url) get_filename_component(work_dir "${source_dir}" PATH) + get_property(md5 TARGET ${name} PROPERTY _EP_URL_MD5) set(repository "external project URL") set(module "${url}") - set(tag "") + set(tag "${md5}") configure_file( "${CMAKE_ROOT}/Modules/RepositoryInfo.txt.in" "${stamp_dir}/${name}-urlinfo.txt" @@ -696,25 +1049,36 @@ function(_ep_add_download_command name) if("${url}" MATCHES "^[a-z]+://") # TODO: Should download and extraction be different steps? string(REGEX MATCH "[^/]*$" fname "${url}") - if(NOT "${fname}" MATCHES "\\.(tar|tgz|tar\\.gz)$") + if(NOT "${fname}" MATCHES "\\.(bz2|tar|tgz|tar\\.gz|zip)$") message(FATAL_ERROR "Could not extract tarball filename from url:\n ${url}") endif() set(file ${download_dir}/${fname}) get_property(timeout TARGET ${name} PROPERTY _EP_TIMEOUT) - _ep_write_downloadfile_script("${stamp_dir}/download-${name}.cmake" "${url}" "${file}" "${timeout}") + _ep_write_downloadfile_script("${stamp_dir}/download-${name}.cmake" "${url}" "${file}" "${timeout}" "${md5}") set(cmd ${CMAKE_COMMAND} -P ${stamp_dir}/download-${name}.cmake COMMAND) - set(comment "Performing download step (download and extract) for '${name}'") + set(comment "Performing download step (download, verify and extract) for '${name}'") else() set(file "${url}") - set(comment "Performing download step (extract) for '${name}'") + set(comment "Performing download step (verify and extract) for '${name}'") endif() - # TODO: Support other archive formats. - _ep_write_extractfile_script("${stamp_dir}/extract-${name}.cmake" "${file}" "${tmp_dir}" "${source_dir}") + _ep_write_verifyfile_script("${stamp_dir}/verify-${name}.cmake" "${file}" "${md5}") + list(APPEND cmd ${CMAKE_COMMAND} -P ${stamp_dir}/verify-${name}.cmake) + _ep_write_extractfile_script("${stamp_dir}/extract-${name}.cmake" "${name}" "${file}" "${source_dir}") list(APPEND cmd ${CMAKE_COMMAND} -P ${stamp_dir}/extract-${name}.cmake) endif() else() - message(SEND_ERROR "error: no download info for '${name}' -- please specify existing SOURCE_DIR or one of URL, CVS_REPOSITORY and CVS_MODULE, SVN_REPOSITORY or DOWNLOAD_COMMAND") + _ep_is_dir_empty("${source_dir}" empty) + if(${empty}) + message(SEND_ERROR "error: no download info for '${name}' -- please specify existing/non-empty SOURCE_DIR or one of URL, CVS_REPOSITORY and CVS_MODULE, SVN_REPOSITORY, GIT_REPOSITORY or DOWNLOAD_COMMAND") + endif() + endif() + + get_property(log TARGET ${name} PROPERTY _EP_LOG_DOWNLOAD) + if(log) + set(log LOG 1) + else() + set(log "") endif() ExternalProject_Add_Step(${name} download @@ -723,6 +1087,7 @@ function(_ep_add_download_command name) WORKING_DIRECTORY ${work_dir} DEPENDS ${depends} DEPENDEES mkdir + ${log} ) endfunction(_ep_add_download_command) @@ -734,6 +1099,7 @@ function(_ep_add_update_command name) get_property(cmd TARGET ${name} PROPERTY _EP_UPDATE_COMMAND) get_property(cvs_repository TARGET ${name} PROPERTY _EP_CVS_REPOSITORY) get_property(svn_repository TARGET ${name} PROPERTY _EP_SVN_REPOSITORY) + get_property(git_repository TARGET ${name} PROPERTY _EP_GIT_REPOSITORY) set(work_dir) set(comment) @@ -757,16 +1123,42 @@ function(_ep_add_update_command name) set(work_dir ${source_dir}) set(comment "Performing update step (SVN update) for '${name}'") get_property(svn_revision TARGET ${name} PROPERTY _EP_SVN_REVISION) - set(cmd ${Subversion_SVN_EXECUTABLE} up ${svn_revision}) + get_property(svn_username TARGET ${name} PROPERTY _EP_SVN_USERNAME) + get_property(svn_password TARGET ${name} PROPERTY _EP_SVN_PASSWORD) + set(cmd ${Subversion_SVN_EXECUTABLE} up ${svn_revision} + --username=${svn_username} --password=${svn_password}) + set(always 1) + elseif(git_repository) + if(NOT GIT_EXECUTABLE) + message(FATAL_ERROR "error: could not find git for fetch of ${name}") + endif() + set(work_dir ${source_dir}) + set(comment "Performing update step (git fetch) for '${name}'") + get_property(git_tag TARGET ${name} PROPERTY _EP_GIT_TAG) + if(NOT git_tag) + set(git_tag "master") + endif() + set(cmd ${GIT_EXECUTABLE} fetch + COMMAND ${GIT_EXECUTABLE} checkout ${git_tag} + COMMAND ${GIT_EXECUTABLE} submodule update --recursive + ) set(always 1) endif() + get_property(log TARGET ${name} PROPERTY _EP_LOG_UPDATE) + if(log) + set(log LOG 1) + else() + set(log "") + endif() + ExternalProject_Add_Step(${name} update COMMENT ${comment} COMMAND ${cmd} ALWAYS ${always} WORKING_DIRECTORY ${work_dir} DEPENDEES download + ${log} ) endfunction(_ep_add_update_command) @@ -793,7 +1185,7 @@ endfunction(_ep_add_patch_command) # TODO: Make sure external projects use the proper compiler function(_ep_add_configure_command name) - ExternalProject_Get_Property(${name} source_dir binary_dir) + ExternalProject_Get_Property(${name} source_dir binary_dir tmp_dir) _ep_get_configuration_subdir_suffix(cfgdir) @@ -827,11 +1219,29 @@ function(_ep_add_configure_command name) endif() endif() + # If anything about the configure command changes, (command itself, cmake + # used, cmake args or cmake generator) then re-run the configure step. + # Fixes issue http://public.kitware.com/Bug/view.php?id=10258 + # + if(NOT EXISTS ${tmp_dir}/${name}-cfgcmd.txt.in) + file(WRITE ${tmp_dir}/${name}-cfgcmd.txt.in "cmd='@cmd@'\n") + endif() + configure_file(${tmp_dir}/${name}-cfgcmd.txt.in ${tmp_dir}/${name}-cfgcmd.txt) + list(APPEND file_deps ${tmp_dir}/${name}-cfgcmd.txt) + + get_property(log TARGET ${name} PROPERTY _EP_LOG_CONFIGURE) + if(log) + set(log LOG 1) + else() + set(log "") + endif() + ExternalProject_Add_Step(${name} configure COMMAND ${cmd} WORKING_DIRECTORY ${binary_dir} DEPENDEES update patch DEPENDS ${file_deps} + ${log} ) endfunction(_ep_add_configure_command) @@ -846,10 +1256,18 @@ function(_ep_add_build_command name) _ep_get_build_command(${name} BUILD cmd) endif() + get_property(log TARGET ${name} PROPERTY _EP_LOG_BUILD) + if(log) + set(log LOG 1) + else() + set(log "") + endif() + ExternalProject_Add_Step(${name} build COMMAND ${cmd} WORKING_DIRECTORY ${binary_dir} DEPENDEES configure + ${log} ) endfunction(_ep_add_build_command) @@ -864,10 +1282,18 @@ function(_ep_add_install_command name) _ep_get_build_command(${name} INSTALL cmd) endif() + get_property(log TARGET ${name} PROPERTY _EP_LOG_INSTALL) + if(log) + set(log LOG 1) + else() + set(log "") + endif() + ExternalProject_Add_Step(${name} install COMMAND ${cmd} WORKING_DIRECTORY ${binary_dir} DEPENDEES build + ${log} ) endfunction(_ep_add_install_command) @@ -895,10 +1321,18 @@ function(_ep_add_test_command name) set(dep_args DEPENDEES install) endif() + get_property(log TARGET ${name} PROPERTY _EP_LOG_TEST) + if(log) + set(log LOG 1) + else() + set(log "") + endif() + ExternalProject_Add_Step(${name} test COMMAND ${cmd} WORKING_DIRECTORY ${binary_dir} ${dep_args} + ${log} ) endif() endfunction(_ep_add_test_command) diff --git a/Modules/FLTKCompatibility.cmake b/Modules/FLTKCompatibility.cmake index 77ca47b..6b6f960 100644 --- a/Modules/FLTKCompatibility.cmake +++ b/Modules/FLTKCompatibility.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) INCLUDE(CheckIncludeFile) diff --git a/Modules/FeatureSummary.cmake b/Modules/FeatureSummary.cmake index d1d31bc..c4a97d5 100644 --- a/Modules/FeatureSummary.cmake +++ b/Modules/FeatureSummary.cmake @@ -29,7 +29,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) FUNCTION(SET_FEATURE_INFO _name _desc) diff --git a/Modules/FindALSA.cmake b/Modules/FindALSA.cmake index 7deefaf..40bd6f3 100644 --- a/Modules/FindALSA.cmake +++ b/Modules/FindALSA.cmake @@ -21,7 +21,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) find_path(ALSA_INCLUDE_DIR NAMES asoundlib.h diff --git a/Modules/FindASPELL.cmake b/Modules/FindASPELL.cmake index a211ab0..63ffdf9 100644 --- a/Modules/FindASPELL.cmake +++ b/Modules/FindASPELL.cmake @@ -17,7 +17,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) FIND_PATH(ASPELL_INCLUDE_DIR aspell.h ) diff --git a/Modules/FindAVIFile.cmake b/Modules/FindAVIFile.cmake index 7272ba6..90885ac 100644 --- a/Modules/FindAVIFile.cmake +++ b/Modules/FindAVIFile.cmake @@ -19,7 +19,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) IF (UNIX) diff --git a/Modules/FindBISON.cmake b/Modules/FindBISON.cmake index b604d0b..0c622fb 100644 --- a/Modules/FindBISON.cmake +++ b/Modules/FindBISON.cmake @@ -5,6 +5,9 @@ # BISON_VERSION - version of bison # BISON_FOUND - true if the program was found # +# The minimum required version of bison can be specified using the +# standard CMake syntax, e.g. find_package(BISON 2.1.3) +# # If bison is found, the module defines the macros: # BISON_TARGET(<Name> <YaccInput> <CodeOutput> [VERBOSE <file>] # [COMPILE_FLAGS <string>]) @@ -41,7 +44,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) FIND_PROGRAM(BISON_EXECUTABLE bison DOC "path to the bison executable") @@ -149,6 +152,7 @@ IF(BISON_EXECUTABLE) ENDIF(BISON_EXECUTABLE) INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(BISON DEFAULT_MSG BISON_EXECUTABLE) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(BISON REQUIRED_VARS BISON_EXECUTABLE + VERSION_VAR BISON_VERSION) # FindBISON.cmake ends here diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake index be41736..94bbed5 100644 --- a/Modules/FindBLAS.cmake +++ b/Modules/FindBLAS.cmake @@ -36,7 +36,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) get_property(_LANGUAGES_ GLOBAL PROPERTY ENABLED_LANGUAGES) diff --git a/Modules/FindBZip2.cmake b/Modules/FindBZip2.cmake index 2dcc9b4..e671f93 100644 --- a/Modules/FindBZip2.cmake +++ b/Modules/FindBZip2.cmake @@ -17,7 +17,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) FIND_PATH(BZIP2_INCLUDE_DIR bzlib.h ) diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index ea9eb25..1a1b168 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -63,7 +63,7 @@ # Currently this module searches for the following version numbers: # 1.33, 1.33.0, 1.33.1, 1.34, 1.34.0, 1.34.1, 1.35, 1.35.0, 1.35.1, # 1.36, 1.36.0, 1.36.1, 1.37, 1.37.0, 1.38, 1.38.0, 1.39, 1.39.0, -# 1.40, 1.40.0, 1.41, 1.41.0 +# 1.40, 1.40.0, 1.41, 1.41.0, 1.42, 1.42.0, 1.43, 1.43.0, 1.44, 1.44.0 # # NOTE: If you add a new major 1.x version in Boost_ADDITIONAL_VERSIONS you should # add both 1.x and 1.x.0 as shown above. Official Boost include directories @@ -174,7 +174,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) #------------------------------------------------------------------------------- @@ -297,6 +297,7 @@ else(Boost_FIND_VERSION_EXACT) # The user has not requested an exact version. Among known # versions, find those that are acceptable to the user request. set(_Boost_KNOWN_VERSIONS ${Boost_ADDITIONAL_VERSIONS} + "1.44.0" "1.44" "1.43.0" "1.43" "1.42.0" "1.42" "1.41.0" "1.41" "1.40.0" "1.40" "1.39.0" "1.39" "1.38.0" "1.38" "1.37.0" "1.37" "1.36.1" "1.36.0" "1.36" "1.35.1" "1.35.0" "1.35" "1.34.1" "1.34.0" "1.34" "1.33.1" "1.33.0" "1.33") @@ -555,7 +556,7 @@ ELSE (_boost_IN_CACHE) # Setting some more suffixes for the library SET (Boost_LIB_PREFIX "") - if ( WIN32 AND Boost_USE_STATIC_LIBS ) + if ( WIN32 AND Boost_USE_STATIC_LIBS AND NOT CYGWIN) SET (Boost_LIB_PREFIX "lib") endif() diff --git a/Modules/FindBullet.cmake b/Modules/FindBullet.cmake index fe58f60..d10a388 100644 --- a/Modules/FindBullet.cmake +++ b/Modules/FindBullet.cmake @@ -24,7 +24,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) macro(_FIND_BULLET_LIBRARY _var) diff --git a/Modules/FindCABLE.cmake b/Modules/FindCABLE.cmake index 938c805..678fb07 100644 --- a/Modules/FindCABLE.cmake +++ b/Modules/FindCABLE.cmake @@ -20,7 +20,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) IF(NOT CABLE) diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index 6539057..d9b9d54 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -165,7 +165,7 @@ # and will link in the resulting object file automatically. # # This script will also generate a separate cmake script that is used at -# build time to invoke nvcc. This is for serveral reasons. +# build time to invoke nvcc. This is for several reasons. # # 1. nvcc can return negative numbers as return values which confuses # Visual Studio into thinking that the command succeeded. The script now @@ -418,6 +418,10 @@ if(NOT "${CUDA_TOOLKIT_ROOT_DIR}" STREQUAL "${CUDA_TOOLKIT_ROOT_DIR_INTERNAL}") unset(CUDA_VERSION CACHE) unset(CUDA_TOOLKIT_INCLUDE CACHE) unset(CUDA_CUDART_LIBRARY CACHE) + if(CUDA_VERSION VERSION_EQUAL "3.0") + # This only existed in the 3.0 version of the CUDA toolkit + unset(CUDA_CUDARTEMU_LIBRARY CACHE) + endif() unset(CUDA_CUDA_LIBRARY CACHE) unset(CUDA_cublas_LIBRARY CACHE) unset(CUDA_cublasemu_LIBRARY CACHE) @@ -484,34 +488,15 @@ if(CUDA_NVCC_EXECUTABLE AND NOT CUDA_VERSION) string(REGEX REPLACE ".*release ([0-9]+)\\.([0-9]+).*" "\\2" CUDA_VERSION_MINOR ${NVCC_OUT}) set(CUDA_VERSION "${CUDA_VERSION_MAJOR}.${CUDA_VERSION_MINOR}" CACHE STRING "Version of CUDA as computed from nvcc.") mark_as_advanced(CUDA_VERSION) +else() + # Need to set these based off of the cached value + string(REGEX REPLACE "([0-9]+)\\.([0-9]+).*" "\\1" CUDA_VERSION_MAJOR "${CUDA_VERSION}") + string(REGEX REPLACE "([0-9]+)\\.([0-9]+).*" "\\2" CUDA_VERSION_MINOR "${CUDA_VERSION}") endif() # Always set this convenience variable set(CUDA_VERSION_STRING "${CUDA_VERSION}") -# Here we need to determine if the version we found is acceptable. We will -# assume that is unless CUDA_FIND_VERSION_EXACT or CUDA_FIND_VERSION is -# specified. The presence of either of these options checks the version -# string and signals if the version is acceptable or not. -set(_cuda_version_acceptable TRUE) -# -if(CUDA_FIND_VERSION_EXACT AND NOT CUDA_VERSION VERSION_EQUAL CUDA_FIND_VERSION) - set(_cuda_version_acceptable FALSE) -endif() -# -if(CUDA_FIND_VERSION AND CUDA_VERSION VERSION_LESS CUDA_FIND_VERSION) - set(_cuda_version_acceptable FALSE) -endif() -# -if(NOT _cuda_version_acceptable) - set(_cuda_error_message "Requested CUDA version ${CUDA_FIND_VERSION}, but found unacceptable version ${CUDA_VERSION}") - if(CUDA_FIND_REQUIRED) - message("${_cuda_error_message}") - elseif(NOT CUDA_FIND_QUIETLY) - message("${_cuda_error_message}") - endif() -endif() - # CUDA_TOOLKIT_INCLUDE find_path(CUDA_TOOLKIT_INCLUDE device_functions.h # Header included in toolkit @@ -545,11 +530,28 @@ endmacro() # CUDA_LIBRARIES find_library_local_first(CUDA_CUDART_LIBRARY cudart "\"cudart\" library") -set(CUDA_LIBRARIES ${CUDA_CUDART_LIBRARY}) +if(CUDA_VERSION VERSION_EQUAL "3.0") + # The cudartemu library only existed for the 3.0 version of CUDA. + find_library_local_first(CUDA_CUDARTEMU_LIBRARY cudartemu "\"cudartemu\" library") + mark_as_advanced( + CUDA_CUDARTEMU_LIBRARY + ) +endif() +# If we are using emulation mode and we found the cudartemu library then use +# that one instead of cudart. +if(CUDA_BUILD_EMULATION AND CUDA_CUDARTEMU_LIBRARY) + set(CUDA_LIBRARIES ${CUDA_CUDARTEMU_LIBRARY}) +else() + set(CUDA_LIBRARIES ${CUDA_CUDART_LIBRARY}) +endif() if(APPLE) # We need to add the path to cudart to the linker using rpath, since the # library name for the cuda libraries is prepended with @rpath. - get_filename_component(_cuda_path_to_cudart "${CUDA_CUDART_LIBRARY}" PATH) + if(CUDA_BUILD_EMULATION AND CUDA_CUDARTEMU_LIBRARY) + get_filename_component(_cuda_path_to_cudart "${CUDA_CUDARTEMU_LIBRARY}" PATH) + else() + get_filename_component(_cuda_path_to_cudart "${CUDA_CUDART_LIBRARY}" PATH) + endif() if(_cuda_path_to_cudart) list(APPEND CUDA_LIBRARIES -Wl,-rpath "-Wl,${_cuda_path_to_cudart}") endif() @@ -662,12 +664,14 @@ set(CUDA_SDK_ROOT_DIR_INTERNAL "${CUDA_SDK_ROOT_DIR}" CACHE INTERNAL "This is the value of the last time CUDA_SDK_ROOT_DIR was set successfully." FORCE) include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(CUDA DEFAULT_MSG - CUDA_TOOLKIT_ROOT_DIR - CUDA_NVCC_EXECUTABLE - CUDA_INCLUDE_DIRS - CUDA_CUDART_LIBRARY - _cuda_version_acceptable +find_package_handle_standard_args(CUDA + REQUIRED_VARS + CUDA_TOOLKIT_ROOT_DIR + CUDA_NVCC_EXECUTABLE + CUDA_INCLUDE_DIRS + CUDA_CUDART_LIBRARY + VERSION_VAR + CUDA_VERSION ) @@ -786,7 +790,7 @@ endfunction() ############################################################################## # This helper macro populates the following variables and setups up custom # commands and targets to invoke the nvcc compiler to generate C or PTX source -# dependant upon the format parameter. The compiler is invoked once with -M +# dependent upon the format parameter. The compiler is invoked once with -M # to generate a dependency file and a second time with -cuda or -ptx to generate # a .cpp or .ptx file. # INPUT: diff --git a/Modules/FindCURL.cmake b/Modules/FindCURL.cmake index f301b24..07835fa 100644 --- a/Modules/FindCURL.cmake +++ b/Modules/FindCURL.cmake @@ -15,7 +15,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # Look for the header file. diff --git a/Modules/FindCVS.cmake b/Modules/FindCVS.cmake index ff97762..2769111 100644 --- a/Modules/FindCVS.cmake +++ b/Modules/FindCVS.cmake @@ -17,7 +17,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # CVSNT diff --git a/Modules/FindCoin3D.cmake b/Modules/FindCoin3D.cmake index 82d216a..47d0c55 100644 --- a/Modules/FindCoin3D.cmake +++ b/Modules/FindCoin3D.cmake @@ -19,7 +19,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) IF (WIN32) diff --git a/Modules/FindCups.cmake b/Modules/FindCups.cmake index 5efc45b..7e3e10a 100644 --- a/Modules/FindCups.cmake +++ b/Modules/FindCups.cmake @@ -18,7 +18,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) INCLUDE(CheckLibraryExists) diff --git a/Modules/FindCurses.cmake b/Modules/FindCurses.cmake index 791e6a9..4485f43 100644 --- a/Modules/FindCurses.cmake +++ b/Modules/FindCurses.cmake @@ -22,7 +22,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) FIND_LIBRARY(CURSES_CURSES_LIBRARY NAMES curses ) diff --git a/Modules/FindCxxTest.cmake b/Modules/FindCxxTest.cmake index 5abf992..759b4fd 100644 --- a/Modules/FindCxxTest.cmake +++ b/Modules/FindCxxTest.cmake @@ -75,7 +75,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # Version 1.2 (3/2/08) diff --git a/Modules/FindCygwin.cmake b/Modules/FindCygwin.cmake index 5b2bc59..28f55ba 100644 --- a/Modules/FindCygwin.cmake +++ b/Modules/FindCygwin.cmake @@ -11,13 +11,14 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) IF (WIN32) FIND_PATH(CYGWIN_INSTALL_PATH cygwin.bat - "C:/Cygwin" + "C:/Cygwin" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Cygwin\\setup;rootdir]" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Cygnus Solutions\\Cygwin\\mounts v2\\/;native]" ) diff --git a/Modules/FindDCMTK.cmake b/Modules/FindDCMTK.cmake index 2c3fce5..3bed97f 100644 --- a/Modules/FindDCMTK.cmake +++ b/Modules/FindDCMTK.cmake @@ -1,7 +1,7 @@ # - find DCMTK libraries and applications # -# DCMTK_INCLUDE_DIR - Directories to include to use DCMTK +# DCMTK_INCLUDE_DIRS - Directories to include to use DCMTK # DCMTK_LIBRARIES - Files to link against to use DCMTK # DCMTK_FOUND - If false, don't try to use DCMTK # DCMTK_DIR - (optional) Source directory for DCMTK @@ -13,7 +13,8 @@ #============================================================================= # Copyright 2004-2009 Kitware, Inc. -# Copyright 2009 Mathieu Malaterre <mathieu.malaterre@gmail.com> +# Copyright 2009-2010 Mathieu Malaterre <mathieu.malaterre@gmail.com> +# Copyright 2010 Thomas Sondergaard <ts@medical-insight.com> # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -22,161 +23,130 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # # Written for VXL by Amitha Perera. # Upgraded for GDCM by Mathieu Malaterre. -# - -IF( NOT DCMTK_FOUND ) - SET( DCMTK_DIR "/usr/include/dcmtk/" - CACHE PATH "Root of DCMTK source tree (optional)." ) - MARK_AS_ADVANCED( DCMTK_DIR ) -ENDIF( NOT DCMTK_FOUND ) - - -FIND_PATH( DCMTK_config_INCLUDE_DIR osconfig.h - ${DCMTK_DIR}/config/include - ${DCMTK_DIR}/config - ${DCMTK_DIR}/include -) - -FIND_PATH( DCMTK_ofstd_INCLUDE_DIR ofstdinc.h - ${DCMTK_DIR}/ofstd/include - ${DCMTK_DIR}/ofstd - ${DCMTK_DIR}/include/ofstd -) - -FIND_LIBRARY( DCMTK_ofstd_LIBRARY ofstd - ${DCMTK_DIR}/ofstd/libsrc - ${DCMTK_DIR}/ofstd/libsrc/Release - ${DCMTK_DIR}/ofstd/libsrc/Debug - ${DCMTK_DIR}/ofstd/Release - ${DCMTK_DIR}/ofstd/Debug - ${DCMTK_DIR}/lib -) - - -FIND_PATH( DCMTK_dcmdata_INCLUDE_DIR dctypes.h - ${DCMTK_DIR}/include/dcmdata - ${DCMTK_DIR}/dcmdata - ${DCMTK_DIR}/dcmdata/include -) - -FIND_LIBRARY( DCMTK_dcmdata_LIBRARY dcmdata - ${DCMTK_DIR}/dcmdata/libsrc - ${DCMTK_DIR}/dcmdata/libsrc/Release - ${DCMTK_DIR}/dcmdata/libsrc/Debug - ${DCMTK_DIR}/dcmdata/Release - ${DCMTK_DIR}/dcmdata/Debug - ${DCMTK_DIR}/lib -) - - -FIND_PATH( DCMTK_dcmimgle_INCLUDE_DIR dcmimage.h - ${DCMTK_DIR}/dcmimgle/include - ${DCMTK_DIR}/dcmimgle - ${DCMTK_DIR}/include/dcmimgle -) - -FIND_LIBRARY( DCMTK_dcmimgle_LIBRARY dcmimgle - ${DCMTK_DIR}/dcmimgle/libsrc - ${DCMTK_DIR}/dcmimgle/libsrc/Release - ${DCMTK_DIR}/dcmimgle/libsrc/Debug - ${DCMTK_DIR}/dcmimgle/Release - ${DCMTK_DIR}/dcmimgle/Debug - ${DCMTK_DIR}/lib -) - -# MM: I could not find this library on debian system / dcmtk 3.5.4 -FIND_LIBRARY(DCMTK_imagedb_LIBRARY imagedb - ${DCMTK_DIR}/imagectn/libsrc/Release - ${DCMTK_DIR}/imagectn/libsrc/ - ${DCMTK_DIR}/imagectn/libsrc/Debug - ) - -FIND_LIBRARY(DCMTK_dcmnet_LIBRARY dcmnet - ${DCMTK_DIR}/dcmnet/libsrc/Release - ${DCMTK_DIR}/dcmnet/libsrc/Debug - ${DCMTK_DIR}/dcmnet/libsrc/ - ) - - -IF( DCMTK_config_INCLUDE_DIR - AND DCMTK_ofstd_INCLUDE_DIR - AND DCMTK_ofstd_LIBRARY - AND DCMTK_dcmdata_INCLUDE_DIR - AND DCMTK_dcmdata_LIBRARY - AND DCMTK_dcmimgle_INCLUDE_DIR - AND DCMTK_dcmimgle_LIBRARY ) - - SET( DCMTK_FOUND "YES" ) - SET( DCMTK_INCLUDE_DIR - ${DCMTK_config_INCLUDE_DIR} +# Modified for EasyViz by Thomas Sondergaard. +# + +if(NOT DCMTK_FOUND AND NOT DCMTK_DIR) + set(DCMTK_DIR + "/usr/include/dcmtk/" + CACHE + PATH + "Root of DCMTK source tree (optional).") + mark_as_advanced(DCMTK_DIR) +endif() + + +foreach(lib + dcmdata + dcmimage + dcmimgle + dcmjpeg + dcmnet + dcmpstat + dcmqrdb + dcmsign + dcmsr + dcmtls + ijg12 + ijg16 + ijg8 + ofstd) + + find_library(DCMTK_${lib}_LIBRARY + ${lib} + PATHS + ${DCMTK_DIR}/${lib}/libsrc + ${DCMTK_DIR}/${lib}/libsrc/Release + ${DCMTK_DIR}/${lib}/libsrc/Debug + ${DCMTK_DIR}/${lib}/Release + ${DCMTK_DIR}/${lib}/Debug + ${DCMTK_DIR}/lib) + + mark_as_advanced(DCMTK_${lib}_LIBRARY) + + if(DCMTK_${lib}_LIBRARY) + list(APPEND DCMTK_LIBRARIES ${DCMTK_${lib}_LIBRARY}) + endif() + +endforeach() + + +set(DCMTK_config_TEST_HEADER osconfig.h) +set(DCMTK_dcmdata_TEST_HEADER dctypes.h) +set(DCMTK_dcmimage_TEST_HEADER dicoimg.h) +set(DCMTK_dcmimgle_TEST_HEADER dcmimage.h) +set(DCMTK_dcmjpeg_TEST_HEADER djdecode.h) +set(DCMTK_dcmnet_TEST_HEADER assoc.h) +set(DCMTK_dcmpstat_TEST_HEADER dcmpstat.h) +set(DCMTK_dcmqrdb_TEST_HEADER dcmqrdba.h) +set(DCMTK_dcmsign_TEST_HEADER sicert.h) +set(DCMTK_dcmsr_TEST_HEADER dsrtree.h) +set(DCMTK_dcmtls_TEST_HEADER tlslayer.h) +set(DCMTK_ofstd_TEST_HEADER ofstdinc.h) + +foreach(dir + config + dcmdata + dcmimage + dcmimgle + dcmjpeg + dcmnet + dcmpstat + dcmqrdb + dcmsign + dcmsr + dcmtls + ofstd) + find_path(DCMTK_${dir}_INCLUDE_DIR + ${DCMTK_${dir}_TEST_HEADER} + PATHS + ${DCMTK_DIR}/${dir}/include + ${DCMTK_DIR}/${dir} + ${DCMTK_DIR}/include/${dir}) + + mark_as_advanced(DCMTK_${dir}_INCLUDE_DIR) + + if(DCMTK_${dir}_INCLUDE_DIR) + list(APPEND + DCMTK_INCLUDE_DIRS + ${DCMTK_${dir}_INCLUDE_DIR}) + endif() +endforeach() + +if(WIN32) + list(APPEND DCMTK_LIBRARIES netapi32 wsock32) +endif() + +if(DCMTK_ofstd_INCLUDE_DIR) + get_filename_component(DCMTK_dcmtk_INCLUDE_DIR ${DCMTK_ofstd_INCLUDE_DIR} - ${DCMTK_dcmdata_INCLUDE_DIR} - ${DCMTK_dcmimgle_INCLUDE_DIR} - ) - - SET( DCMTK_LIBRARIES - ${DCMTK_dcmimgle_LIBRARY} - ${DCMTK_dcmdata_LIBRARY} - ${DCMTK_ofstd_LIBRARY} - ${DCMTK_config_LIBRARY} - ) - - IF(DCMTK_imagedb_LIBRARY) - SET( DCMTK_LIBRARIES - ${DCMTK_LIBRARIES} - ${DCMTK_imagedb_LIBRARY} - ) - ENDIF(DCMTK_imagedb_LIBRARY) - - IF(DCMTK_dcmnet_LIBRARY) - SET( DCMTK_LIBRARIES - ${DCMTK_LIBRARIES} - ${DCMTK_dcmnet_LIBRARY} - ) - ENDIF(DCMTK_dcmnet_LIBRARY) - - IF( WIN32 ) - SET( DCMTK_LIBRARIES ${DCMTK_LIBRARIES} netapi32 ) - ENDIF( WIN32 ) - -ENDIF( DCMTK_config_INCLUDE_DIR - AND DCMTK_ofstd_INCLUDE_DIR - AND DCMTK_ofstd_LIBRARY - AND DCMTK_dcmdata_INCLUDE_DIR - AND DCMTK_dcmdata_LIBRARY - AND DCMTK_dcmimgle_INCLUDE_DIR - AND DCMTK_dcmimgle_LIBRARY ) - -FIND_PROGRAM(DCMTK_DCMDUMP_EXECUTABLE dcmdump - ${DCMTK_DIR}/bin - ) - -FIND_PROGRAM(DCMTK_DCMDJPEG_EXECUTABLE dcmdjpeg - ${DCMTK_DIR}/bin - ) - -FIND_PROGRAM(DCMTK_DCMDRLE_EXECUTABLE dcmdrle - ${DCMTK_DIR}/bin - ) - -MARK_AS_ADVANCED( - DCMTK_DCMDUMP_EXECUTABLE - DCMTK_DCMDJPEG_EXECUTABLE - DCMTK_DCMDRLE_EXECUTABLE + PATH + CACHE) + list(APPEND DCMTK_INCLUDE_DIRS ${DCMTK_dcmtk_INCLUDE_DIR}) + mark_as_advanced(DCMTK_dcmtk_INCLUDE_DIR) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(DCMTK DEFAULT_MSG DCMTK_config_INCLUDE_DIR + DCMTK_ofstd_INCLUDE_DIR + DCMTK_ofstd_LIBRARY DCMTK_dcmdata_INCLUDE_DIR DCMTK_dcmdata_LIBRARY DCMTK_dcmimgle_INCLUDE_DIR - DCMTK_dcmimgle_LIBRARY - DCMTK_imagedb_LIBRARY - DCMTK_dcmnet_LIBRARY - DCMTK_ofstd_INCLUDE_DIR - DCMTK_ofstd_LIBRARY - ) + DCMTK_dcmimgle_LIBRARY) + +# Compatibility: This variable is deprecated +set(DCMTK_INCLUDE_DIR ${DCMTK_INCLUDE_DIRS}) +foreach(executable dcmdump dcmdjpeg dcmdrle) + string(TOUPPER ${executable} EXECUTABLE) + find_program(DCMTK_${EXECUTABLE}_EXECUTABLE ${executable} ${DCMTK_DIR}/bin) + mark_as_advanced(DCMTK_${EXECUTABLE}_EXECUTABLE) +endforeach() diff --git a/Modules/FindDart.cmake b/Modules/FindDart.cmake index 65da21a..90f71bd 100644 --- a/Modules/FindDart.cmake +++ b/Modules/FindDart.cmake @@ -13,7 +13,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) FIND_PATH(DART_ROOT README.INSTALL diff --git a/Modules/FindDevIL.cmake b/Modules/FindDevIL.cmake index ae0f97d..c87e736 100644 --- a/Modules/FindDevIL.cmake +++ b/Modules/FindDevIL.cmake @@ -19,7 +19,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # TODO: Add version support. diff --git a/Modules/FindDoxygen.cmake b/Modules/FindDoxygen.cmake index 5e5ed13..aa4973d 100644 --- a/Modules/FindDoxygen.cmake +++ b/Modules/FindDoxygen.cmake @@ -28,7 +28,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # For backwards compatibility support diff --git a/Modules/FindEXPAT.cmake b/Modules/FindEXPAT.cmake index 22743b1..3c04b4c 100644 --- a/Modules/FindEXPAT.cmake +++ b/Modules/FindEXPAT.cmake @@ -15,7 +15,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # Look for the header file. diff --git a/Modules/FindFLEX.cmake b/Modules/FindFLEX.cmake index 068ee75..55b5639 100644 --- a/Modules/FindFLEX.cmake +++ b/Modules/FindFLEX.cmake @@ -6,6 +6,10 @@ # FLEX_VERSION - the version of flex # FLEX_LIBRARIES - The flex libraries # +# The minimum required version of flex can be specified using the +# standard syntax, e.g. FIND_PACKAGE(FLEX 2.5.13) +# +# # If flex is found on the system, the module provides the macro: # FLEX_TARGET(Name FlexInput FlexOutput [COMPILE_FLAGS <string>]) # which creates a custom command to generate the <FlexOutput> file from @@ -55,7 +59,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) FIND_PROGRAM(FLEX_EXECUTABLE flex DOC "path to the flex executable") @@ -136,6 +140,7 @@ IF(FLEX_EXECUTABLE) ENDIF(FLEX_EXECUTABLE) INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(FLEX DEFAULT_MSG FLEX_EXECUTABLE) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(FLEX REQUIRED_VARS FLEX_EXECUTABLE + VERSION_VAR FLEX_VERSION) # FindFLEX.cmake ends here diff --git a/Modules/FindFLTK.cmake b/Modules/FindFLTK.cmake index 02b2015..6d51277 100644 --- a/Modules/FindFLTK.cmake +++ b/Modules/FindFLTK.cmake @@ -39,7 +39,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) IF(NOT FLTK_SKIP_OPENGL) diff --git a/Modules/FindFLTK2.cmake b/Modules/FindFLTK2.cmake index 6411ccb..43409d3 100644 --- a/Modules/FindFLTK2.cmake +++ b/Modules/FindFLTK2.cmake @@ -20,7 +20,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) SET (FLTK2_DIR $ENV{FLTK2_DIR} ) diff --git a/Modules/FindFreetype.cmake b/Modules/FindFreetype.cmake index 0a6f93e..7762684 100644 --- a/Modules/FindFreetype.cmake +++ b/Modules/FindFreetype.cmake @@ -21,7 +21,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # Created by Eric Wing. diff --git a/Modules/FindGCCXML.cmake b/Modules/FindGCCXML.cmake index 52390c3..261a5d1 100644 --- a/Modules/FindGCCXML.cmake +++ b/Modules/FindGCCXML.cmake @@ -13,7 +13,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) FIND_PROGRAM(GCCXML diff --git a/Modules/FindGDAL.cmake b/Modules/FindGDAL.cmake index d3b198a..2050c72 100644 --- a/Modules/FindGDAL.cmake +++ b/Modules/FindGDAL.cmake @@ -20,7 +20,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # diff --git a/Modules/FindGIF.cmake b/Modules/FindGIF.cmake index 36bf1dc..e0d25e1 100644 --- a/Modules/FindGIF.cmake +++ b/Modules/FindGIF.cmake @@ -16,7 +16,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # Created by Eric Wing. diff --git a/Modules/FindGLU.cmake b/Modules/FindGLU.cmake index 81b3364..5198f11 100644 --- a/Modules/FindGLU.cmake +++ b/Modules/FindGLU.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # Use of this file is deprecated, and is here for backwards compatibility with CMake 1.4 diff --git a/Modules/FindGLUT.cmake b/Modules/FindGLUT.cmake index baf539a..45df79e 100644 --- a/Modules/FindGLUT.cmake +++ b/Modules/FindGLUT.cmake @@ -17,7 +17,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) IF (WIN32) diff --git a/Modules/FindGTK.cmake b/Modules/FindGTK.cmake index 75890df..e9cc62f 100644 --- a/Modules/FindGTK.cmake +++ b/Modules/FindGTK.cmake @@ -14,7 +14,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # don't even bother under WIN32 diff --git a/Modules/FindGTK2.cmake b/Modules/FindGTK2.cmake index c871417..3b99ae2 100644 --- a/Modules/FindGTK2.cmake +++ b/Modules/FindGTK2.cmake @@ -28,6 +28,8 @@ # # GTK2_DEBUG - Enables verbose debugging of the module # GTK2_SKIP_MARK_AS_ADVANCED - Disable marking cache variables as advanced +# GTK2_ADDITIONAL_SUFFIXES - Allows defining additional directories to +# search for include files # #================= # Example Usage: @@ -61,9 +63,18 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) +# Version 1.0 (8/12/2010) +# * Add support for detecting new pangommconfig.h header file +# (Thanks to Sune Vuorela & the Debian Project for the patch) +# * Add support for detecting fontconfig.h header +# * Call find_package(Freetype) since it's required +# * Add support for allowing users to add additional library directories +# via the GTK2_ADDITIONAL_SUFFIXES variable (kind of a future-kludge in +# case the GTK developers change versions on any of the directories in the +# future). # Version 0.8 (1/4/2010) # * Get module working under MacOSX fink by adding /sw/include, /sw/lib # to PATHS and the gobject library @@ -131,7 +142,8 @@ function(_GTK2_FIND_INCLUDE_DIR _var _hdr) endif() set(_relatives - # FIXME + # If these ever change, things will break. + ${GTK2_ADDITIONAL_SUFFIXES} glibmm-2.4 glib-2.0 atk-1.0 @@ -390,6 +402,10 @@ endif() # Find all components # +find_package(Freetype) +list(APPEND GTK2_INCLUDE_DIRS ${FREETYPE_INCLUDE_DIRS}) +list(APPEND GTK2_LIBRARIES ${FREETYPE_LIBRARIES}) + foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) if(_GTK2_component STREQUAL "gtk") _GTK2_FIND_INCLUDE_DIR(GTK2_GLIB_INCLUDE_DIR glib.h) @@ -401,16 +417,21 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) _GTK2_FIND_INCLUDE_DIR(GTK2_GDK_INCLUDE_DIR gdk/gdk.h) _GTK2_FIND_INCLUDE_DIR(GTK2_GDKCONFIG_INCLUDE_DIR gdkconfig.h) - _GTK2_FIND_LIBRARY (GTK2_GDK_LIBRARY gdk-x11 false true) - _GTK2_FIND_LIBRARY (GTK2_GDK_LIBRARY gdk-win32 false true) - _GTK2_FIND_INCLUDE_DIR(GTK2_GTK_INCLUDE_DIR gtk/gtk.h) - _GTK2_FIND_LIBRARY (GTK2_GTK_LIBRARY gtk-x11 false true) - _GTK2_FIND_LIBRARY (GTK2_GTK_LIBRARY gtk-win32 false true) + + if(UNIX) + _GTK2_FIND_LIBRARY (GTK2_GDK_LIBRARY gdk-x11 false true) + _GTK2_FIND_LIBRARY (GTK2_GTK_LIBRARY gtk-x11 false true) + else() + _GTK2_FIND_LIBRARY (GTK2_GDK_LIBRARY gdk-win32 false true) + _GTK2_FIND_LIBRARY (GTK2_GTK_LIBRARY gtk-win32 false true) + endif() _GTK2_FIND_INCLUDE_DIR(GTK2_CAIRO_INCLUDE_DIR cairo.h) _GTK2_FIND_LIBRARY (GTK2_CAIRO_LIBRARY cairo false false) + _GTK2_FIND_INCLUDE_DIR(GTK2_FONTCONFIG_INCLUDE_DIR fontconfig/fontconfig.h) + _GTK2_FIND_INCLUDE_DIR(GTK2_PANGO_INCLUDE_DIR pango/pango.h) _GTK2_FIND_LIBRARY (GTK2_PANGO_LIBRARY pango false true) @@ -439,6 +460,7 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) _GTK2_FIND_LIBRARY (GTK2_CAIROMM_LIBRARY cairomm true true) _GTK2_FIND_INCLUDE_DIR(GTK2_PANGOMM_INCLUDE_DIR pangomm.h) + _GTK2_FIND_INCLUDE_DIR(GTK2_PANGOMMCONFIG_INCLUDE_DIR pangommconfig.h) _GTK2_FIND_LIBRARY (GTK2_PANGOMM_LIBRARY pangomm true true) _GTK2_FIND_INCLUDE_DIR(GTK2_SIGC++_INCLUDE_DIR sigc++/sigc++.h) diff --git a/Modules/FindGTest.cmake b/Modules/FindGTest.cmake index 1bcd469..ef2852a 100644 --- a/Modules/FindGTest.cmake +++ b/Modules/FindGTest.cmake @@ -66,7 +66,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # # Thanks to Daniel Blezek <blezek@gmail.com> for the GTEST_ADD_TESTS code diff --git a/Modules/FindGettext.cmake b/Modules/FindGettext.cmake index cdef44f..9398b54 100644 --- a/Modules/FindGettext.cmake +++ b/Modules/FindGettext.cmake @@ -22,7 +22,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) FIND_PROGRAM(GETTEXT_MSGMERGE_EXECUTABLE msgmerge) diff --git a/Modules/FindGit.cmake b/Modules/FindGit.cmake new file mode 100644 index 0000000..06df3b0 --- /dev/null +++ b/Modules/FindGit.cmake @@ -0,0 +1,46 @@ +# The module defines the following variables: +# GIT_EXECUTABLE - path to git command line client +# GIT_FOUND - true if the command line client was found +# Example usage: +# find_package(Git) +# if(GIT_FOUND) +# message("git found: ${GIT_EXECUTABLE}") +# endif() + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +# Look for 'git' or 'eg' (easy git) +# +set(git_names git eg) + +# Prefer .cmd variants on Windows unless running in a Makefile +# in the MSYS shell. +# +if(WIN32) + if(NOT CMAKE_GENERATOR MATCHES "MSYS") + set(git_names git.cmd git eg.cmd eg) + endif() +endif() + +find_program(GIT_EXECUTABLE + NAMES ${git_names} + DOC "git command line client" + ) +mark_as_advanced(GIT_EXECUTABLE) + +# Handle the QUIETLY and REQUIRED arguments and set GIT_FOUND to TRUE if +# all listed variables are TRUE + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Git DEFAULT_MSG GIT_EXECUTABLE) diff --git a/Modules/FindGnuTLS.cmake b/Modules/FindGnuTLS.cmake index 72ab511..5c41253 100644 --- a/Modules/FindGnuTLS.cmake +++ b/Modules/FindGnuTLS.cmake @@ -20,7 +20,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # Note that this doesn't try to find the gnutls-extra package. diff --git a/Modules/FindGnuplot.cmake b/Modules/FindGnuplot.cmake index a9b9ee5..364d725 100644 --- a/Modules/FindGnuplot.cmake +++ b/Modules/FindGnuplot.cmake @@ -15,7 +15,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) INCLUDE(FindCygwin) diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake index a84e677..467b09f 100644 --- a/Modules/FindHDF5.cmake +++ b/Modules/FindHDF5.cmake @@ -51,7 +51,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # This module is maintained by Will Dicharry <wdicharry@stellarscience.com>. diff --git a/Modules/FindHSPELL.cmake b/Modules/FindHSPELL.cmake index 21bc5fd..3a8943f 100644 --- a/Modules/FindHSPELL.cmake +++ b/Modules/FindHSPELL.cmake @@ -21,7 +21,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) FIND_PATH(HSPELL_INCLUDE_DIR hspell.h) diff --git a/Modules/FindHTMLHelp.cmake b/Modules/FindHTMLHelp.cmake index 2deb297..4455b07 100644 --- a/Modules/FindHTMLHelp.cmake +++ b/Modules/FindHTMLHelp.cmake @@ -15,7 +15,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) IF(WIN32) diff --git a/Modules/FindITK.cmake b/Modules/FindITK.cmake index 40f03fb..244ce54 100644 --- a/Modules/FindITK.cmake +++ b/Modules/FindITK.cmake @@ -30,7 +30,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) SET(ITK_DIR_STRING "directory containing ITKConfig.cmake. This is either the root of the build tree, or PREFIX/lib/InsightToolkit for an installation.") diff --git a/Modules/FindImageMagick.cmake b/Modules/FindImageMagick.cmake index 33b8aad..3afcb1c 100644 --- a/Modules/FindImageMagick.cmake +++ b/Modules/FindImageMagick.cmake @@ -61,7 +61,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) #--------------------------------------------------------------------- diff --git a/Modules/FindJNI.cmake b/Modules/FindJNI.cmake index a61c683..5d70f0b 100644 --- a/Modules/FindJNI.cmake +++ b/Modules/FindJNI.cmake @@ -23,30 +23,55 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # Expand {libarch} occurences to java_libarch subdirectory(-ies) and set ${_var} MACRO(java_append_library_directories _var) # Determine java arch-specific library subdir - IF (CMAKE_SYSTEM_NAME MATCHES "Linux") - # Based on openjdk/jdk/make/common/shared/Platform.gmk as of 6b16 - # and kaffe as of 1.1.8 which uses the first part of the - # GNU config.guess platform triplet. - IF(CMAKE_SYSTEM_PROCESSOR MATCHES "^i[3-9]86$") - SET(_java_libarch "i386") - ELSEIF(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") - SET(_java_libarch "amd64" "x86_64") - ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^ppc") - SET(_java_libarch "ppc" "powerpc" "ppc64") - ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^sparc") - SET(_java_libarch "sparc" "sparcv9") - ELSE(CMAKE_SYSTEM_PROCESSOR MATCHES "^i[3-9]86$") - SET(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}") - ENDIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^i[3-9]86$") - ELSE(CMAKE_SYSTEM_NAME MATCHES "Linux") - SET(_java_libarch "i386" "amd64" "ppc") # previous default - ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux") + # Mostly based on openjdk/jdk/make/common/shared/Platform.gmk as of openjdk + # 1.6.0_18 + icedtea patches. However, it would be much better to base the + # guess on the first part of the GNU config.guess platform triplet. + IF(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") + SET(_java_libarch "amd64") + ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^i.86$") + SET(_java_libarch "i386") + ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^alpha") + SET(_java_libarch "alpha") + ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm") + # Subdir is "arm" for both big-endian (arm) and little-endian (armel). + SET(_java_libarch "arm") + ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^mips") + # mips* machines are bi-endian mostly so processor does not tell + # endianess of the underlying system. + SET(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}" "mips" "mipsel" "mipseb") + ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64") + SET(_java_libarch "ppc64") + ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)") + SET(_java_libarch "ppc") + ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^sparc") + # Both flavours can run on the same processor + SET(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}" "sparc" "sparcv9") + ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^(parisc|hppa)") + SET(_java_libarch "parisc" "parisc64") + ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^s390") + # s390 binaries can run on s390x machines + SET(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}" "s390" "s390x") + ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^sh") + SET(_java_libarch "sh") + ELSE(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") + SET(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}") + ENDIF(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") + + # Append default list architectures if CMAKE_SYSTEM_PROCESSOR was empty or + # system is non-Linux (where the code above has not been well tested) + IF(NOT _java_libarch OR NOT (CMAKE_SYSTEM_NAME MATCHES "Linux")) + LIST(APPEND _java_libarch "i386" "amd64" "ppc") + ENDIF(NOT _java_libarch OR NOT (CMAKE_SYSTEM_NAME MATCHES "Linux")) + + # Sometimes ${CMAKE_SYSTEM_PROCESSOR} is added to the list to prefer + # current value to a hardcoded list. Remove possible duplicates. + LIST(REMOVE_DUPLICATES _java_libarch) FOREACH(_path ${ARGN}) IF(_path MATCHES "{libarch}") diff --git a/Modules/FindJPEG.cmake b/Modules/FindJPEG.cmake index 299e458..1f37483 100644 --- a/Modules/FindJPEG.cmake +++ b/Modules/FindJPEG.cmake @@ -17,7 +17,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) FIND_PATH(JPEG_INCLUDE_DIR jpeglib.h) diff --git a/Modules/FindJasper.cmake b/Modules/FindJasper.cmake index 4f8ccb7..8aaa373 100644 --- a/Modules/FindJasper.cmake +++ b/Modules/FindJasper.cmake @@ -16,7 +16,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) FIND_PACKAGE(JPEG) diff --git a/Modules/FindJava.cmake b/Modules/FindJava.cmake index 4cd4389..1599433 100644 --- a/Modules/FindJava.cmake +++ b/Modules/FindJava.cmake @@ -13,6 +13,9 @@ # Java_VERSION_TWEAK = The tweak version of the package found (after '_') # Java_VERSION = This is set to: $major.$minor.$patch(.$tweak) # +# The minimum required version of Java can be specified using the +# standard CMake syntax, e.g. FIND_PACKAGE(Java 1.5) +# # NOTE: ${Java_VERSION} and ${Java_VERSION_STRING} are not guaranteed to be # identical. For example some java version may return: # Java_VERSION_STRING = 1.5.0_17 @@ -48,7 +51,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # The HINTS option should only be used for values computed from the system. @@ -83,7 +86,6 @@ FIND_PROGRAM(Java_JAVA_EXECUTABLE ) IF(Java_JAVA_EXECUTABLE) - set(_java_version_acceptable TRUE) EXECUTE_PROCESS(COMMAND ${Java_JAVA_EXECUTABLE} -version RESULT_VARIABLE res OUTPUT_VARIABLE var @@ -114,7 +116,6 @@ IF(Java_JAVA_EXECUTABLE) ELSE() IF(NOT Java_FIND_QUIETLY) message(WARNING "regex not supported: ${var}. Please report") - set(_java_version_acceptable FALSE) ENDIF(NOT Java_FIND_QUIETLY) ENDIF() STRING( REGEX REPLACE "([0-9]+).*" "\\1" Java_VERSION_MAJOR "${Java_VERSION_STRING}" ) @@ -134,17 +135,6 @@ IF(Java_JAVA_EXECUTABLE) ENDIF(NOT Java_FIND_QUIETLY) ENDIF() - # check version if requested: - if( Java_FIND_VERSION ) - if("${Java_VERSION}" VERSION_LESS "${Java_FIND_VERSION}") - set(_java_version_acceptable FALSE) - endif("${Java_VERSION}" VERSION_LESS "${Java_FIND_VERSION}") - if( Java_FIND_VERSION_EXACT ) - if("${Java_VERSION}" VERSION_GREATER "${Java_FIND_VERSION}") - set(_java_version_acceptable FALSE) - endif("${Java_VERSION}" VERSION_GREATER "${Java_FIND_VERSION}") - endif( Java_FIND_VERSION_EXACT ) - endif( Java_FIND_VERSION ) ENDIF(Java_JAVA_EXECUTABLE) @@ -165,17 +155,15 @@ if(Java_FIND_COMPONENTS) foreach(component ${Java_FIND_COMPONENTS}) # User just want to execute some Java byte-compiled if(component STREQUAL "Runtime") - find_package_handle_standard_args(Java DEFAULT_MSG - Java_JAVA_EXECUTABLE - _java_version_acceptable - ) + find_package_handle_standard_args(Java + REQUIRED_VARS Java_JAVA_EXECUTABLE + VERSION_VAR Java_VERSION + ) elseif(component STREQUAL "Development") - find_package_handle_standard_args(Java DEFAULT_MSG - Java_JAVA_EXECUTABLE - Java_JAR_EXECUTABLE - Java_JAVAC_EXECUTABLE - _java_version_acceptable - ) + find_package_handle_standard_args(Java + REQUIRED_VARS Java_JAVA_EXECUTABLE Java_JAR_EXECUTABLE Java_JAVAC_EXECUTABLE + VERSION_VAR Java_VERSION + ) else() message(FATAL_ERROR "Comp: ${component} is not handled") endif() @@ -183,12 +171,10 @@ if(Java_FIND_COMPONENTS) endforeach(component) else() # Check for everything - find_package_handle_standard_args(Java DEFAULT_MSG - Java_JAVA_EXECUTABLE - Java_JAR_EXECUTABLE - Java_JAVAC_EXECUTABLE - _java_version_acceptable - ) + find_package_handle_standard_args(Java + REQUIRED_VARS Java_JAVA_EXECUTABLE Java_JAR_EXECUTABLE Java_JAVAC_EXECUTABLE + VERSION_VAR Java_VERSION + ) endif() diff --git a/Modules/FindKDE3.cmake b/Modules/FindKDE3.cmake index 5c5c5fe..9d10814 100644 --- a/Modules/FindKDE3.cmake +++ b/Modules/FindKDE3.cmake @@ -74,7 +74,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) IF(NOT UNIX AND KDE3_FIND_REQUIRED) diff --git a/Modules/FindKDE4.cmake b/Modules/FindKDE4.cmake index 42a1530..ed4f270 100644 --- a/Modules/FindKDE4.cmake +++ b/Modules/FindKDE4.cmake @@ -20,7 +20,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # If Qt3 has already been found, fail. diff --git a/Modules/FindLAPACK.cmake b/Modules/FindLAPACK.cmake index b89a997..40effb0 100644 --- a/Modules/FindLAPACK.cmake +++ b/Modules/FindLAPACK.cmake @@ -33,7 +33,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) get_property(_LANGUAGES_ GLOBAL PROPERTY ENABLED_LANGUAGES) diff --git a/Modules/FindLATEX.cmake b/Modules/FindLATEX.cmake index dbd96a7..950daca 100644 --- a/Modules/FindLATEX.cmake +++ b/Modules/FindLATEX.cmake @@ -21,7 +21,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) IF (WIN32) diff --git a/Modules/FindLibArchive.cmake b/Modules/FindLibArchive.cmake new file mode 100644 index 0000000..e7c2706 --- /dev/null +++ b/Modules/FindLibArchive.cmake @@ -0,0 +1,63 @@ +# - Find libarchive library and headers +# The module defines the following variables: +# +# LibArchive_FOUND - true if libarchive was found +# LibArchive_INCLUDE_DIRS - include search path +# LibArchive_LIBRARIES - libraries to link +# LibArchive_VERSION - libarchive 3-component version number + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +find_path(LibArchive_INCLUDE_DIR + NAMES archive.h + PATHS + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\GnuWin32\\LibArchive;InstallPath]/include" + ) + +find_library(LibArchive_LIBRARY + NAMES archive libarchive + PATHS + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\GnuWin32\\LibArchive;InstallPath]/lib" + ) + +mark_as_advanced(LibArchive_INCLUDE_DIR LibArchive_LIBRARY) + +# Extract the version number from the header. +if(LibArchive_INCLUDE_DIR AND EXISTS "${LibArchive_INCLUDE_DIR}/archive.h") + # The version string appears in one of two known formats in the header: + # #define ARCHIVE_LIBRARY_VERSION "libarchive 2.4.12" + # #define ARCHIVE_VERSION_STRING "libarchive 2.8.4" + # Match either format. + set(_LibArchive_VERSION_REGEX "^#define[ \t]+ARCHIVE[_A-Z]+VERSION[_A-Z]*[ \t]+\"libarchive +([0-9]+)\\.([0-9]+)\\.([0-9]+)[^\"]*\".*$") + file(STRINGS "${LibArchive_INCLUDE_DIR}/archive.h" _LibArchive_VERSION_STRING LIMIT_COUNT 1 REGEX "${_LibArchive_VERSION_REGEX}") + if(_LibArchive_VERSION_STRING) + string(REGEX REPLACE "${_LibArchive_VERSION_REGEX}" "\\1.\\2.\\3" LibArchive_VERSION "${_LibArchive_VERSION_STRING}") + endif() + unset(_LibArchive_VERSION_REGEX) + unset(_LibArchive_VERSION_STRING) +endif() + +# Handle the QUIETLY and REQUIRED arguments and set LIBARCHIVE_FOUND +# to TRUE if all listed variables are TRUE. +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(LibArchive DEFAULT_MSG + LibArchive_LIBRARY LibArchive_INCLUDE_DIR + ) +set(LibArchive_FOUND ${LIBARCHIVE_FOUND}) +unset(LIBARCHIVE_FOUND) + +if(LibArchive_FOUND) + set(LibArchive_INCLUDE_DIRS ${LibArchive_INCLUDE_DIR}) + set(LibArchive_LIBRARIES ${LibArchive_LIBRARY}) +endif() diff --git a/Modules/FindLibXml2.cmake b/Modules/FindLibXml2.cmake index 67db321..250c20a 100644 --- a/Modules/FindLibXml2.cmake +++ b/Modules/FindLibXml2.cmake @@ -18,7 +18,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # use pkg-config to get the directories and then use these values diff --git a/Modules/FindLibXslt.cmake b/Modules/FindLibXslt.cmake index a03aa7c..0fcfbf5 100644 --- a/Modules/FindLibXslt.cmake +++ b/Modules/FindLibXslt.cmake @@ -17,7 +17,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # use pkg-config to get the directories and then use these values diff --git a/Modules/FindLua50.cmake b/Modules/FindLua50.cmake index 04f8b28..091e596 100644 --- a/Modules/FindLua50.cmake +++ b/Modules/FindLua50.cmake @@ -21,7 +21,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) FIND_PATH(LUA_INCLUDE_DIR lua.h diff --git a/Modules/FindLua51.cmake b/Modules/FindLua51.cmake index 473138d..e67d545 100644 --- a/Modules/FindLua51.cmake +++ b/Modules/FindLua51.cmake @@ -21,7 +21,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) FIND_PATH(LUA_INCLUDE_DIR lua.h diff --git a/Modules/FindMFC.cmake b/Modules/FindMFC.cmake index 6a3a4b7..3df2842 100644 --- a/Modules/FindMFC.cmake +++ b/Modules/FindMFC.cmake @@ -14,7 +14,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # Assume no MFC support diff --git a/Modules/FindMPEG.cmake b/Modules/FindMPEG.cmake index 0c06c94..9d44ac4 100644 --- a/Modules/FindMPEG.cmake +++ b/Modules/FindMPEG.cmake @@ -17,7 +17,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) FIND_PATH(MPEG_INCLUDE_DIR mpeg2dec/include/video_out.h diff --git a/Modules/FindMPEG2.cmake b/Modules/FindMPEG2.cmake index 7fa7d51..bc1cf2b 100644 --- a/Modules/FindMPEG2.cmake +++ b/Modules/FindMPEG2.cmake @@ -17,7 +17,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) FIND_PATH(MPEG2_INCLUDE_DIR diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake index 481b0e9..45d6bff 100644 --- a/Modules/FindMPI.cmake +++ b/Modules/FindMPI.cmake @@ -62,7 +62,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # This module is maintained by David Partyka <dave.partyka@kitware.com>. @@ -188,7 +188,7 @@ if (MPI_INCLUDE_PATH AND MPI_LIBRARY) # the cache, and we don't want to override those settings. elseif (MPI_COMPILE_CMDLINE) # Extract compile flags from the compile command line. - string(REGEX MATCHALL "-D([^\" ]+|\"[^\"]+\")" MPI_ALL_COMPILE_FLAGS "${MPI_COMPILE_CMDLINE}") + string(REGEX MATCHALL "(^| )-D([^\" ]+|\"[^\"]+\")" MPI_ALL_COMPILE_FLAGS "${MPI_COMPILE_CMDLINE}") set(MPI_COMPILE_FLAGS_WORK) foreach(FLAG ${MPI_ALL_COMPILE_FLAGS}) if (MPI_COMPILE_FLAGS_WORK) @@ -199,10 +199,10 @@ elseif (MPI_COMPILE_CMDLINE) endforeach(FLAG) # Extract include paths from compile command line - string(REGEX MATCHALL "-I([^\" ]+|\"[^\"]+\")" MPI_ALL_INCLUDE_PATHS "${MPI_COMPILE_CMDLINE}") + string(REGEX MATCHALL "(^| )-I([^\" ]+|\"[^\"]+\")" MPI_ALL_INCLUDE_PATHS "${MPI_COMPILE_CMDLINE}") set(MPI_INCLUDE_PATH_WORK) foreach(IPATH ${MPI_ALL_INCLUDE_PATHS}) - string(REGEX REPLACE "^-I" "" IPATH ${IPATH}) + string(REGEX REPLACE "^ ?-I" "" IPATH ${IPATH}) string(REGEX REPLACE "//" "/" IPATH ${IPATH}) list(APPEND MPI_INCLUDE_PATH_WORK ${IPATH}) endforeach(IPATH) @@ -230,10 +230,10 @@ elseif (MPI_COMPILE_CMDLINE) endif (NOT MPI_INCLUDE_PATH_WORK) # Extract linker paths from the link command line - string(REGEX MATCHALL "-L([^\" ]+|\"[^\"]+\")" MPI_ALL_LINK_PATHS "${MPI_LINK_CMDLINE}") + string(REGEX MATCHALL "(^| |-Wl,)-L([^\" ]+|\"[^\"]+\")" MPI_ALL_LINK_PATHS "${MPI_LINK_CMDLINE}") set(MPI_LINK_PATH) foreach(LPATH ${MPI_ALL_LINK_PATHS}) - string(REGEX REPLACE "^-L" "" LPATH ${LPATH}) + string(REGEX REPLACE "^(| |-Wl,)-L" "" LPATH ${LPATH}) string(REGEX REPLACE "//" "/" LPATH ${LPATH}) list(APPEND MPI_LINK_PATH ${LPATH}) endforeach(LPATH) @@ -251,7 +251,7 @@ elseif (MPI_COMPILE_CMDLINE) endif (NOT MPI_LINK_PATH) # Extract linker flags from the link command line - string(REGEX MATCHALL "-Wl,([^\" ]+|\"[^\"]+\")" MPI_ALL_LINK_FLAGS "${MPI_LINK_CMDLINE}") + string(REGEX MATCHALL "(^| )-Wl,([^\" ]+|\"[^\"]+\")" MPI_ALL_LINK_FLAGS "${MPI_LINK_CMDLINE}") set(MPI_LINK_FLAGS_WORK) foreach(FLAG ${MPI_ALL_LINK_FLAGS}) if (MPI_LINK_FLAGS_WORK) @@ -263,20 +263,20 @@ elseif (MPI_COMPILE_CMDLINE) # Extract the set of libraries to link against from the link command # line - string(REGEX MATCHALL "-l([^\" ]+|\"[^\"]+\")" MPI_LIBNAMES "${MPI_LINK_CMDLINE}") + string(REGEX MATCHALL "(^| )-l([^\" ]+|\"[^\"]+\")" MPI_LIBNAMES "${MPI_LINK_CMDLINE}") # Determine full path names for all of the libraries that one needs # to link against in an MPI program set(MPI_LIBRARIES) foreach(LIB ${MPI_LIBNAMES}) - string(REGEX REPLACE "^-l" "" LIB ${LIB}) + string(REGEX REPLACE "^ ?-l" "" LIB ${LIB}) set(MPI_LIB "MPI_LIB-NOTFOUND" CACHE FILEPATH "Cleared" FORCE) find_library(MPI_LIB ${LIB} HINTS ${MPI_LINK_PATH}) if (MPI_LIB) list(APPEND MPI_LIBRARIES ${MPI_LIB}) - else (MPI_LIB) - message(SEND_ERROR "Unable to find MPI library ${LIB}") - endif (MPI_LIB) + elseif (NOT MPI_FIND_QUIETLY) + message(WARNING "Unable to find MPI library ${LIB}") + endif () endforeach(LIB) set(MPI_LIB "MPI_LIB-NOTFOUND" CACHE INTERNAL "Scratch variable for MPI detection" FORCE) @@ -332,12 +332,6 @@ else (MPI_COMPILE_CMDLINE) set(MPI_LINK_FLAGS "" CACHE STRING "MPI linking flags") endif (MPI_INCLUDE_PATH AND MPI_LIBRARY) -# on BlueGene/L the MPI lib is named libmpich.rts.a, there also these additional libs are required -if("${MPI_LIBRARY}" MATCHES "mpich.rts") - set(MPI_EXTRA_LIBRARY ${MPI_EXTRA_LIBRARY} msglayer.rts devices.rts rts.rts devices.rts) - set(MPI_LIBRARY ${MPI_LIBRARY} msglayer.rts devices.rts rts.rts devices.rts) -endif("${MPI_LIBRARY}" MATCHES "mpich.rts") - # Set up extra variables to conform to if (MPI_EXTRA_LIBRARY) set(MPI_LIBRARIES ${MPI_LIBRARY} ${MPI_EXTRA_LIBRARY}) diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake index 13b961a..1cdb071 100644 --- a/Modules/FindMatlab.cmake +++ b/Modules/FindMatlab.cmake @@ -16,7 +16,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) SET(MATLAB_FOUND 0) diff --git a/Modules/FindMotif.cmake b/Modules/FindMotif.cmake index c8715fd..f101545 100644 --- a/Modules/FindMotif.cmake +++ b/Modules/FindMotif.cmake @@ -14,7 +14,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) SET(MOTIF_FOUND 0) diff --git a/Modules/FindOpenAL.cmake b/Modules/FindOpenAL.cmake index f42a69a..8f79436 100644 --- a/Modules/FindOpenAL.cmake +++ b/Modules/FindOpenAL.cmake @@ -20,7 +20,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # This makes the presumption that you are include al.h like diff --git a/Modules/FindOpenGL.cmake b/Modules/FindOpenGL.cmake index 833d7eb..21aafa9 100644 --- a/Modules/FindOpenGL.cmake +++ b/Modules/FindOpenGL.cmake @@ -25,7 +25,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) IF (WIN32) diff --git a/Modules/FindOpenMP.cmake b/Modules/FindOpenMP.cmake index 5ea329d..f149d9f 100644 --- a/Modules/FindOpenMP.cmake +++ b/Modules/FindOpenMP.cmake @@ -21,7 +21,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) include(CheckCSourceCompiles) diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake index b056020..d3d7fc2 100644 --- a/Modules/FindOpenSSL.cmake +++ b/Modules/FindOpenSSL.cmake @@ -1,6 +1,9 @@ # - Try to find the OpenSSL encryption library # Once done this will define # +# OPENSSL_ROOT_DIR - Set this variable to the root installation of OpenSSL +# +# Read-Only variables: # OPENSSL_FOUND - system has the OpenSSL library # OPENSSL_INCLUDE_DIR - the OpenSSL include directory # OPENSSL_LIBRARIES - The libraries needed to use OpenSSL @@ -8,7 +11,7 @@ #============================================================================= # Copyright 2006-2009 Kitware, Inc. # Copyright 2006 Alexander Neundorf <neundorf@kde.org> -# Copyright 2009 Mathieu Malaterre <mathieu.malaterre@gmail.com> +# Copyright 2009-2010 Mathieu Malaterre <mathieu.malaterre@gmail.com> # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -17,12 +20,27 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # http://www.slproweb.com/products/Win32OpenSSL.html +SET(_OPENSSL_ROOT_HINTS + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;Inno Setup: App Path]" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (64-bit)_is1;Inno Setup: App Path]" + ) +SET(_OPENSSL_ROOT_PATHS + "C:/OpenSSL/" + ) +FIND_PATH(OPENSSL_ROOT_DIR + NAMES include/openssl/ssl.h + HINTS ${_OPENSSL_ROOT_HINTS} + PATHS ${_OPENSSL_ROOT_PATHS} +) +MARK_AS_ADVANCED(OPENSSL_ROOT_DIR) + +# Re-use the previous path: FIND_PATH(OPENSSL_INCLUDE_DIR openssl/ssl.h - PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;Inno Setup: App Path]/include" + PATHS ${OPENSSL_ROOT_DIR}/include ) IF(WIN32 AND NOT CYGWIN) @@ -43,21 +61,21 @@ IF(WIN32 AND NOT CYGWIN) # libeay32MD.lib is identical to ../libeay32.lib, and # ssleay32MD.lib is identical to ../ssleay32.lib FIND_LIBRARY(LIB_EAY_DEBUG NAMES libeay32MDd libeay32 - PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;Inno Setup: App Path]/lib/VC" + PATHS ${OPENSSL_ROOT_DIR}/lib/VC ) FIND_LIBRARY(LIB_EAY_RELEASE NAMES libeay32MD libeay32 - PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;Inno Setup: App Path]/lib/VC" + PATHS ${OPENSSL_ROOT_DIR}/lib/VC ) FIND_LIBRARY(SSL_EAY_DEBUG NAMES ssleay32MDd ssleay32 ssl - PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;Inno Setup: App Path]/lib/VC" + PATHS ${OPENSSL_ROOT_DIR}/lib/VC ) FIND_LIBRARY(SSL_EAY_RELEASE NAMES ssleay32MD ssleay32 ssl - PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;Inno Setup: App Path]/lib/VC" + PATHS ${OPENSSL_ROOT_DIR}/lib/VC ) if( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE ) set( OPENSSL_LIBRARIES - optimized ${SSL_EAY_RELEASE} ${LIB_EAY_RELEASE} - debug ${SSL_EAY_DEBUG} ${LIB_EAY_DEBUG} + optimized ${SSL_EAY_RELEASE} debug ${SSL_EAY_DEBUG} + optimized ${LIB_EAY_RELEASE} debug ${LIB_EAY_DEBUG} ) else() set( OPENSSL_LIBRARIES ${SSL_EAY_RELEASE} ${LIB_EAY_RELEASE} ) @@ -67,20 +85,20 @@ IF(WIN32 AND NOT CYGWIN) ELSEIF(MINGW) # same player, for MingW FIND_LIBRARY(LIB_EAY NAMES libeay32 - PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;Inno Setup: App Path]/lib/MinGW" + PATHS ${OPENSSL_ROOT_DIR}/lib/MinGW ) FIND_LIBRARY(SSL_EAY NAMES ssleay32 - PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;Inno Setup: App Path]/lib/MinGW" + PATHS ${OPENSSL_ROOT_DIR}/lib/MinGW ) MARK_AS_ADVANCED(SSL_EAY LIB_EAY) set( OPENSSL_LIBRARIES ${SSL_EAY} ${LIB_EAY} ) ELSE(MSVC) # Not sure what to pick for -say- intel, let's use the toplevel ones and hope someone report issues: FIND_LIBRARY(LIB_EAY NAMES libeay32 - PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;Inno Setup: App Path]/lib" + PATHS ${OPENSSL_ROOT_DIR}/lib ) FIND_LIBRARY(SSL_EAY NAMES ssleay32 - PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;Inno Setup: App Path]/lib" + PATHS ${OPENSSL_ROOT_DIR}/lib ) MARK_AS_ADVANCED(SSL_EAY LIB_EAY) set( OPENSSL_LIBRARIES ${SSL_EAY} ${LIB_EAY} ) diff --git a/Modules/FindOpenSceneGraph.cmake b/Modules/FindOpenSceneGraph.cmake index 25cf4ee..8e6abdb 100644 --- a/Modules/FindOpenSceneGraph.cmake +++ b/Modules/FindOpenSceneGraph.cmake @@ -58,7 +58,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # diff --git a/Modules/FindOpenThreads.cmake b/Modules/FindOpenThreads.cmake index be53953..e1fe937 100644 --- a/Modules/FindOpenThreads.cmake +++ b/Modules/FindOpenThreads.cmake @@ -27,7 +27,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # Header files are presumed to be included like diff --git a/Modules/FindPHP4.cmake b/Modules/FindPHP4.cmake index 4afce99..3b21f89 100644 --- a/Modules/FindPHP4.cmake +++ b/Modules/FindPHP4.cmake @@ -17,7 +17,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) SET(PHP4_POSSIBLE_INCLUDE_PATHS diff --git a/Modules/FindPNG.cmake b/Modules/FindPNG.cmake index bfc5d4a..4fb218b 100644 --- a/Modules/FindPNG.cmake +++ b/Modules/FindPNG.cmake @@ -20,7 +20,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) if(PNG_FIND_QUIETLY) diff --git a/Modules/FindPackageHandleStandardArgs.cmake b/Modules/FindPackageHandleStandardArgs.cmake index e17105c..c698480 100644 --- a/Modules/FindPackageHandleStandardArgs.cmake +++ b/Modules/FindPackageHandleStandardArgs.cmake @@ -1,21 +1,58 @@ -# FIND_PACKAGE_HANDLE_STANDARD_ARGS(NAME (DEFAULT_MSG|"Custom failure message") VAR1 ... ) -# This macro is intended to be used in FindXXX.cmake modules files. -# It handles the REQUIRED and QUIET argument to FIND_PACKAGE() and -# it also sets the <UPPERCASED_NAME>_FOUND variable. -# The package is found if all variables listed are TRUE. -# Example: +# FIND_PACKAGE_HANDLE_STANDARD_ARGS(<name> ... ) # -# FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXml2 DEFAULT_MSG LIBXML2_LIBRARIES LIBXML2_INCLUDE_DIR) +# This function is intended to be used in FindXXX.cmake modules files. +# It handles the REQUIRED, QUIET and version-related arguments to FIND_PACKAGE(). +# It also sets the <UPPERCASED_NAME>_FOUND variable. +# The package is considered found if all variables <var1>... listed contain +# valid results, e.g. valid filepaths. # -# LibXml2 is considered to be found, if both LIBXML2_LIBRARIES and -# LIBXML2_INCLUDE_DIR are valid. Then also LIBXML2_FOUND is set to TRUE. -# If it is not found and REQUIRED was used, it fails with FATAL_ERROR, -# independent whether QUIET was used or not. -# If it is found, the location is reported using the VAR1 argument, so -# here a message "Found LibXml2: /usr/lib/libxml2.so" will be printed out. -# If the second argument is DEFAULT_MSG, the message in the failure case will -# be "Could NOT find LibXml2", if you don't like this message you can specify -# your own custom failure message there. +# There are two modes of this function. The first argument in both modes is +# the name of the Find-module where it is called (in original casing). +# +# The first simple mode looks like this: +# FIND_PACKAGE_HANDLE_STANDARD_ARGS(<name> (DEFAULT_MSG|"Custom failure message") <var1>...<varN> ) +# If the variables <var1> to <varN> are all valid, then <UPPERCASED_NAME>_FOUND +# will be set to TRUE. +# If DEFAULT_MSG is given as second argument, then the function will generate +# itself useful success and error messages. You can also supply a custom error message +# for the failure case. This is not recommended. +# +# The second mode is more powerful and also supports version checking: +# FIND_PACKAGE_HANDLE_STANDARD_ARGS(NAME [REQUIRED_VARS <var1>...<varN>] +# [VERSION_VAR <versionvar> +# [FAIL_MESSAGE "Custom failure message"] ) +# +# As above, if <var1> through <varN> are all valid, <UPPERCASED_NAME>_FOUND +# will be set to TRUE. +# Via FAIL_MESSAGE a custom failure message can be specified, if this is not +# used, the default message will be displayed. +# Following VERSION_VAR the name of the variable can be specified which holds +# the version of the package which has been found. If this is done, this version +# will be checked against the (potentially) specified required version used +# in the find_package() call. The EXACT keyword is also handled. The default +# messages include information about the required version and the version +# which has been actually found, both if the version is ok or not. +# +# Example for mode 1: +# +# FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXml2 DEFAULT_MSG LIBXML2_LIBRARY LIBXML2_INCLUDE_DIR) +# +# LibXml2 is considered to be found, if both LIBXML2_LIBRARY and +# LIBXML2_INCLUDE_DIR are valid. Then also LIBXML2_FOUND is set to TRUE. +# If it is not found and REQUIRED was used, it fails with FATAL_ERROR, +# independent whether QUIET was used or not. +# If it is found, success will be reported, including the content of <var1>. +# On repeated Cmake runs, the same message won't be printed again. +# +# Example for mode 2: +# +# FIND_PACKAGE_HANDLE_STANDARD_ARGS(BISON REQUIRED_VARS BISON_EXECUTABLE +# VERSION_VAR BISON_VERSION) +# In this case, BISON is considered to be found if the variable(s) listed +# after REQUIRED_VAR are all valid, i.e. BISON_EXECUTABLE in this case. +# Also the version of BISON will be checked by using the version contained +# in BISON_VERSION. +# Since no FAIL_MESSAGE is given, the default messages will be printed. #============================================================================= # Copyright 2007-2009 Kitware, Inc. @@ -27,17 +64,51 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) INCLUDE(FindPackageMessage) -FUNCTION(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FAIL_MSG _VAR1 ) +INCLUDE(CMakeParseArguments) + + +FUNCTION(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG _VAR1) + +# set up the arguments for CMAKE_PARSE_ARGUMENTS and check whether we are in +# new extended or in the "old" mode: + SET(options) # none + SET(oneValueArgs FAIL_MESSAGE VERSION_VAR) + SET(multiValueArgs REQUIRED_VARS) + SET(_KEYWORDS_FOR_EXTENDED_MODE ${options} ${oneValueArgs} ${multiValueArgs} ) + LIST(FIND _KEYWORDS_FOR_EXTENDED_MODE "${_FIRST_ARG}" INDEX) + + IF(${INDEX} EQUAL -1) + SET(FPHSA_FAIL_MESSAGE ${_FIRST_ARG}) + SET(FPHSA_REQUIRED_VARS ${_VAR1} ${ARGN}) + SET(FPHSA_VERSION_VAR) + ELSE(${INDEX} EQUAL -1) + + CMAKE_PARSE_ARGUMENTS(FPHSA "${options}" "${oneValueArgs}" "${multiValueArgs}" ${_FIRST_ARG} ${_VAR1} ${ARGN}) + + IF(FPHSA_UNPARSED_ARGUMENTS) + MESSAGE(FATAL_ERROR "Unknown keywords given to FIND_PACKAGE_HANDLE_STANDARD_ARGS(): \"${FPHSA_UNPARSED_ARGUMENTS}\"") + ENDIF(FPHSA_UNPARSED_ARGUMENTS) + + IF(NOT FPHSA_FAIL_MESSAGE) + SET(FPHSA_FAIL_MESSAGE "DEFAULT_MSG") + ENDIF(NOT FPHSA_FAIL_MESSAGE) + ENDIF(${INDEX} EQUAL -1) + +# now that we collected all arguments, process them + + IF("${FPHSA_FAIL_MESSAGE}" STREQUAL "DEFAULT_MSG") + SET(FPHSA_FAIL_MESSAGE "Could NOT find ${_NAME}") + ENDIF("${FPHSA_FAIL_MESSAGE}" STREQUAL "DEFAULT_MSG") + + IF(NOT FPHSA_REQUIRED_VARS) + MESSAGE(FATAL_ERROR "No REQUIRED_VARS specified for FIND_PACKAGE_HANDLE_STANDARD_ARGS()") + ENDIF(NOT FPHSA_REQUIRED_VARS) - IF("${_FAIL_MSG}" STREQUAL "DEFAULT_MSG") - SET(_FAIL_MESSAGE "Could NOT find ${_NAME}") - ELSE("${_FAIL_MSG}" STREQUAL "DEFAULT_MSG") - SET(_FAIL_MESSAGE "${_FAIL_MSG}") - ENDIF("${_FAIL_MSG}" STREQUAL "DEFAULT_MSG") + LIST(GET FPHSA_REQUIRED_VARS 0 _FIRST_REQUIRED_VAR) STRING(TOUPPER ${_NAME} _NAME_UPPER) @@ -46,15 +117,8 @@ FUNCTION(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FAIL_MSG _VAR1 ) SET(MISSING_VARS "") SET(DETAILS "") SET(${_NAME_UPPER}_FOUND TRUE) - IF(NOT ${_VAR1}) - SET(${_NAME_UPPER}_FOUND FALSE) - SET(MISSING_VARS " ${_VAR1}") - ELSE(NOT ${_VAR1}) - SET(DETAILS "${DETAILS}[${${_VAR1}}]") - ENDIF(NOT ${_VAR1}) - # check if all passed variables are valid - FOREACH(_CURRENT_VAR ${ARGN}) + FOREACH(_CURRENT_VAR ${FPHSA_REQUIRED_VARS}) IF(NOT ${_CURRENT_VAR}) SET(${_NAME_UPPER}_FOUND FALSE) SET(MISSING_VARS "${MISSING_VARS} ${_CURRENT_VAR}") @@ -63,18 +127,84 @@ FUNCTION(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FAIL_MSG _VAR1 ) ENDIF(NOT ${_CURRENT_VAR}) ENDFOREACH(_CURRENT_VAR) + + # version handling: + SET(VERSION_MSG "") + SET(VERSION_OK TRUE) + IF (${_NAME}_FIND_VERSION) + + # if the package was found, check for the version using <NAME>_FIND_VERSION + IF (${_NAME_UPPER}_FOUND) + SET(VERSION ${${FPHSA_VERSION_VAR}} ) + + IF(VERSION) + + IF(${_NAME}_FIND_VERSION_EXACT) # exact version required + IF (NOT "${${_NAME}_FIND_VERSION}" VERSION_EQUAL "${VERSION}") + SET(VERSION_MSG " Found version \"${VERSION}\", but required is exact version \"${${_NAME}_FIND_VERSION}\"") + SET(VERSION_OK FALSE) + ELSE (NOT "${${_NAME}_FIND_VERSION}" VERSION_EQUAL "${VERSION}") + SET(VERSION_MSG " (found exact version \"${VERSION}\")") + ENDIF (NOT "${${_NAME}_FIND_VERSION}" VERSION_EQUAL "${VERSION}") + + ELSE(${_NAME}_FIND_VERSION_EXACT) # minimum version specified: + IF ("${${_NAME}_FIND_VERSION}" VERSION_GREATER "${VERSION}") + SET(VERSION_MSG " Found version \"${VERSION}\", but required is at least \"${${_NAME}_FIND_VERSION}\"") + SET(VERSION_OK FALSE) + ELSE ("${${_NAME}_FIND_VERSION}" VERSION_GREATER "${VERSION}") + SET(VERSION_MSG " (found version \"${VERSION}\", required is \"${${_NAME}_FIND_VERSION}\")") + ENDIF ("${${_NAME}_FIND_VERSION}" VERSION_GREATER "${VERSION}") + ENDIF(${_NAME}_FIND_VERSION_EXACT) + +# Uncomment the following two lines to see to which Find-modules the VERSION_VAR keywords still need to be added: +# ELSE(VERSION) +# SET(VERSION_MSG " (WARNING: Required version is \"${${_NAME}_FIND_VERSION}\", but version of ${_NAME} is unknown)") + ENDIF(VERSION) + + # if the package was not found, but a version was given, add that to the output: + ELSE (${_NAME_UPPER}_FOUND) + IF(${_NAME}_FIND_VERSION_EXACT) + SET(VERSION_MSG " (Required is exact version \"${${_NAME}_FIND_VERSION}\")") + ELSE(${_NAME}_FIND_VERSION_EXACT) + SET(VERSION_MSG " (Required is at least version \"${${_NAME}_FIND_VERSION}\")") + ENDIF(${_NAME}_FIND_VERSION_EXACT) + ENDIF (${_NAME_UPPER}_FOUND) + ENDIF (${_NAME}_FIND_VERSION) + + IF(VERSION_OK) + SET(DETAILS "${DETAILS}[v${VERSION}]") + ELSE(VERSION_OK) + SET(${_NAME_UPPER}_FOUND FALSE) + ENDIF(VERSION_OK) + + + # print the result: IF (${_NAME_UPPER}_FOUND) - FIND_PACKAGE_MESSAGE(${_NAME} "Found ${_NAME}: ${${_VAR1}}" "${DETAILS}") + FIND_PACKAGE_MESSAGE(${_NAME} "Found ${_NAME}: ${${_FIRST_REQUIRED_VAR}} ${VERSION_MSG}" "${DETAILS}") ELSE (${_NAME_UPPER}_FOUND) - IF (${_NAME}_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "${_FAIL_MESSAGE} (missing: ${MISSING_VARS})") - ELSE (${_NAME}_FIND_REQUIRED) - IF (NOT ${_NAME}_FIND_QUIETLY) - MESSAGE(STATUS "${_FAIL_MESSAGE} (missing: ${MISSING_VARS})") - ENDIF (NOT ${_NAME}_FIND_QUIETLY) - ENDIF (${_NAME}_FIND_REQUIRED) + IF(NOT VERSION_OK) + + IF (${_NAME}_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "${FPHSA_FAIL_MESSAGE}: ${VERSION_MSG} (found ${${_FIRST_REQUIRED_VAR}})") + ELSE (${_NAME}_FIND_REQUIRED) + IF (NOT ${_NAME}_FIND_QUIETLY) + MESSAGE(STATUS "${FPHSA_FAIL_MESSAGE}: ${VERSION_MSG} (found ${${_FIRST_REQUIRED_VAR}})") + ENDIF (NOT ${_NAME}_FIND_QUIETLY) + ENDIF (${_NAME}_FIND_REQUIRED) + + ELSE(NOT VERSION_OK) + + IF (${_NAME}_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "${FPHSA_FAIL_MESSAGE} (missing: ${MISSING_VARS}) ${VERSION_MSG}") + ELSE (${_NAME}_FIND_REQUIRED) + IF (NOT ${_NAME}_FIND_QUIETLY) + MESSAGE(STATUS "${FPHSA_FAIL_MESSAGE} (missing: ${MISSING_VARS}) ${VERSION_MSG}") + ENDIF (NOT ${_NAME}_FIND_QUIETLY) + ENDIF (${_NAME}_FIND_REQUIRED) + ENDIF(NOT VERSION_OK) + ENDIF (${_NAME_UPPER}_FOUND) SET(${_NAME_UPPER}_FOUND ${${_NAME_UPPER}_FOUND} PARENT_SCOPE) -ENDFUNCTION(FIND_PACKAGE_HANDLE_STANDARD_ARGS) +ENDFUNCTION(FIND_PACKAGE_HANDLE_STANDARD_ARGS _FIRST_ARG) diff --git a/Modules/FindPackageMessage.cmake b/Modules/FindPackageMessage.cmake index aa1bbd9..eb398b2 100644 --- a/Modules/FindPackageMessage.cmake +++ b/Modules/FindPackageMessage.cmake @@ -28,7 +28,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) FUNCTION(FIND_PACKAGE_MESSAGE pkg msg details) diff --git a/Modules/FindPerl.cmake b/Modules/FindPerl.cmake index bf982b2..87d1ff9 100644 --- a/Modules/FindPerl.cmake +++ b/Modules/FindPerl.cmake @@ -14,7 +14,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) INCLUDE(FindCygwin) diff --git a/Modules/FindPerlLibs.cmake b/Modules/FindPerlLibs.cmake index 422282f..d9b0e2b 100644 --- a/Modules/FindPerlLibs.cmake +++ b/Modules/FindPerlLibs.cmake @@ -8,6 +8,9 @@ # PERL_LIBRARY = path to libperl # PERL_EXECUTABLE = full path to the perl binary # +# The minimum required version of Perl can be specified using the +# standard syntax, e.g. FIND_PACKAGE(PerlLibs 6.0) +# # The following variables are also available if needed # (introduced after CMake 2.6.4) # @@ -30,7 +33,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # find the perl executable @@ -227,8 +230,9 @@ endif (PERL_EXECUTABLE) # handle the QUIETLY and REQUIRED arguments and set PERLLIBS_FOUND to TRUE if # all listed variables are TRUE -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(PerlLibs DEFAULT_MSG PERL_LIBRARY PERL_INCLUDE_PATH) +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(PerlLibs REQUIRED_VARS PERL_LIBRARY PERL_INCLUDE_PATH + VERSION_VAR PERL_VERSION) # Introduced after CMake 2.6.4 to bring module into compliance set(PERL_INCLUDE_DIR ${PERL_INCLUDE_PATH}) diff --git a/Modules/FindPhysFS.cmake b/Modules/FindPhysFS.cmake index 98bebe6..c38f4bc 100644 --- a/Modules/FindPhysFS.cmake +++ b/Modules/FindPhysFS.cmake @@ -20,7 +20,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) FIND_PATH(PHYSFS_INCLUDE_DIR physfs.h diff --git a/Modules/FindPike.cmake b/Modules/FindPike.cmake index d1b5ea6..125e428 100644 --- a/Modules/FindPike.cmake +++ b/Modules/FindPike.cmake @@ -17,7 +17,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) FILE(GLOB PIKE_POSSIBLE_INCLUDE_PATHS diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake index 3cbb7af..c47f583 100644 --- a/Modules/FindPkgConfig.cmake +++ b/Modules/FindPkgConfig.cmake @@ -80,7 +80,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) ### Common stuff #### diff --git a/Modules/FindPostgreSQL.cmake b/Modules/FindPostgreSQL.cmake new file mode 100644 index 0000000..6455c99 --- /dev/null +++ b/Modules/FindPostgreSQL.cmake @@ -0,0 +1,181 @@ +# Find the PostgreSQL installation. +# +# ---------------------------------------------------------------------------- +# Usage: +# In your CMakeLists.txt file do something like this: +# ... +# # PostgreSQL +# FIND_PACKAGE(PostgreSQL) +# ... +# if( PostgreSQL_FOUND ) +# include_directories(${PostgreSQL_INCLUDE_DIRS}) +# link_directories(${PostgreSQL_LIBRARY_DIRS}) +# endif( PostgreSQL_FOUND ) +# ... +# Remember to include ${PostgreSQL_LIBRARIES} in the target_link_libraries() statement. +# +# +# In Windows, we make the assumption that, if the PostgreSQL files are installed, the default directory +# will be C:\Program Files\PostgreSQL. +# + +#============================================================================= +# Copyright 2004-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +# ---------------------------------------------------------------------------- +# History: +# This module is derived from the module originally found in the VTK source tree. +# +# ---------------------------------------------------------------------------- +# Note: +# PostgreSQL_ADDITIONAL_VERSIONS is a variable that can be used to set the +# version mumber of the implementation of PostgreSQL. +# In Windows the default installation of PostgreSQL uses that as part of the path. +# E.g C:\Program Files\PostgreSQL\8.4. +# Currently, the following version numbers are known to this module: +# "9.1" "9.0" "8.4" "8.3" "8.2" "8.1" "8.0" +# +# To use this variable just do something like this: +# set(PostgreSQL_ADDITIONAL_VERSIONS "9.2" "8.4.4") +# before calling FIND_PACKAGE(PostgreSQL) in your CMakeLists.txt file. +# This will mean that the versions you set here will be found first in the order +# specified before the default ones are searched. +# +# ---------------------------------------------------------------------------- +# You may need to manually set: +# PostgreSQL_INCLUDE_DIR - the path to where the PostgreSQL include files are. +# PostgreSQL_LIBRARY_DIR - The path to where the PostgreSQL library files are. +# If FindPostgreSQL.cmake cannot find the include files or the library files. +# +# ---------------------------------------------------------------------------- +# The following variables are set if PostgreSQL is found: +# PostgreSQL_FOUND - Set to true when PostgreSQL is found. +# PostgreSQL_INCLUDE_DIRS - Include directories for PostgreSQL +# PostgreSQL_LIBRARY_DIRS - Link directories for PostgreSQL libraries +# PostgreSQL_LIBRARIES - The PostgreSQL libraries. +# +# ---------------------------------------------------------------------------- +# If you have installed PostgreSQL in a non-standard location. +# (Please note that in the following comments, it is assumed that <Your Path> +# points to the root directory of the include directory of PostgreSQL.) +# Then you have three options. +# 1) After CMake runs, set PostgreSQL_INCLUDE_DIR to <Your Path>/include and +# PostgreSQL_LIBRARY_DIR to wherever the library pq (or libpq in windows) is +# 2) Use CMAKE_INCLUDE_PATH to set a path to <Your Path>/PostgreSQL<-version>. This will allow find_path() +# to locate PostgreSQL_INCLUDE_DIR by utilizing the PATH_SUFFIXES option. e.g. In your CMakeLists.txt file +# SET(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "<Your Path>/include") +# 3) Set an environment variable called ${PostgreSQL_ROOT} that points to the root of where you have +# installed PostgreSQL, e.g. <Your Path>. +# +# ---------------------------------------------------------------------------- + +set(PostgreSQL_INCLUDE_PATH_DESCRIPTION "top-level directory containing the PostgreSQL include directories. E.g /usr/local/include/PostgreSQL/8.4 or C:/Program Files/PostgreSQL/8.4/include") +set(PostgreSQL_INCLUDE_DIR_MESSAGE "Set the PostgreSQL_INCLUDE_DIR cmake cache entry to the ${PostgreSQL_INCLUDE_PATH_DESCRIPTION}") +set(PostgreSQL_LIBRARY_PATH_DESCRIPTION "top-level directory containing the PostgreSQL libraries.") +set(PostgreSQL_LIBRARY_DIR_MESSAGE "Set the PostgreSQL_LIBRARY_DIR cmake cache entry to the ${PostgreSQL_LIBRARY_PATH_DESCRIPTION}") +set(PostgreSQL_ROOT_DIR_MESSAGE "Set the PostgreSQL_ROOT system variable to where PostgreSQL is found on the machine E.g C:/Program Files/PostgreSQL/8.4") + + +set(PostgreSQL_ROOT_DIRECTORIES $ENV{PostgreSQL_ROOT}) +if(PostgreSQL_ROOT_DIRECTORIES) + file(TO_CMAKE_PATH ${PostgreSQL_ROOT_DIRECTORIES} PostgreSQL_ROOT_DIRECTORIES) +endif(PostgreSQL_ROOT_DIRECTORIES) + +set(PostgreSQL_KNOWN_VERSIONS ${PostgreSQL_ADDITIONAL_VERSIONS} + "9.1" "9.0" "8.4" "8.3" "8.2" "8.1" "8.0") + +# Define additional search paths for root directories. +if ( WIN32 ) + foreach (suffix ${PostgreSQL_KNOWN_VERSIONS} ) + set(PostgreSQL_ADDITIONAL_SEARCH_PATHS ${PostgreSQL_ADDITIONAL_SEARCH_PATHS} "C:/Program Files/PostgreSQL/${suffix}" ) + endforeach(suffix) +endif( WIN32 ) +set( PostgreSQL_ROOT_DIRECTORIES + ${PostgreSQL_ROOT_DIRECTORIES} + ${PostgreSQL_ROOT} + ${PostgreSQL_ADDITIONAL_SEARCH_PATHS} +) + +# +# Look for an installation. +# +find_path(PostgreSQL_INCLUDE_DIR + NAMES libpq-fe.h + PATHS + # Look in other places. + ${PostgreSQL_ROOT_DIRECTORIES} + PATH_SUFFIXES + postgresql + include + # Help the user find it if we cannot. + DOC "The ${PostgreSQL_INCLUDE_DIR_MESSAGE}" +) + +# The PostgreSQL library. +set (PostgreSQL_LIBRARY_TO_FIND pq) +# Setting some more prefixes for the library +set (PostgreSQL_LIB_PREFIX "") +if ( WIN32 ) + set (PostgreSQL_LIB_PREFIX ${PostgreSQL_LIB_PREFIX} "lib") + set ( PostgreSQL_LIBRARY_TO_FIND ${PostgreSQL_LIB_PREFIX}${PostgreSQL_LIBRARY_TO_FIND}) +endif() + +find_library( PostgreSQL_LIBRARY + NAMES ${PostgreSQL_LIBRARY_TO_FIND} + PATHS + ${PostgreSQL_ROOT_DIRECTORIES} + PATH_SUFFIXES + lib +) +get_filename_component(PostgreSQL_LIBRARY_DIR ${PostgreSQL_LIBRARY} PATH) + +# Did we find anything? +set( PostgreSQL_FOUND 0 ) +if ( EXISTS "${PostgreSQL_INCLUDE_DIR}" AND EXISTS "${PostgreSQL_LIBRARY_DIR}" ) + set( PostgreSQL_FOUND 1 ) +else ( EXISTS "${PostgreSQL_INCLUDE_DIR}" AND EXISTS "${PostgreSQL_LIBRARY_DIR}" ) + if ( POSTGRES_REQUIRED ) + message( FATAL_ERROR "PostgreSQL is required. ${PostgreSQL_ROOT_DIR_MESSAGE}" ) + endif ( POSTGRES_REQUIRED ) +endif (EXISTS "${PostgreSQL_INCLUDE_DIR}" AND EXISTS "${PostgreSQL_LIBRARY_DIR}" ) + +# Now try to get the include and library path. +if(PostgreSQL_FOUND) + + if(EXISTS "${PostgreSQL_INCLUDE_DIR}") + set(PostgreSQL_INCLUDE_DIRS + ${PostgreSQL_INCLUDE_DIR} + ) + endif(EXISTS "${PostgreSQL_INCLUDE_DIR}") + + if(EXISTS "${PostgreSQL_LIBRARY_DIR}") + set(PostgreSQL_LIBRARY_DIRS + ${PostgreSQL_LIBRARY_DIR} + ) + set(PostgreSQL_LIBRARIES ${PostgreSQL_LIBRARY_TO_FIND}) + endif(EXISTS "${PostgreSQL_LIBRARY_DIR}") + + #message("Final PostgreSQL include dir: ${PostgreSQL_INCLUDE_DIRS}") + #message("Final PostgreSQL library dir: ${PostgreSQL_LIBRARY_DIRS}") + #message("Final PostgreSQL libraries: ${PostgreSQL_LIBRARIES}") +endif(PostgreSQL_FOUND) + +if(NOT PostgreSQL_FOUND) + if(NOT PostgreSQL_FIND_QUIETLY) + message(STATUS "PostgreSQL was not found. ${PostgreSQL_DIR_MESSAGE}") + else(NOT PostgreSQL_FIND_QUIETLY) + if(PostgreSQL_FIND_REQUIRED) + message(FATAL_ERROR "PostgreSQL was not found. ${PostgreSQL_DIR_MESSAGE}") + endif(PostgreSQL_FIND_REQUIRED) + endif(NOT PostgreSQL_FIND_QUIETLY) +endif(NOT PostgreSQL_FOUND) diff --git a/Modules/FindProducer.cmake b/Modules/FindProducer.cmake index 3525509..d5aefb9 100644 --- a/Modules/FindProducer.cmake +++ b/Modules/FindProducer.cmake @@ -35,7 +35,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # Header files are presumed to be included like diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake index 1cd59e7..c9823c2 100644 --- a/Modules/FindProtobuf.cmake +++ b/Modules/FindProtobuf.cmake @@ -48,7 +48,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) function(PROTOBUF_GENERATE_CPP SRCS HDRS) diff --git a/Modules/FindPythonInterp.cmake b/Modules/FindPythonInterp.cmake index 167f533..ed6ade6 100644 --- a/Modules/FindPythonInterp.cmake +++ b/Modules/FindPythonInterp.cmake @@ -16,7 +16,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) FIND_PROGRAM(PYTHON_EXECUTABLE diff --git a/Modules/FindPythonLibs.cmake b/Modules/FindPythonLibs.cmake index 1ba21b5..d12f14a 100644 --- a/Modules/FindPythonLibs.cmake +++ b/Modules/FindPythonLibs.cmake @@ -20,7 +20,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) INCLUDE(CMakeFindFrameworks) @@ -105,11 +105,9 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(PythonLibs DEFAULT_MSG PYTHON_LIBRARIES PYTHON # PYTHON_ADD_MODULE(<name> src1 src2 ... srcN) is used to build modules for python. # PYTHON_WRITE_MODULES_HEADER(<filename>) writes a header file you can include # in your sources to initialize the static python modules - -GET_PROPERTY(_TARGET_SUPPORTS_SHARED_LIBS - GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS) - FUNCTION(PYTHON_ADD_MODULE _NAME ) + GET_PROPERTY(_TARGET_SUPPORTS_SHARED_LIBS + GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS) OPTION(PYTHON_ENABLE_MODULE_${_NAME} "Add module ${_NAME}" TRUE) OPTION(PYTHON_MODULE_${_NAME}_BUILD_SHARED "Add module ${_NAME} shared" ${_TARGET_SUPPORTS_SHARED_LIBS}) diff --git a/Modules/FindQt.cmake b/Modules/FindQt.cmake index 85213e8..2b8dfd7 100644 --- a/Modules/FindQt.cmake +++ b/Modules/FindQt.cmake @@ -27,7 +27,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # look for signs of qt3 installations diff --git a/Modules/FindQt3.cmake b/Modules/FindQt3.cmake index d2f2f90..3606a5f 100644 --- a/Modules/FindQt3.cmake +++ b/Modules/FindQt3.cmake @@ -30,7 +30,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # If Qt4 has already been found, fail. diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake index f2de4c9..0a36710 100644 --- a/Modules/FindQt4.cmake +++ b/Modules/FindQt4.cmake @@ -317,7 +317,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # Use FIND_PACKAGE( Qt4 COMPONENTS ... ) to enable modules @@ -358,35 +358,95 @@ SET(QT_USE_FILE ${CMAKE_ROOT}/Modules/UseQt4.cmake) SET( QT_DEFINITIONS "") -SET(QT4_INSTALLED_VERSION_TOO_OLD FALSE) +# convenience macro for dealing with debug/release library names +MACRO (_QT4_ADJUST_LIB_VARS _camelCaseBasename) + + STRING(TOUPPER "${_camelCaseBasename}" basename) + + # The name of the imported targets, i.e. the prefix "Qt4::" must not change, + # since it is stored in EXPORT-files as name of a required library. If the name would change + # here, this would lead to the imported Qt4-library targets not being resolved by cmake anymore. + IF (QT_${basename}_LIBRARY_RELEASE OR QT_${basename}_LIBRARY_DEBUG) + + IF(NOT TARGET Qt4::${_camelCaseBasename}) + ADD_LIBRARY(Qt4::${_camelCaseBasename} UNKNOWN IMPORTED ) + + IF (QT_${basename}_LIBRARY_RELEASE) + SET_PROPERTY(TARGET Qt4::${_camelCaseBasename} APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) + SET_PROPERTY(TARGET Qt4::${_camelCaseBasename} PROPERTY IMPORTED_LOCATION_RELEASE "${QT_${basename}_LIBRARY_RELEASE}" ) + ENDIF (QT_${basename}_LIBRARY_RELEASE) + + IF (QT_${basename}_LIBRARY_DEBUG) + SET_PROPERTY(TARGET Qt4::${_camelCaseBasename} APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG) + SET_PROPERTY(TARGET Qt4::${_camelCaseBasename} PROPERTY IMPORTED_LOCATION_DEBUG "${QT_${basename}_LIBRARY_DEBUG}" ) + ENDIF (QT_${basename}_LIBRARY_DEBUG) + ENDIF(NOT TARGET Qt4::${_camelCaseBasename}) + + # If QT_USE_IMPORTED_TARGETS is enabled, the QT_QTFOO_LIBRARY variables are set to point at these + # imported targets. This works better in general, and is also in almost all cases fully + # backward compatible. The only issue is when a project A which had this enabled then exports its + # libraries via export or EXPORT_LIBRARY_DEPENDENCIES(). In this case the libraries from project + # A will depend on the imported Qt targets, and the names of these imported targets will be stored + # in the dependency files on disk. This means when a project B then uses project A, these imported + # targets must be created again, otherwise e.g. "Qt4__QtCore" will be interpreted as name of a + # library file on disk, and not as a target, and linking will fail: + IF(QT_USE_IMPORTED_TARGETS) + SET(QT_${basename}_LIBRARY Qt4::${_camelCaseBasename} ) + SET(QT_${basename}_LIBRARIES Qt4::${_camelCaseBasename} ) + ELSE(QT_USE_IMPORTED_TARGETS) + + # if the release- as well as the debug-version of the library have been found: + IF (QT_${basename}_LIBRARY_DEBUG AND QT_${basename}_LIBRARY_RELEASE) + # if the generator supports configuration types then set + # optimized and debug libraries, or if the CMAKE_BUILD_TYPE has a value + IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) + SET(QT_${basename}_LIBRARY optimized ${QT_${basename}_LIBRARY_RELEASE} debug ${QT_${basename}_LIBRARY_DEBUG}) + ELSE(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) + # if there are no configuration types and CMAKE_BUILD_TYPE has no value + # then just use the release libraries + SET(QT_${basename}_LIBRARY ${QT_${basename}_LIBRARY_RELEASE} ) + ENDIF(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) + SET(QT_${basename}_LIBRARIES optimized ${QT_${basename}_LIBRARY_RELEASE} debug ${QT_${basename}_LIBRARY_DEBUG}) + ENDIF (QT_${basename}_LIBRARY_DEBUG AND QT_${basename}_LIBRARY_RELEASE) + + # if only the release version was found, set the debug variable also to the release version + IF (QT_${basename}_LIBRARY_RELEASE AND NOT QT_${basename}_LIBRARY_DEBUG) + SET(QT_${basename}_LIBRARY_DEBUG ${QT_${basename}_LIBRARY_RELEASE}) + SET(QT_${basename}_LIBRARY ${QT_${basename}_LIBRARY_RELEASE}) + SET(QT_${basename}_LIBRARIES ${QT_${basename}_LIBRARY_RELEASE}) + ENDIF (QT_${basename}_LIBRARY_RELEASE AND NOT QT_${basename}_LIBRARY_DEBUG) + + # if only the debug version was found, set the release variable also to the debug version + IF (QT_${basename}_LIBRARY_DEBUG AND NOT QT_${basename}_LIBRARY_RELEASE) + SET(QT_${basename}_LIBRARY_RELEASE ${QT_${basename}_LIBRARY_DEBUG}) + SET(QT_${basename}_LIBRARY ${QT_${basename}_LIBRARY_DEBUG}) + SET(QT_${basename}_LIBRARIES ${QT_${basename}_LIBRARY_DEBUG}) + ENDIF (QT_${basename}_LIBRARY_DEBUG AND NOT QT_${basename}_LIBRARY_RELEASE) + + # put the value in the cache: + SET(QT_${basename}_LIBRARY ${QT_${basename}_LIBRARY} CACHE STRING "The Qt ${basename} library" FORCE) + + ENDIF(QT_USE_IMPORTED_TARGETS) + + SET(QT_${basename}_FOUND 1) + + ELSE (QT_${basename}_LIBRARY_RELEASE OR QT_${basename}_LIBRARY_DEBUG) + + SET(QT_${basename}_LIBRARY "" CACHE STRING "The Qt ${basename} library" FORCE) + + ENDIF (QT_${basename}_LIBRARY_RELEASE OR QT_${basename}_LIBRARY_DEBUG) + + IF (QT_${basename}_INCLUDE_DIR) + #add the include directory to QT_INCLUDES + SET(QT_INCLUDES "${QT_${basename}_INCLUDE_DIR}" ${QT_INCLUDES}) + ENDIF (QT_${basename}_INCLUDE_DIR) + + # Make variables changeble to the advanced user + MARK_AS_ADVANCED(QT_${basename}_LIBRARY QT_${basename}_LIBRARY_RELEASE QT_${basename}_LIBRARY_DEBUG QT_${basename}_INCLUDE_DIR) +ENDMACRO (_QT4_ADJUST_LIB_VARS) -# macro for asking qmake to process pro files -MACRO(QT_QUERY_QMAKE outvar invar) - IF(QT_QMAKE_EXECUTABLE) - FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmpQmake/tmp.pro - "message(CMAKE_MESSAGE<$$${invar}>)") - - # Invoke qmake with the tmp.pro program to get the desired - # information. Use the same variable for both stdout and stderr - # to make sure we get the output on all platforms. - EXECUTE_PROCESS(COMMAND ${QT_QMAKE_EXECUTABLE} - WORKING_DIRECTORY - ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmpQmake - OUTPUT_VARIABLE _qmake_query_output - RESULT_VARIABLE _qmake_result - ERROR_VARIABLE _qmake_query_output ) - - FILE(REMOVE_RECURSE - "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmpQmake") - - IF(_qmake_result) - MESSAGE(WARNING " querying qmake for ${invar}. qmake reported:\n${_qmake_query_output}") - ELSE(_qmake_result) - STRING(REGEX REPLACE ".*CMAKE_MESSAGE<([^>]*).*" "\\1" ${outvar} "${_qmake_query_output}") - ENDIF(_qmake_result) - - ENDIF(QT_QMAKE_EXECUTABLE) -ENDMACRO(QT_QUERY_QMAKE) + +SET(QT4_INSTALLED_VERSION_TOO_OLD FALSE) GET_FILENAME_COMPONENT(qt_install_version "[HKEY_CURRENT_USER\\Software\\trolltech\\Versions;DefaultQtVersion]" NAME) # check for qmake @@ -496,53 +556,147 @@ ENDIF (QT_QMAKE_EXECUTABLE) IF (QT4_QMAKE_FOUND) - # ask qmake for the library dir - # Set QT_LIBRARY_DIR - IF (NOT QT_LIBRARY_DIR OR QT_QMAKE_CHANGED) + # ask qmake for the mkspecs directory + # we do this first because QT_LIBINFIX might be set + IF (NOT QT_MKSPECS_DIR OR QT_QMAKE_CHANGED) + EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE} + ARGS "-query QMAKE_MKSPECS" + OUTPUT_VARIABLE qt_mkspecs_dirs ) + # do not replace : on windows as it might be a drive letter + # and windows should already use ; as a separator + IF(NOT WIN32) + STRING(REPLACE ":" ";" qt_mkspecs_dirs "${qt_mkspecs_dirs}") + ENDIF(NOT WIN32) + set(qt_cross_paths) + foreach(qt_cross_path ${CMAKE_FIND_ROOT_PATH}) + set(qt_cross_paths ${qt_cross_paths} "${qt_cross_path}/mkspecs") + endforeach(qt_cross_path) + SET(QT_MKSPECS_DIR NOTFOUND) + FIND_PATH(QT_MKSPECS_DIR NAMES qconfig.pri + HINTS ${qt_cross_paths} ${qt_mkspecs_dirs} + DOC "The location of the Qt mkspecs containing qconfig.pri") + ENDIF() + + IF(EXISTS "${QT_MKSPECS_DIR}/qconfig.pri") + FILE(READ ${QT_MKSPECS_DIR}/qconfig.pri _qconfig_FILE_contents) + STRING(REGEX MATCH "QT_CONFIG[^\n]+" QT_QCONFIG "${_qconfig_FILE_contents}") + STRING(REGEX MATCH "CONFIG[^\n]+" QT_CONFIG "${_qconfig_FILE_contents}") + STRING(REGEX MATCH "EDITION[^\n]+" QT_EDITION "${_qconfig_FILE_contents}") + STRING(REGEX MATCH "QT_LIBINFIX[^\n]+" _qconfig_qt_libinfix "${_qconfig_FILE_contents}") + STRING(REGEX REPLACE "QT_LIBINFIX *= *([^\n]*)" "\\1" QT_LIBINFIX "${_qconfig_qt_libinfix}") + ENDIF(EXISTS "${QT_MKSPECS_DIR}/qconfig.pri") + IF("${QT_EDITION}" MATCHES "DesktopLight") + SET(QT_EDITION_DESKTOPLIGHT 1) + ENDIF("${QT_EDITION}" MATCHES "DesktopLight") + + # ask qmake for the library dir as a hint, then search for QtCore library and use that as a reference for finding the + # others and for setting QT_LIBRARY_DIR + IF (NOT QT_QTCORE_LIBRARY OR QT_QMAKE_CHANGED) EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE} ARGS "-query QT_INSTALL_LIBS" OUTPUT_VARIABLE QT_LIBRARY_DIR_TMP ) # make sure we have / and not \ as qmake gives on windows FILE(TO_CMAKE_PATH "${QT_LIBRARY_DIR_TMP}" QT_LIBRARY_DIR_TMP) - IF(EXISTS "${QT_LIBRARY_DIR_TMP}") - SET(QT_LIBRARY_DIR ${QT_LIBRARY_DIR_TMP} CACHE PATH "Qt library dir" FORCE) - ELSE(EXISTS "${QT_LIBRARY_DIR_TMP}") - MESSAGE("Warning: QT_QMAKE_EXECUTABLE reported QT_INSTALL_LIBS as ${QT_LIBRARY_DIR_TMP}") - MESSAGE("Warning: ${QT_LIBRARY_DIR_TMP} does NOT exist, Qt must NOT be installed correctly.") - ENDIF(EXISTS "${QT_LIBRARY_DIR_TMP}") - ENDIF(NOT QT_LIBRARY_DIR OR QT_QMAKE_CHANGED) - + SET(QT_QTCORE_LIBRARY_RELEASE NOTFOUND) + SET(QT_QTCORE_LIBRARY_DEBUG NOTFOUND) + FIND_LIBRARY(QT_QTCORE_LIBRARY_RELEASE + NAMES QtCore${QT_LIBINFIX} QtCore${QT_LIBINFIX}4 + HINTS ${QT_LIBRARY_DIR_TMP} + ) + FIND_LIBRARY(QT_QTCORE_LIBRARY_DEBUG + NAMES QtCore${QT_LIBINFIX}_debug QtCore${QT_LIBINFIX}d QtCore${QT_LIBINFIX}d4 + HINTS ${QT_LIBRARY_DIR_TMP} + ) + + # try dropping a hint if trying to use Visual Studio with Qt built by mingw + IF(NOT QT_QTCORE_LIBRARY_RELEASE AND MSVC) + IF(EXISTS ${QT_LIBRARY_DIR_TMP}/libqtmain.a) + MESSAGE( FATAL_ERROR "It appears you're trying to use Visual Studio with Qt built by mingw. Those compilers do not produce code compatible with each other.") + ENDIF(EXISTS ${QT_LIBRARY_DIR_TMP}/libqtmain.a) + ENDIF(NOT QT_QTCORE_LIBRARY_RELEASE AND MSVC) + + ENDIF (NOT QT_QTCORE_LIBRARY OR QT_QMAKE_CHANGED) + + _QT4_ADJUST_LIB_VARS(QtCore) + + # set QT_LIBRARY_DIR based on location of QtCore found. + IF(QT_QTCORE_LIBRARY_RELEASE) + GET_FILENAME_COMPONENT(QT_LIBRARY_DIR_TMP "${QT_QTCORE_LIBRARY_RELEASE}" PATH) + SET(QT_LIBRARY_DIR ${QT_LIBRARY_DIR_TMP} CACHE INTERNAL "Qt library dir" FORCE) + SET(QT_QTCORE_FOUND 1) + ELSEIF(QT_QTCORE_LIBRARY_DEBUG) + GET_FILENAME_COMPONENT(QT_LIBRARY_DIR_TMP "${QT_QTCORE_LIBRARY_DEBUG}" PATH) + SET(QT_LIBRARY_DIR ${QT_LIBRARY_DIR_TMP} CACHE INTERNAL "Qt library dir" FORCE) + SET(QT_QTCORE_FOUND 1) + ELSE() + MESSAGE("Warning: QT_QMAKE_EXECUTABLE reported QT_INSTALL_LIBS as ${QT_LIBRARY_DIR_TMP}") + MESSAGE("Warning: But QtCore couldn't be found. Qt must NOT be installed correctly.") + IF(Qt4_FIND_REQUIRED) + MESSAGE( FATAL_ERROR "Could NOT find QtCore. Check ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log for more details.") + ENDIF(Qt4_FIND_REQUIRED) + ENDIF() + IF (APPLE) IF (EXISTS ${QT_LIBRARY_DIR}/QtCore.framework) - SET(QT_USE_FRAMEWORKS ON - CACHE BOOL "Set to ON if Qt build uses frameworks." FORCE) + SET(QT_USE_FRAMEWORKS ON CACHE INTERNAL "" FORCE) ELSE (EXISTS ${QT_LIBRARY_DIR}/QtCore.framework) - SET(QT_USE_FRAMEWORKS OFF - CACHE BOOL "Set to ON if Qt build uses frameworks." FORCE) + SET(QT_USE_FRAMEWORKS OFF CACHE INTERNAL "" FORCE) ENDIF (EXISTS ${QT_LIBRARY_DIR}/QtCore.framework) - MARK_AS_ADVANCED(QT_USE_FRAMEWORKS) ENDIF (APPLE) # ask qmake for the binary dir - IF (QT_LIBRARY_DIR AND NOT QT_BINARY_DIR OR QT_QMAKE_CHANGED) + IF (NOT QT_BINARY_DIR OR QT_QMAKE_CHANGED) EXEC_PROGRAM(${QT_QMAKE_EXECUTABLE} ARGS "-query QT_INSTALL_BINS" OUTPUT_VARIABLE qt_bins ) # make sure we have / and not \ as qmake gives on windows FILE(TO_CMAKE_PATH "${qt_bins}" qt_bins) SET(QT_BINARY_DIR ${qt_bins} CACHE INTERNAL "" FORCE) - ENDIF (QT_LIBRARY_DIR AND NOT QT_BINARY_DIR OR QT_QMAKE_CHANGED) + ENDIF (NOT QT_BINARY_DIR OR QT_QMAKE_CHANGED) # ask qmake for the include dir - IF (QT_LIBRARY_DIR AND NOT QT_HEADERS_DIR OR QT_QMAKE_CHANGED) + IF (QT_LIBRARY_DIR AND (NOT QT_QTCORE_INCLUDE_DIR OR NOT QT_HEADERS_DIR OR QT_QMAKE_CHANGED)) EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE} ARGS "-query QT_INSTALL_HEADERS" OUTPUT_VARIABLE qt_headers ) # make sure we have / and not \ as qmake gives on windows FILE(TO_CMAKE_PATH "${qt_headers}" qt_headers) - SET(QT_HEADERS_DIR ${qt_headers} CACHE INTERNAL "" FORCE) - ENDIF (QT_LIBRARY_DIR AND NOT QT_HEADERS_DIR OR QT_QMAKE_CHANGED) + SET(QT_QTCORE_INCLUDE_DIR NOTFOUND) + FIND_PATH(QT_QTCORE_INCLUDE_DIR QtCore + HINTS ${qt_headers} + ${QT_LIBRARY_DIR}/QtCore.framework/Headers + PATH_SUFFIXES QtCore + ) + + # Set QT_HEADERS_DIR based on finding QtCore header + IF(QT_QTCORE_INCLUDE_DIR) + IF(QT_USE_FRAMEWORKS) + SET(QT_HEADERS_DIR "${qt_headers}" CACHE INTERNAL "" FORCE) + ELSE(QT_USE_FRAMEWORKS) + GET_FILENAME_COMPONENT(qt_headers "${QT_QTCORE_INCLUDE_DIR}/../" ABSOLUTE) + SET(QT_HEADERS_DIR "${qt_headers}" CACHE INTERNAL "" FORCE) + ENDIF(QT_USE_FRAMEWORKS) + ELSEIF() + MESSAGE("Warning: QT_QMAKE_EXECUTABLE reported QT_INSTALL_HEADERS as ${qt_headers}") + MESSAGE("Warning: But QtCore couldn't be found. Qt must NOT be installed correctly.") + ENDIF() + ENDIF() + + # Set QT_INCLUDE_DIR based on QT_HEADERS_DIR + IF(QT_HEADERS_DIR) + IF(QT_USE_FRAMEWORKS) + # Qt/Mac frameworks has two include dirs. + # One is the framework include for which CMake will add a -F flag + # and the other is an include dir for non-framework Qt modules + SET(QT_INCLUDE_DIR ${QT_HEADERS_DIR} ${QT_QTCORE_LIBRARY} ) + ELSE(QT_USE_FRAMEWORKS) + SET(QT_INCLUDE_DIR ${QT_HEADERS_DIR}) + ENDIF(QT_USE_FRAMEWORKS) + ENDIF(QT_HEADERS_DIR) + + # Set QT_INCLUDES + SET( QT_INCLUDES ${QT_MKSPECS_DIR}/default ${QT_INCLUDE_DIR} ${QT_QTCORE_INCLUDE_DIR}) # ask qmake for the documentation directory @@ -555,21 +709,6 @@ IF (QT4_QMAKE_FOUND) SET(QT_DOC_DIR ${qt_doc_dir} CACHE PATH "The location of the Qt docs" FORCE) ENDIF (QT_LIBRARY_DIR AND NOT QT_DOC_DIR OR QT_QMAKE_CHANGED) - # ask qmake for the mkspecs directory - IF (QT_LIBRARY_DIR AND NOT QT_MKSPECS_DIR OR QT_QMAKE_CHANGED) - EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE} - ARGS "-query QMAKE_MKSPECS" - OUTPUT_VARIABLE qt_mkspecs_dirs ) - # do not replace : on windows as it might be a drive letter - # and windows should already use ; as a separator - IF(UNIX) - STRING(REPLACE ":" ";" qt_mkspecs_dirs "${qt_mkspecs_dirs}") - ENDIF(UNIX) - SET(QT_MKSPECS_DIR NOTFOUND) - FIND_PATH(QT_MKSPECS_DIR qconfig.pri PATHS ${qt_mkspecs_dirs} - DOC "The location of the Qt mkspecs containing qconfig.pri" - NO_DEFAULT_PATH ) - ENDIF (QT_LIBRARY_DIR AND NOT QT_MKSPECS_DIR OR QT_QMAKE_CHANGED) # ask qmake for the plugins directory IF (QT_LIBRARY_DIR AND NOT QT_PLUGINS_DIR OR QT_QMAKE_CHANGED) @@ -578,7 +717,13 @@ IF (QT4_QMAKE_FOUND) OUTPUT_VARIABLE qt_plugins_dir ) # make sure we have / and not \ as qmake gives on windows FILE(TO_CMAKE_PATH "${qt_plugins_dir}" qt_plugins_dir) - SET(QT_PLUGINS_DIR ${qt_plugins_dir} CACHE PATH "The location of the Qt plugins" FORCE) + SET(QT_PLUGINS_DIR NOTFOUND) + foreach(qt_cross_path ${CMAKE_FIND_ROOT_PATH}) + set(qt_cross_paths ${qt_cross_paths} "${qt_cross_path}/plugins") + endforeach(qt_cross_path) + FIND_PATH(QT_PLUGINS_DIR NAMES accessible imageformats sqldrivers codecs designer + HINTS ${qt_cross_paths} ${qt_plugins_dir} + DOC "The location of the Qt plugins") ENDIF (QT_LIBRARY_DIR AND NOT QT_PLUGINS_DIR OR QT_QMAKE_CHANGED) # ask qmake for the translations directory @@ -596,6 +741,8 @@ IF (QT4_QMAKE_FOUND) QT_PLUGINS_DIR QT_TRANSLATIONS_DIR) + + ############################################# # # Find out what window system we're using @@ -605,11 +752,7 @@ IF (QT4_QMAKE_FOUND) SET(CMAKE_REQUIRED_INCLUDES_SAVE ${CMAKE_REQUIRED_INCLUDES}) SET(CMAKE_REQUIRED_FLAGS_SAVE ${CMAKE_REQUIRED_FLAGS}) # Add QT_INCLUDE_DIR to CMAKE_REQUIRED_INCLUDES - SET(CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES};${QT_HEADERS_DIR}") - # On Mac OS X when Qt has framework support, also add the framework path - IF( QT_USE_FRAMEWORKS ) - SET(CMAKE_REQUIRED_FLAGS "-F${QT_LIBRARY_DIR} ") - ENDIF( QT_USE_FRAMEWORKS ) + SET(CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES};${QT_INCLUDE_DIR}") # Check for Window system symbols (note: only one should end up being set) CHECK_SYMBOL_EXISTS(Q_WS_X11 "QtCore/qglobal.h" Q_WS_X11) CHECK_SYMBOL_EXISTS(Q_WS_WIN "QtCore/qglobal.h" Q_WS_WIN) @@ -643,7 +786,7 @@ IF (QT4_QMAKE_FOUND) # ######################################## - SET(QT_MODULES QtCore QtGui Qt3Support QtSvg QtScript QtTest QtUiTools + SET(QT_MODULES QtGui Qt3Support QtSvg QtScript QtTest QtUiTools QtHelp QtWebKit QtXmlPatterns phonon QtNetwork QtMultimedia QtNsPlugin QtOpenGL QtSql QtXml QtDesigner QtDBus QtScriptTools QtDeclarative) @@ -676,10 +819,10 @@ IF (QT4_QMAKE_FOUND) SET(QT_QAXSERVER_INCLUDE_DIR NOTFOUND) SET(QT_QAXSERVER_LIBRARY_RELEASE NOTFOUND) SET(QT_QAXSERVER_LIBRARY_DEBUG NOTFOUND) - IF(WIN32) + IF(Q_WS_WIN) SET(QT_QTMAIN_LIBRARY_DEBUG NOTFOUND) SET(QT_QTMAIN_LIBRARY_RELEASE NOTFOUND) - ENDIF(WIN32) + ENDIF(Q_WS_WIN) ENDIF(QT_QMAKE_CHANGED) FOREACH(QT_MODULE ${QT_MODULES}) @@ -702,20 +845,18 @@ IF (QT4_QMAKE_FOUND) ENDIF(${QT_MODULE} STREQUAL "phonon") ENDFOREACH(QT_MODULE) - IF(WIN32) + IF(Q_WS_WIN) SET(QT_MODULES ${QT_MODULES} QAxContainer QAxServer) # Set QT_AXCONTAINER_INCLUDE_DIR and QT_AXSERVER_INCLUDE_DIR FIND_PATH(QT_QAXCONTAINER_INCLUDE_DIR ActiveQt - PATHS - ${QT_HEADERS_DIR}/ActiveQt + PATHS ${QT_HEADERS_DIR}/ActiveQt NO_DEFAULT_PATH ) FIND_PATH(QT_QAXSERVER_INCLUDE_DIR ActiveQt - PATHS - ${QT_HEADERS_DIR}/ActiveQt + PATHS ${QT_HEADERS_DIR}/ActiveQt NO_DEFAULT_PATH ) - ENDIF(WIN32) + ENDIF(Q_WS_WIN) # Set QT_QTDESIGNERCOMPONENTS_INCLUDE_DIR FIND_PATH(QT_QTDESIGNERCOMPONENTS_INCLUDE_DIR QDesignerComponents @@ -741,49 +882,6 @@ IF (QT4_QMAKE_FOUND) NO_DEFAULT_PATH ) - # Set QT_INCLUDE_DIR by removine "/QtCore" in the string ${QT_QTCORE_INCLUDE_DIR} - IF( QT_QTCORE_INCLUDE_DIR ) - IF (QT_USE_FRAMEWORKS) - SET(QT_INCLUDE_DIR ${QT_HEADERS_DIR}) - ELSE (QT_USE_FRAMEWORKS) - STRING( REGEX REPLACE "/QtCore$" "" qt4_include_dir ${QT_QTCORE_INCLUDE_DIR}) - SET( QT_INCLUDE_DIR ${qt4_include_dir}) - ENDIF (QT_USE_FRAMEWORKS) - ENDIF( QT_QTCORE_INCLUDE_DIR ) - - IF( NOT QT_INCLUDE_DIR) - IF(Qt4_FIND_REQUIRED) - MESSAGE( FATAL_ERROR "Could NOT find QtCore header") - ENDIF(Qt4_FIND_REQUIRED) - ENDIF( NOT QT_INCLUDE_DIR) - - # Make variables changeble to the advanced user - MARK_AS_ADVANCED( QT_INCLUDE_DIR ) - - # Set QT_INCLUDES - SET( QT_INCLUDES ${QT_MKSPECS_DIR}/default ${QT_INCLUDE_DIR} ) - - - - - - ####################################### - # - # Qt configuration - # - ####################################### - IF(EXISTS "${QT_MKSPECS_DIR}/qconfig.pri") - FILE(READ ${QT_MKSPECS_DIR}/qconfig.pri _qconfig_FILE_contents) - STRING(REGEX MATCH "QT_CONFIG[^\n]+" QT_QCONFIG "${_qconfig_FILE_contents}") - STRING(REGEX MATCH "CONFIG[^\n]+" QT_CONFIG "${_qconfig_FILE_contents}") - STRING(REGEX MATCH "EDITION[^\n]+" QT_EDITION "${_qconfig_FILE_contents}") - STRING(REGEX MATCH "QT_LIBINFIX[^\n]+" _qconfig_qt_libinfix "${_qconfig_FILE_contents}") - STRING(REGEX REPLACE "QT_LIBINFIX *= *([^\n]*)" "\\1" QT_LIBINFIX "${_qconfig_qt_libinfix}") - ENDIF(EXISTS "${QT_MKSPECS_DIR}/qconfig.pri") - IF("${QT_EDITION}" MATCHES "DesktopLight") - SET(QT_EDITION_DESKTOPLIGHT 1) - ENDIF("${QT_EDITION}" MATCHES "DesktopLight") - ######################################## # # Setting the LIBRARY-Variables @@ -808,48 +906,32 @@ IF (QT4_QMAKE_FOUND) FIND_LIBRARY(QT_QTUITOOLS_LIBRARY_RELEASE NAMES QtUiTools${QT_LIBINFIX} PATHS ${QT_LIBRARY_DIR}) ENDIF(Q_WS_MAC AND QT_QTCORE_LIBRARY_RELEASE AND NOT QT_QTUITOOLS_LIBRARY_RELEASE) - IF( NOT QT_QTCORE_LIBRARY_DEBUG AND NOT QT_QTCORE_LIBRARY_RELEASE ) - - # try dropping a hint if trying to use Visual Studio with Qt built by mingw - IF(QT_LIBRARY_DIR AND MSVC) - IF(EXISTS ${QT_LIBRARY_DIR}/libqtmain.a) - MESSAGE( FATAL_ERROR "It appears you're trying to use Visual Studio with Qt built by mingw") - ENDIF(EXISTS ${QT_LIBRARY_DIR}/libqtmain.a) - ENDIF(QT_LIBRARY_DIR AND MSVC) - - IF(Qt4_FIND_REQUIRED) - MESSAGE( FATAL_ERROR "Could NOT find QtCore. Check ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log for more details.") - ENDIF(Qt4_FIND_REQUIRED) - ENDIF( NOT QT_QTCORE_LIBRARY_DEBUG AND NOT QT_QTCORE_LIBRARY_RELEASE ) - # Set QT_QTDESIGNERCOMPONENTS_LIBRARY - FIND_LIBRARY(QT_QTDESIGNERCOMPONENTS_LIBRARY_RELEASE NAMES QtDesignerComponents${QT_LIBINFIX} QtDesignerComponents${QT_LIBINFIX}4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) + FIND_LIBRARY(QT_QTDESIGNERCOMPONENTS_LIBRARY_RELEASE NAMES QtDesignerComponents${QT_LIBINFIX} QtDesignerComponents${QT_LIBINFIX}4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) FIND_LIBRARY(QT_QTDESIGNERCOMPONENTS_LIBRARY_DEBUG NAMES QtDesignerComponents${QT_LIBINFIX}_debug QtDesignerComponents${QT_LIBINFIX}d QtDesignerComponents${QT_LIBINFIX}d4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) # Set QT_QTMAIN_LIBRARY - IF(WIN32) - FIND_LIBRARY(QT_QTMAIN_LIBRARY_RELEASE NAMES qtmain${QT_LIBINFIX} PATHS ${QT_LIBRARY_DIR} - NO_DEFAULT_PATH) - FIND_LIBRARY(QT_QTMAIN_LIBRARY_DEBUG NAMES qtmain${QT_LIBINFIX}d PATHS ${QT_LIBRARY_DIR} - NO_DEFAULT_PATH) - ENDIF(WIN32) + IF(Q_WS_WIN) + FIND_LIBRARY(QT_QTMAIN_LIBRARY_RELEASE NAMES qtmain${QT_LIBINFIX} PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) + FIND_LIBRARY(QT_QTMAIN_LIBRARY_DEBUG NAMES qtmain${QT_LIBINFIX}d PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) + ENDIF(Q_WS_WIN) # Set QT_QTASSISTANTCLIENT_LIBRARY - FIND_LIBRARY(QT_QTASSISTANTCLIENT_LIBRARY_RELEASE NAMES QtAssistantClient${QT_LIBINFIX} QtAssistantClient${QT_LIBINFIX}4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) - FIND_LIBRARY(QT_QTASSISTANTCLIENT_LIBRARY_DEBUG NAMES QtAssistantClient${QT_LIBINFIX}_debug QtAssistantClient${QT_LIBINFIX}d QtAssistantClient${QT_LIBINFIX}d4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) + FIND_LIBRARY(QT_QTASSISTANTCLIENT_LIBRARY_RELEASE NAMES QtAssistantClient${QT_LIBINFIX} QtAssistantClient${QT_LIBINFIX}4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) + FIND_LIBRARY(QT_QTASSISTANTCLIENT_LIBRARY_DEBUG NAMES QtAssistantClient${QT_LIBINFIX}_debug QtAssistantClient${QT_LIBINFIX}d QtAssistantClient${QT_LIBINFIX}d4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) # Set QT_QTASSISTANT_LIBRARY - FIND_LIBRARY(QT_QTASSISTANT_LIBRARY_RELEASE NAMES QtAssistantClient${QT_LIBINFIX} QtAssistantClient${QT_LIBINFIX}4 QtAssistant${QT_LIBINFIX} QtAssistant${QT_LIBINFIX}4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) + FIND_LIBRARY(QT_QTASSISTANT_LIBRARY_RELEASE NAMES QtAssistantClient${QT_LIBINFIX} QtAssistantClient${QT_LIBINFIX}4 QtAssistant${QT_LIBINFIX} QtAssistant${QT_LIBINFIX}4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) FIND_LIBRARY(QT_QTASSISTANT_LIBRARY_DEBUG NAMES QtAssistantClient${QT_LIBINFIX}_debug QtAssistantClient${QT_LIBINFIX}d QtAssistantClient${QT_LIBINFIX}d4 QtAssistant${QT_LIBINFIX}_debug QtAssistant${QT_LIBINFIX}d4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) # Set QT_QTHELP_LIBRARY - FIND_LIBRARY(QT_QTCLUCENE_LIBRARY_RELEASE NAMES QtCLucene${QT_LIBINFIX} QtCLucene${QT_LIBINFIX}4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) + FIND_LIBRARY(QT_QTCLUCENE_LIBRARY_RELEASE NAMES QtCLucene${QT_LIBINFIX} QtCLucene${QT_LIBINFIX}4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) FIND_LIBRARY(QT_QTCLUCENE_LIBRARY_DEBUG NAMES QtCLucene${QT_LIBINFIX}_debug QtCLucene${QT_LIBINFIX}d QtCLucene${QT_LIBINFIX}d4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) - # QtCLucene not with other frameworks with binary installation (in /usr/lib) IF(Q_WS_MAC AND QT_QTCORE_LIBRARY_RELEASE AND NOT QT_QTCLUCENE_LIBRARY_RELEASE) FIND_LIBRARY(QT_QTCLUCENE_LIBRARY_RELEASE NAMES QtCLucene${QT_LIBINFIX} PATHS ${QT_LIBRARY_DIR}) ENDIF(Q_WS_MAC AND QT_QTCORE_LIBRARY_RELEASE AND NOT QT_QTCLUCENE_LIBRARY_RELEASE) + ############################################ # # Check the existence of the libraries. @@ -863,137 +945,23 @@ IF (QT4_QMAKE_FOUND) ENDIF(QT_USE_FRAMEWORKS) - MACRO (_QT4_ADJUST_LIB_VARS _camelCaseBasename) - - STRING(TOUPPER "${_camelCaseBasename}" basename) - - # The name of the imported targets, i.e. the prefix "Qt4::" must not change, - # since it is stored in EXPORT-files as name of a required library. If the name would change - # here, this would lead to the imported Qt4-library targets not being resolved by cmake anymore. - IF (QT_${basename}_LIBRARY_RELEASE OR QT_${basename}_LIBRARY_DEBUG) - - IF(NOT TARGET Qt4::${_camelCaseBasename}) - ADD_LIBRARY(Qt4::${_camelCaseBasename} UNKNOWN IMPORTED ) - - IF (QT_${basename}_LIBRARY_RELEASE) - SET_PROPERTY(TARGET Qt4::${_camelCaseBasename} APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) - SET_PROPERTY(TARGET Qt4::${_camelCaseBasename} PROPERTY IMPORTED_LOCATION_RELEASE "${QT_${basename}_LIBRARY_RELEASE}" ) - ENDIF (QT_${basename}_LIBRARY_RELEASE) - - IF (QT_${basename}_LIBRARY_DEBUG) - SET_PROPERTY(TARGET Qt4::${_camelCaseBasename} APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG) - SET_PROPERTY(TARGET Qt4::${_camelCaseBasename} PROPERTY IMPORTED_LOCATION_DEBUG "${QT_${basename}_LIBRARY_DEBUG}" ) - ENDIF (QT_${basename}_LIBRARY_DEBUG) - ENDIF(NOT TARGET Qt4::${_camelCaseBasename}) - - # If QT_USE_IMPORTED_TARGETS is enabled, the QT_QTFOO_LIBRARY variables are set to point at these - # imported targets. This works better in general, and is also in almost all cases fully - # backward compatible. The only issue is when a project A which had this enabled then exports its - # libraries via export or EXPORT_LIBRARY_DEPENDENCIES(). In this case the libraries from project - # A will depend on the imported Qt targets, and the names of these imported targets will be stored - # in the dependency files on disk. This means when a project B then uses project A, these imported - # targets must be created again, otherwise e.g. "Qt4__QtCore" will be interpreted as name of a - # library file on disk, and not as a target, and linking will fail: - IF(QT_USE_IMPORTED_TARGETS) - SET(QT_${basename}_LIBRARY Qt4::${_camelCaseBasename} ) - SET(QT_${basename}_LIBRARIES Qt4::${_camelCaseBasename} ) - ELSE(QT_USE_IMPORTED_TARGETS) - - # if the release- as well as the debug-version of the library have been found: - IF (QT_${basename}_LIBRARY_DEBUG AND QT_${basename}_LIBRARY_RELEASE) - # if the generator supports configuration types then set - # optimized and debug libraries, or if the CMAKE_BUILD_TYPE has a value - IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) - SET(QT_${basename}_LIBRARY optimized ${QT_${basename}_LIBRARY_RELEASE} debug ${QT_${basename}_LIBRARY_DEBUG}) - ELSE(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) - # if there are no configuration types and CMAKE_BUILD_TYPE has no value - # then just use the release libraries - SET(QT_${basename}_LIBRARY ${QT_${basename}_LIBRARY_RELEASE} ) - ENDIF(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) - SET(QT_${basename}_LIBRARIES optimized ${QT_${basename}_LIBRARY_RELEASE} debug ${QT_${basename}_LIBRARY_DEBUG}) - ENDIF (QT_${basename}_LIBRARY_DEBUG AND QT_${basename}_LIBRARY_RELEASE) - - # if only the release version was found, set the debug variable also to the release version - IF (QT_${basename}_LIBRARY_RELEASE AND NOT QT_${basename}_LIBRARY_DEBUG) - SET(QT_${basename}_LIBRARY_DEBUG ${QT_${basename}_LIBRARY_RELEASE}) - SET(QT_${basename}_LIBRARY ${QT_${basename}_LIBRARY_RELEASE}) - SET(QT_${basename}_LIBRARIES ${QT_${basename}_LIBRARY_RELEASE}) - ENDIF (QT_${basename}_LIBRARY_RELEASE AND NOT QT_${basename}_LIBRARY_DEBUG) - - # if only the debug version was found, set the release variable also to the debug version - IF (QT_${basename}_LIBRARY_DEBUG AND NOT QT_${basename}_LIBRARY_RELEASE) - SET(QT_${basename}_LIBRARY_RELEASE ${QT_${basename}_LIBRARY_DEBUG}) - SET(QT_${basename}_LIBRARY ${QT_${basename}_LIBRARY_DEBUG}) - SET(QT_${basename}_LIBRARIES ${QT_${basename}_LIBRARY_DEBUG}) - ENDIF (QT_${basename}_LIBRARY_DEBUG AND NOT QT_${basename}_LIBRARY_RELEASE) - - # put the value in the cache: - SET(QT_${basename}_LIBRARY ${QT_${basename}_LIBRARY} CACHE STRING "The Qt ${basename} library" FORCE) - - ENDIF(QT_USE_IMPORTED_TARGETS) - -# message(STATUS "QT_${basename}_LIBRARY: ${QT_${basename}_LIBRARY}") - - SET(QT_${basename}_FOUND 1) - - ENDIF (QT_${basename}_LIBRARY_RELEASE OR QT_${basename}_LIBRARY_DEBUG) - - IF (QT_${basename}_INCLUDE_DIR) - #add the include directory to QT_INCLUDES - SET(QT_INCLUDES "${QT_${basename}_INCLUDE_DIR}" ${QT_INCLUDES}) - ENDIF (QT_${basename}_INCLUDE_DIR) - - # Make variables changeble to the advanced user - MARK_AS_ADVANCED(QT_${basename}_LIBRARY QT_${basename}_LIBRARY_RELEASE QT_${basename}_LIBRARY_DEBUG QT_${basename}_INCLUDE_DIR) - ENDMACRO (_QT4_ADJUST_LIB_VARS) - - # Set QT_xyz_LIBRARY variable and add # library include path to QT_INCLUDES - _QT4_ADJUST_LIB_VARS(QtCore) - _QT4_ADJUST_LIB_VARS(QtGui) - _QT4_ADJUST_LIB_VARS(Qt3Support) + FOREACH(QT_MODULE ${QT_MODULES}) + _QT4_ADJUST_LIB_VARS(${QT_MODULE}) + ENDFOREACH(QT_MODULE) + _QT4_ADJUST_LIB_VARS(QtAssistant) _QT4_ADJUST_LIB_VARS(QtAssistantClient) _QT4_ADJUST_LIB_VARS(QtCLucene) - _QT4_ADJUST_LIB_VARS(QtDBus) - _QT4_ADJUST_LIB_VARS(QtDeclarative) - _QT4_ADJUST_LIB_VARS(QtDesigner) _QT4_ADJUST_LIB_VARS(QtDesignerComponents) - _QT4_ADJUST_LIB_VARS(QtHelp) - _QT4_ADJUST_LIB_VARS(QtMultimedia) - _QT4_ADJUST_LIB_VARS(QtNetwork) - _QT4_ADJUST_LIB_VARS(QtNsPlugin) - _QT4_ADJUST_LIB_VARS(QtOpenGL) - _QT4_ADJUST_LIB_VARS(QtScript) - _QT4_ADJUST_LIB_VARS(QtScriptTools) - _QT4_ADJUST_LIB_VARS(QtSql) - _QT4_ADJUST_LIB_VARS(QtSvg) - _QT4_ADJUST_LIB_VARS(QtTest) - _QT4_ADJUST_LIB_VARS(QtUiTools) - _QT4_ADJUST_LIB_VARS(QtWebKit) - _QT4_ADJUST_LIB_VARS(QtXml) - _QT4_ADJUST_LIB_VARS(QtXmlPatterns) - _QT4_ADJUST_LIB_VARS(phonon) # platform dependent libraries - IF(Q_WS_X11) - _QT4_ADJUST_LIB_VARS(QtMotif) - ENDIF(Q_WS_X11) - IF(WIN32) + IF(Q_WS_WIN) _QT4_ADJUST_LIB_VARS(qtmain) _QT4_ADJUST_LIB_VARS(QAxServer) _QT4_ADJUST_LIB_VARS(QAxContainer) - ENDIF(WIN32) - - # If Qt is installed as a framework, we need to add QT_QTCORE_LIBRARY here (which - # is the framework directory in that case), since this will make the cmake include_directories() - # command recognize that we need the framework flag with the respective directory (-F) - IF(QT_USE_FRAMEWORKS) - SET(QT_INCLUDES ${QT_INCLUDES} ${QT_QTCORE_LIBRARY} ) - SET(QT_INCLUDE_DIR ${QT_INCLUDE_DIR} ${QT_QTCORE_LIBRARY} ) - ENDIF(QT_USE_FRAMEWORKS) - + ENDIF(Q_WS_WIN) ####################################### diff --git a/Modules/FindQuickTime.cmake b/Modules/FindQuickTime.cmake index f693543..b86a59f 100644 --- a/Modules/FindQuickTime.cmake +++ b/Modules/FindQuickTime.cmake @@ -19,7 +19,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # QuickTime on OS X looks different than QuickTime for Windows, diff --git a/Modules/FindRTI.cmake b/Modules/FindRTI.cmake index aa4d5f6..b27eaa7 100644 --- a/Modules/FindRTI.cmake +++ b/Modules/FindRTI.cmake @@ -26,7 +26,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) MACRO(RTI_MESSAGE_QUIETLY QUIET TYPE MSG) diff --git a/Modules/FindRuby.cmake b/Modules/FindRuby.cmake index 45e2da6..2e78d85 100644 --- a/Modules/FindRuby.cmake +++ b/Modules/FindRuby.cmake @@ -1,7 +1,10 @@ # - Find Ruby # This module finds if Ruby is installed and determines where the include files -# and libraries are. Ruby 1.8 and 1.9 are supported. The minimum required version -# specified in the find_package() command is honored. +# and libraries are. Ruby 1.8 and 1.9 are supported. +# +# The minimum required version of Ruby can be specified using the +# standard syntax, e.g. FIND_PACKAGE(Ruby 1.8) +# # It also determines what the name of the library is. This # code sets the following variables: # @@ -24,7 +27,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # RUBY_ARCHDIR=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"archdir"@:>@)'` @@ -154,22 +157,6 @@ 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}") -# Now we know which version we found -IF(Ruby_FIND_VERSION) - IF(${RUBY_VERSION} VERSION_LESS ${Ruby_FIND_VERSION}) - # force running ruby the next time again - SET(RUBY_VERSION_MAJOR "" CACHE PATH "The Ruby major version" FORCE) - IF(Ruby_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "Ruby version ${Ruby_FIND_VERSION} required, but only version ${RUBY_VERSION} found.") - ELSE(Ruby_FIND_REQUIRED) - IF(NOT Ruby_FIND_QUIETLY) - MESSAGE(STATUS "Ruby version ${Ruby_FIND_VERSION} required, but only version ${RUBY_VERSION} found.") - ENDIF(NOT Ruby_FIND_QUIETLY) - RETURN() - ENDIF(Ruby_FIND_REQUIRED) - ENDIF(${RUBY_VERSION} VERSION_LESS ${Ruby_FIND_VERSION}) -ENDIF(Ruby_FIND_VERSION) - FIND_PATH(RUBY_INCLUDE_DIR NAMES ruby.h HINTS @@ -240,7 +227,8 @@ IF(_RUBY_DEBUG_OUTPUT) MESSAGE(STATUS "--------------------") ENDIF(_RUBY_DEBUG_OUTPUT) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(Ruby DEFAULT_MSG ${_RUBY_REQUIRED_VARS}) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Ruby REQUIRED_VARS ${_RUBY_REQUIRED_VARS} + VERSION_VAR RUBY_VERSION ) MARK_AS_ADVANCED( RUBY_EXECUTABLE diff --git a/Modules/FindSDL.cmake b/Modules/FindSDL.cmake index cc07116..0dc02f5 100644 --- a/Modules/FindSDL.cmake +++ b/Modules/FindSDL.cmake @@ -62,7 +62,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) FIND_PATH(SDL_INCLUDE_DIR SDL.h diff --git a/Modules/FindSDL_image.cmake b/Modules/FindSDL_image.cmake index c853971..5a5f59b 100644 --- a/Modules/FindSDL_image.cmake +++ b/Modules/FindSDL_image.cmake @@ -22,7 +22,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) FIND_PATH(SDLIMAGE_INCLUDE_DIR SDL_image.h diff --git a/Modules/FindSDL_mixer.cmake b/Modules/FindSDL_mixer.cmake index a5e213f..e2b2294 100644 --- a/Modules/FindSDL_mixer.cmake +++ b/Modules/FindSDL_mixer.cmake @@ -22,7 +22,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) FIND_PATH(SDLMIXER_INCLUDE_DIR SDL_mixer.h diff --git a/Modules/FindSDL_net.cmake b/Modules/FindSDL_net.cmake index 169c8a5..730b129 100644 --- a/Modules/FindSDL_net.cmake +++ b/Modules/FindSDL_net.cmake @@ -22,7 +22,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) FIND_PATH(SDLNET_INCLUDE_DIR SDL_net.h diff --git a/Modules/FindSDL_sound.cmake b/Modules/FindSDL_sound.cmake index 20d8f4f..959f3eb 100644 --- a/Modules/FindSDL_sound.cmake +++ b/Modules/FindSDL_sound.cmake @@ -66,7 +66,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) SET(SDL_SOUND_EXTRAS "" CACHE STRING "SDL_sound extra flags") diff --git a/Modules/FindSDL_ttf.cmake b/Modules/FindSDL_ttf.cmake index 213b835..b36ddd3 100644 --- a/Modules/FindSDL_ttf.cmake +++ b/Modules/FindSDL_ttf.cmake @@ -22,7 +22,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) FIND_PATH(SDLTTF_INCLUDE_DIR SDL_ttf.h diff --git a/Modules/FindSWIG.cmake b/Modules/FindSWIG.cmake index 05c09b4..68a913d 100644 --- a/Modules/FindSWIG.cmake +++ b/Modules/FindSWIG.cmake @@ -5,7 +5,10 @@ # SWIG_EXECUTABLE - the path to the swig executable # SWIG_VERSION - the version number of the swig executable # -# All informations are collected from the SWIG_EXECUTABLE so the +# The minimum required version of SWIG can be specified using the +# standard syntax, e.g. FIND_PACKAGE(SWIG 1.1) +# +# All information is collected from the SWIG_EXECUTABLE so the # version to be found can be changed from the command line by # means of setting SWIG_EXECUTABLE # @@ -20,11 +23,9 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -SET(SWIG_FOUND FALSE) - FIND_PROGRAM(SWIG_EXECUTABLE swig) IF(SWIG_EXECUTABLE) @@ -45,7 +46,6 @@ IF(SWIG_EXECUTABLE) SET(SWIG_DIR SWIG_DIR-NOTFOUND) FIND_PATH(SWIG_DIR swig.swg PATHS ${SWIG_swiglib_output}) IF(SWIG_DIR) - SET(SWIG_FOUND 1) SET(SWIG_USE_FILE ${CMAKE_ROOT}/Modules/UseSWIG.cmake) EXECUTE_PROCESS(COMMAND ${SWIG_EXECUTABLE} -version OUTPUT_VARIABLE SWIG_version_output @@ -62,12 +62,6 @@ IF(SWIG_EXECUTABLE) ENDIF(SWIG_swiglib_result) ENDIF(SWIG_EXECUTABLE) -IF(NOT SWIG_FOUND) - IF(NOT SWIG_FIND_QUIETLY) - IF(SWIG_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "SWIG was not found. Please specify Swig executable location") - ELSE(SWIG_FIND_REQUIRED) - MESSAGE(STATUS "SWIG was not found. Please specify Swig executable location") - ENDIF(SWIG_FIND_REQUIRED) - ENDIF(NOT SWIG_FIND_QUIETLY) -ENDIF(NOT SWIG_FOUND) +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(SWIG REQUIRED_VARS SWIG_EXECUTABLE SWIG_DIR + VERSION_VAR SWIG_VERSION ) diff --git a/Modules/FindSelfPackers.cmake b/Modules/FindSelfPackers.cmake index 9fab6b9..ffca842 100644 --- a/Modules/FindSelfPackers.cmake +++ b/Modules/FindSelfPackers.cmake @@ -15,7 +15,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) INCLUDE(FindCygwin) diff --git a/Modules/FindSquish.cmake b/Modules/FindSquish.cmake index 2327186..b0b6b2f 100644 --- a/Modules/FindSquish.cmake +++ b/Modules/FindSquish.cmake @@ -4,9 +4,6 @@ # # ---- Variables and Macros # SQUISH_FOUND If false, don't try to use Squish -# SQUISH_VERSION_MAJOR The major version of Squish found -# SQUISH_VERSION_MINOR The minor version of Squish found -# SQUISH_VERSION_PATCH The patch version of Squish found # # SQUISH_INSTALL_DIR The Squish installation directory (containing bin, lib, etc) # SQUISH_SERVER_EXECUTABLE The squishserver executable @@ -36,7 +33,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) SET(SQUISH_INSTALL_DIR_STRING "Directory containing the bin, doc, and lib directories for Squish; this should be the root of the installation directory.") diff --git a/Modules/FindSubversion.cmake b/Modules/FindSubversion.cmake index 58a179d..9bad3b1 100644 --- a/Modules/FindSubversion.cmake +++ b/Modules/FindSubversion.cmake @@ -3,6 +3,11 @@ # Subversion_SVN_EXECUTABLE - path to svn command line client # Subversion_VERSION_SVN - version of svn command line client # Subversion_FOUND - true if the command line client was found +# SUBVERSION_FOUND - same as Subversion_FOUND, set for compatiblity reasons +# +# The minimum required version of Subversion can be specified using the +# standard syntax, e.g. FIND_PACKAGE(Subversion 1.4) +# # If the command line client executable is found the macro # Subversion_WC_INFO(<dir> <var-prefix>) # is defined to extract information of a subversion working copy at @@ -17,12 +22,12 @@ # <var-prefix>_WC_INFO - output of command `svn info <dir>' # Example usage: # FIND_PACKAGE(Subversion) -# IF(Subversion_FOUND) +# IF(SUBVERSION_FOUND) # Subversion_WC_INFO(${PROJECT_SOURCE_DIR} Project) # MESSAGE("Current revision is ${Project_WC_REVISION}") # Subversion_WC_LOG(${PROJECT_SOURCE_DIR} Project) # MESSAGE("Last changed log is ${Project_LAST_CHANGED_LOG}") -# ENDIF(Subversion_FOUND) +# ENDIF(SUBVERSION_FOUND) #============================================================================= # Copyright 2006-2009 Kitware, Inc. @@ -35,19 +40,21 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -SET(Subversion_FOUND FALSE) -SET(Subversion_SVN_FOUND FALSE) - FIND_PROGRAM(Subversion_SVN_EXECUTABLE svn DOC "subversion command line client") MARK_AS_ADVANCED(Subversion_SVN_EXECUTABLE) IF(Subversion_SVN_EXECUTABLE) - SET(Subversion_SVN_FOUND TRUE) - SET(Subversion_FOUND TRUE) + + EXECUTE_PROCESS(COMMAND ${Subversion_SVN_EXECUTABLE} --version + OUTPUT_VARIABLE Subversion_VERSION_SVN + OUTPUT_STRIP_TRAILING_WHITESPACE) + + STRING(REGEX REPLACE "^(.*\n)?svn, version ([.0-9]+).*" + "\\2" Subversion_VERSION_SVN "${Subversion_VERSION_SVN}") MACRO(Subversion_WC_INFO dir prefix) # the subversion commands should be executed with the C locale, otherwise @@ -55,11 +62,6 @@ IF(Subversion_SVN_EXECUTABLE) SET(_Subversion_SAVED_LC_ALL "$ENV{LC_ALL}") SET(ENV{LC_ALL} C) - EXECUTE_PROCESS(COMMAND ${Subversion_SVN_EXECUTABLE} --version - WORKING_DIRECTORY ${dir} - OUTPUT_VARIABLE Subversion_VERSION_SVN - OUTPUT_STRIP_TRAILING_WHITESPACE) - EXECUTE_PROCESS(COMMAND ${Subversion_SVN_EXECUTABLE} info ${dir} OUTPUT_VARIABLE ${prefix}_WC_INFO ERROR_VARIABLE Subversion_svn_info_error @@ -70,8 +72,6 @@ IF(Subversion_SVN_EXECUTABLE) MESSAGE(SEND_ERROR "Command \"${Subversion_SVN_EXECUTABLE} info ${dir}\" failed with output:\n${Subversion_svn_info_error}") ELSE(NOT ${Subversion_svn_info_result} EQUAL 0) - STRING(REGEX REPLACE "^(.*\n)?svn, version ([.0-9]+).*" - "\\2" Subversion_VERSION_SVN "${Subversion_VERSION_SVN}") STRING(REGEX REPLACE "^(.*\n)?URL: ([^\n]+).*" "\\2" ${prefix}_WC_URL "${${prefix}_WC_INFO}") STRING(REGEX REPLACE "^(.*\n)?Revision: ([^\n]+).*" @@ -110,4 +110,9 @@ IF(Subversion_SVN_EXECUTABLE) ENDIF(Subversion_SVN_EXECUTABLE) INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(Subversion DEFAULT_MSG Subversion_SVN_EXECUTABLE) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Subversion REQUIRED_VARS Subversion_SVN_EXECUTABLE + VERSION_VAR Subversion_VERSION_SVN ) + +# for compatibility +SET(Subversion_FOUND ${SUBVERSION_FOUND}) +SET(Subversion_SVN_FOUND ${SUBVERSION_FOUND}) diff --git a/Modules/FindTCL.cmake b/Modules/FindTCL.cmake index 67a3f9a..314d706 100644 --- a/Modules/FindTCL.cmake +++ b/Modules/FindTCL.cmake @@ -41,7 +41,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) INCLUDE(CMakeFindFrameworks) diff --git a/Modules/FindTIFF.cmake b/Modules/FindTIFF.cmake index 8711634..6f06ff1 100644 --- a/Modules/FindTIFF.cmake +++ b/Modules/FindTIFF.cmake @@ -17,12 +17,12 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) FIND_PATH(TIFF_INCLUDE_DIR tiff.h) -SET(TIFF_NAMES ${TIFF_NAMES} tiff libtiff libtiff3) +SET(TIFF_NAMES ${TIFF_NAMES} tiff libtiff tiff3 libtiff3) FIND_LIBRARY(TIFF_LIBRARY NAMES ${TIFF_NAMES} ) # handle the QUIETLY and REQUIRED arguments and set TIFF_FOUND to TRUE if diff --git a/Modules/FindTclStub.cmake b/Modules/FindTclStub.cmake index 896d4b1..4db2716 100644 --- a/Modules/FindTclStub.cmake +++ b/Modules/FindTclStub.cmake @@ -31,7 +31,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) INCLUDE(FindTCL) diff --git a/Modules/FindTclsh.cmake b/Modules/FindTclsh.cmake index 9b7529b..322c3a9 100644 --- a/Modules/FindTclsh.cmake +++ b/Modules/FindTclsh.cmake @@ -17,7 +17,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) IF(CYGWIN) diff --git a/Modules/FindThreads.cmake b/Modules/FindThreads.cmake index 459129b..25d48d1 100644 --- a/Modules/FindThreads.cmake +++ b/Modules/FindThreads.cmake @@ -5,6 +5,8 @@ # CMAKE_USE_WIN32_THREADS_INIT - using WIN32 threads? # CMAKE_USE_PTHREADS_INIT - are we using pthreads # CMAKE_HP_PTHREADS_INIT - are we using hp pthreads +# For systems with multiple thread libraries, caller can set +# CMAKE_THREAD_PREFER_PTHREADS #============================================================================= # Copyright 2002-2009 Kitware, Inc. @@ -16,7 +18,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) INCLUDE (CheckIncludeFiles) @@ -24,11 +26,11 @@ INCLUDE (CheckLibraryExists) SET(Threads_FOUND FALSE) # Do we have sproc? -IF(CMAKE_SYSTEM MATCHES IRIX) +IF(CMAKE_SYSTEM MATCHES IRIX AND NOT CMAKE_THREAD_PREFER_PTHREAD) CHECK_INCLUDE_FILES("sys/types.h;sys/prctl.h" CMAKE_HAVE_SPROC_H) ENDIF() -IF(CMAKE_HAVE_SPROC_H) +IF(CMAKE_HAVE_SPROC_H AND NOT CMAKE_THREAD_PREFER_PTHREAD) # We have sproc SET(CMAKE_USE_SPROC_INIT 1) ELSE() diff --git a/Modules/FindUnixCommands.cmake b/Modules/FindUnixCommands.cmake index c1d2c45..9c0264d 100644 --- a/Modules/FindUnixCommands.cmake +++ b/Modules/FindUnixCommands.cmake @@ -12,7 +12,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) INCLUDE(FindCygwin) diff --git a/Modules/FindVTK.cmake b/Modules/FindVTK.cmake index 69e1874..6b1772f 100644 --- a/Modules/FindVTK.cmake +++ b/Modules/FindVTK.cmake @@ -37,7 +37,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # Assume not found. diff --git a/Modules/FindWget.cmake b/Modules/FindWget.cmake index c898b89..97c4302 100644 --- a/Modules/FindWget.cmake +++ b/Modules/FindWget.cmake @@ -14,7 +14,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) INCLUDE(FindCygwin) diff --git a/Modules/FindWish.cmake b/Modules/FindWish.cmake index c086da5..a4960cd 100644 --- a/Modules/FindWish.cmake +++ b/Modules/FindWish.cmake @@ -17,7 +17,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) IF(UNIX) diff --git a/Modules/FindX11.cmake b/Modules/FindX11.cmake index f056413..df44979 100644 --- a/Modules/FindX11.cmake +++ b/Modules/FindX11.cmake @@ -46,7 +46,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) IF (UNIX) diff --git a/Modules/FindXMLRPC.cmake b/Modules/FindXMLRPC.cmake index 48f87d7..eccfb48 100644 --- a/Modules/FindXMLRPC.cmake +++ b/Modules/FindXMLRPC.cmake @@ -22,7 +22,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # First find the config script from which to obtain other values. diff --git a/Modules/FindZLIB.cmake b/Modules/FindZLIB.cmake index b437e6b..1ac6c2c 100644 --- a/Modules/FindZLIB.cmake +++ b/Modules/FindZLIB.cmake @@ -1,12 +1,20 @@ # - Find zlib -# Find the native ZLIB includes and library +# Find the native ZLIB includes and library. +# Once done this will define # # ZLIB_INCLUDE_DIRS - where to find zlib.h, etc. # ZLIB_LIBRARIES - List of libraries when using zlib. # ZLIB_FOUND - True if zlib found. # # ZLIB_VERSION_STRING - The version of zlib found (x.y.z) -# ZLIB_MAJOR_VERSION - the major version of zlib +# ZLIB_VERSION_MAJOR - The major version of zlib +# ZLIB_VERSION_MINOR - The minor version of zlib +# ZLIB_VERSION_PATCH - The patch version of zlib +# ZLIB_VERSION_TWEAK - The tweak version of zlib +# +# The following variable are provided for backward compatibility +# +# ZLIB_MAJOR_VERSION - The major version of zlib # ZLIB_MINOR_VERSION - The minor version of zlib # ZLIB_PATCH_VERSION - The patch version of zlib @@ -20,7 +28,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) FIND_PATH(ZLIB_INCLUDE_DIR zlib.h @@ -36,18 +44,34 @@ FIND_LIBRARY(ZLIB_LIBRARY ) MARK_AS_ADVANCED(ZLIB_LIBRARY ZLIB_INCLUDE_DIR) -IF (ZLIB_INCLUDE_DIR AND EXISTS "${ZLIB_INCLUDE_DIR}/zlib.h") - FILE(READ "${ZLIB_INCLUDE_DIR}/zlib.h" ZLIB_H) - STRING(REGEX REPLACE ".*#define ZLIB_VERSION \"([0-9]+)\\.([0-9]+)\\.([0-9]+)\".*" "\\1.\\2.\\3" ZLIB_VERSION_STRING "${ZLIB_H}") +IF(ZLIB_INCLUDE_DIR AND EXISTS "${ZLIB_INCLUDE_DIR}/zlib.h") + FILE(STRINGS "${ZLIB_INCLUDE_DIR}/zlib.h" ZLIB_H REGEX "^#define ZLIB_VERSION \"[^\"]*\"$") + + STRING(REGEX REPLACE "^.*ZLIB_VERSION \"([0-9]+).*$" "\\1" ZLIB_VERSION_MAJOR "${ZLIB_H}") + STRING(REGEX REPLACE "^.*ZLIB_VERSION \"[0-9]+\\.([0-9]+).*$" "\\1" ZLIB_VERSION_MINOR "${ZLIB_H}") + STRING(REGEX REPLACE "^.*ZLIB_VERSION \"[0-9]+\\.[0-9]+\\.([0-9]+).*$" "\\1" ZLIB_VERSION_PATCH "${ZLIB_H}") + SET(ZLIB_VERSION_STRING "${ZLIB_VERSION_MAJOR}.${ZLIB_VERSION_MINOR}.${ZLIB_VERSION_PATCH}") + + # only append a TWEAK version if it exists: + SET(ZLIB_VERSION_TWEAK "") + IF( "${ZLIB_H}" MATCHES "^.*ZLIB_VERSION \"[0-9]+\\.[0-9]+\\.[0-9]+\\.([0-9]+).*$") + SET(ZLIB_VERSION_TWEAK "${CMAKE_MATCH_1}") + SET(ZLIB_VERSION_STRING "${ZLIB_VERSION_STRING}.${ZLIB_VERSION_TWEAK}") + ENDIF( "${ZLIB_H}" MATCHES "^.*ZLIB_VERSION \"[0-9]+\\.[0-9]+\\.[0-9]+\\.([0-9]+).*$") + + SET(ZLIB_MAJOR_VERSION "${ZLIB_VERSION_MAJOR}") + SET(ZLIB_MINOR_VERSION "${ZLIB_VERSION_MINOR}") + SET(ZLIB_PATCH_VERSION "${ZLIB_VERSION_PATCH}") ENDIF() # handle the QUIETLY and REQUIRED arguments and set ZLIB_FOUND to TRUE if # all listed variables are TRUE INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZLIB DEFAULT_MSG ZLIB_INCLUDE_DIR ZLIB_LIBRARY) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZLIB REQUIRED_VARS ZLIB_INCLUDE_DIR ZLIB_LIBRARY + VERSION_VAR ZLIB_VERSION_STRING) -IF (ZLIB_FOUND) +IF(ZLIB_FOUND) SET(ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR}) - SET(ZLIB_LIBRARIES ${ZLIB_LIBRARY}) + SET(ZLIB_LIBRARIES ${ZLIB_LIBRARY}) ENDIF() diff --git a/Modules/Findosg.cmake b/Modules/Findosg.cmake index 00e4711..76f202f 100644 --- a/Modules/Findosg.cmake +++ b/Modules/Findosg.cmake @@ -39,7 +39,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # Header files are presumed to be included like diff --git a/Modules/FindosgAnimation.cmake b/Modules/FindosgAnimation.cmake index a4bbb44..83e669a 100644 --- a/Modules/FindosgAnimation.cmake +++ b/Modules/FindosgAnimation.cmake @@ -35,7 +35,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # Header files are presumed to be included like diff --git a/Modules/FindosgDB.cmake b/Modules/FindosgDB.cmake index d0d75b6..f1cdfa5 100644 --- a/Modules/FindosgDB.cmake +++ b/Modules/FindosgDB.cmake @@ -35,7 +35,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # Header files are presumed to be included like diff --git a/Modules/FindosgFX.cmake b/Modules/FindosgFX.cmake index cf1a98b..64cbda8 100644 --- a/Modules/FindosgFX.cmake +++ b/Modules/FindosgFX.cmake @@ -35,7 +35,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # Header files are presumed to be included like diff --git a/Modules/FindosgGA.cmake b/Modules/FindosgGA.cmake index ca7e55a..00fc313 100644 --- a/Modules/FindosgGA.cmake +++ b/Modules/FindosgGA.cmake @@ -35,7 +35,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # Header files are presumed to be included like diff --git a/Modules/FindosgIntrospection.cmake b/Modules/FindosgIntrospection.cmake index 3045cd5..919523b 100644 --- a/Modules/FindosgIntrospection.cmake +++ b/Modules/FindosgIntrospection.cmake @@ -35,7 +35,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # Header files are presumed to be included like diff --git a/Modules/FindosgManipulator.cmake b/Modules/FindosgManipulator.cmake index 6de812e..93d4bac 100644 --- a/Modules/FindosgManipulator.cmake +++ b/Modules/FindosgManipulator.cmake @@ -35,7 +35,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # Header files are presumed to be included like diff --git a/Modules/FindosgParticle.cmake b/Modules/FindosgParticle.cmake index d693d04..a0d7516 100644 --- a/Modules/FindosgParticle.cmake +++ b/Modules/FindosgParticle.cmake @@ -35,7 +35,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # Header files are presumed to be included like diff --git a/Modules/FindosgProducer.cmake b/Modules/FindosgProducer.cmake index 2810d86..e4e57f3 100644 --- a/Modules/FindosgProducer.cmake +++ b/Modules/FindosgProducer.cmake @@ -35,7 +35,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # Header files are presumed to be included like diff --git a/Modules/FindosgShadow.cmake b/Modules/FindosgShadow.cmake index 60f29ff..86a339c 100644 --- a/Modules/FindosgShadow.cmake +++ b/Modules/FindosgShadow.cmake @@ -35,7 +35,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # Header files are presumed to be included like diff --git a/Modules/FindosgSim.cmake b/Modules/FindosgSim.cmake index 8f28d55..b66a991 100644 --- a/Modules/FindosgSim.cmake +++ b/Modules/FindosgSim.cmake @@ -35,7 +35,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # Header files are presumed to be included like diff --git a/Modules/FindosgTerrain.cmake b/Modules/FindosgTerrain.cmake index 4fcd4bd..04559cf 100644 --- a/Modules/FindosgTerrain.cmake +++ b/Modules/FindosgTerrain.cmake @@ -35,7 +35,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # Header files are presumed to be included like diff --git a/Modules/FindosgText.cmake b/Modules/FindosgText.cmake index 0c6c606..6d20336 100644 --- a/Modules/FindosgText.cmake +++ b/Modules/FindosgText.cmake @@ -35,7 +35,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # Header files are presumed to be included like diff --git a/Modules/FindosgUtil.cmake b/Modules/FindosgUtil.cmake index f314d23..2faa7d4 100644 --- a/Modules/FindosgUtil.cmake +++ b/Modules/FindosgUtil.cmake @@ -35,7 +35,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # Header files are presumed to be included like diff --git a/Modules/FindosgViewer.cmake b/Modules/FindosgViewer.cmake index 35be2f5..30b9926 100644 --- a/Modules/FindosgViewer.cmake +++ b/Modules/FindosgViewer.cmake @@ -35,7 +35,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # Header files are presumed to be included like diff --git a/Modules/FindosgVolume.cmake b/Modules/FindosgVolume.cmake index f89bbdd..f916667 100644 --- a/Modules/FindosgVolume.cmake +++ b/Modules/FindosgVolume.cmake @@ -35,7 +35,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # Header files are presumed to be included like diff --git a/Modules/FindosgWidget.cmake b/Modules/FindosgWidget.cmake index 45ad1a6..5f84873 100644 --- a/Modules/FindosgWidget.cmake +++ b/Modules/FindosgWidget.cmake @@ -35,7 +35,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # Header files are presumed to be included like diff --git a/Modules/Findosg_functions.cmake b/Modules/Findosg_functions.cmake index bc6f2de..ab836ff 100644 --- a/Modules/Findosg_functions.cmake +++ b/Modules/Findosg_functions.cmake @@ -14,7 +14,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # diff --git a/Modules/FindwxWidgets.cmake b/Modules/FindwxWidgets.cmake index 85c6568..687ae7c 100644 --- a/Modules/FindwxWidgets.cmake +++ b/Modules/FindwxWidgets.cmake @@ -57,14 +57,14 @@ # FIND_PACKAGE(wxWidgets COMPONENTS base core gl net) # IF(wxWidgets_FOUND) # INCLUDE(${wxWidgets_USE_FILE}) -# # and for each of your dependant executable/library targets: +# # and for each of your dependent executable/library targets: # TARGET_LINK_LIBRARIES(<YourTarget> ${wxWidgets_LIBRARIES}) # ENDIF(wxWidgets_FOUND) # # If wxWidgets is required (i.e., not an optional part): # FIND_PACKAGE(wxWidgets REQUIRED base core gl net) # INCLUDE(${wxWidgets_USE_FILE}) -# # and for each of your dependant executable/library targets: +# # and for each of your dependent executable/library targets: # TARGET_LINK_LIBRARIES(<YourTarget> ${wxWidgets_LIBRARIES}) #============================================================================= @@ -78,7 +78,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # diff --git a/Modules/FindwxWindows.cmake b/Modules/FindwxWindows.cmake index 4cb4c9e..f55cf00 100644 --- a/Modules/FindwxWindows.cmake +++ b/Modules/FindwxWindows.cmake @@ -58,7 +58,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # ------------------------------------------------------------------ diff --git a/Modules/FortranCInterface.cmake b/Modules/FortranCInterface.cmake index a7d5571..90ef59b 100644 --- a/Modules/FortranCInterface.cmake +++ b/Modules/FortranCInterface.cmake @@ -47,9 +47,9 @@ # MACRO_NAMESPACE "FC_" # SYMBOL_NAMESPACE "FC_" # SYMBOLS mysub mymod:my_sub) -# This creates a "FC.h" header that defines the same FC_*() mangling -# macros as the previous example plus preprocessor symbols FC_mysub -# and FC_mymod_my_sub. +# This creates a "FCMangle.h" header that defines the same FC_*() +# mangling macros as the previous example plus preprocessor symbols +# FC_mysub and FC_mymod_my_sub. # # Another function is provided to verify that the Fortran and C/C++ # compilers work together: @@ -91,7 +91,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) #----------------------------------------------------------------------------- diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake index 3dcfa35..f6b3a54 100644 --- a/Modules/GetPrerequisites.cmake +++ b/Modules/GetPrerequisites.cmake @@ -118,7 +118,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) function(gp_append_unique list_var value) @@ -531,6 +531,8 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa if("${gp_tool}" STREQUAL "ldd") set(gp_cmd_args "") set(gp_regex "^[\t ]*[^\t ]+ => ([^\t ]+).*${eol_char}$") + set(gp_regex_error "not found${eol_char}$") + set(gp_regex_fallback "^[\t ]*([^\t ]+) => ([^\t ]+).*${eol_char}$") set(gp_regex_cmp_count 1) set(gp_tool_known 1) endif("${gp_tool}" STREQUAL "ldd") @@ -538,6 +540,8 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa if("${gp_tool}" STREQUAL "otool") set(gp_cmd_args "-L") set(gp_regex "^\t([^\t]+) \\(compatibility version ([0-9]+.[0-9]+.[0-9]+), current version ([0-9]+.[0-9]+.[0-9]+)\\)${eol_char}$") + set(gp_regex_error "") + set(gp_regex_fallback "") set(gp_regex_cmp_count 3) set(gp_tool_known 1) endif("${gp_tool}" STREQUAL "otool") @@ -545,6 +549,8 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa if("${gp_tool}" STREQUAL "dumpbin") set(gp_cmd_args "/dependents") set(gp_regex "^ ([^ ].*[Dd][Ll][Ll])${eol_char}$") + set(gp_regex_error "") + set(gp_regex_fallback "") set(gp_regex_cmp_count 1) set(gp_tool_known 1) set(ENV{VS_UNICODE_OUTPUT} "") # Block extra output from inside VS IDE. @@ -634,8 +640,13 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa # foreach(candidate ${candidates}) if("${candidate}" MATCHES "${gp_regex}") + # Extract information from each candidate: - string(REGEX REPLACE "${gp_regex}" "\\1" raw_item "${candidate}") + if(gp_regex_error AND "${candidate}" MATCHES "${gp_regex_error}") + string(REGEX REPLACE "${gp_regex_fallback}" "\\1" raw_item "${candidate}") + else(gp_regex_error AND "${candidate}" MATCHES "${gp_regex_error}") + string(REGEX REPLACE "${gp_regex}" "\\1" raw_item "${candidate}") + endif(gp_regex_error AND "${candidate}" MATCHES "${gp_regex_error}") if(gp_regex_cmp_count GREATER 1) string(REGEX REPLACE "${gp_regex}" "\\2" raw_compat_version "${candidate}") diff --git a/Modules/ITKCompatibility.cmake b/Modules/ITKCompatibility.cmake index 3693abc..efd9c28 100644 --- a/Modules/ITKCompatibility.cmake +++ b/Modules/ITKCompatibility.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # work around an old bug in ITK prior to verison 3.0 diff --git a/Modules/InstallRequiredSystemLibraries.cmake b/Modules/InstallRequiredSystemLibraries.cmake index 97c6ccb..b60fed8 100644 --- a/Modules/InstallRequiredSystemLibraries.cmake +++ b/Modules/InstallRequiredSystemLibraries.cmake @@ -22,7 +22,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) IF(MSVC) diff --git a/Modules/KDE3Macros.cmake b/Modules/KDE3Macros.cmake index 0f2d479..5b76000 100644 --- a/Modules/KDE3Macros.cmake +++ b/Modules/KDE3Macros.cmake @@ -11,7 +11,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # See FindKDE3.cmake for documentation. diff --git a/Modules/MacroAddFileDependencies.cmake b/Modules/MacroAddFileDependencies.cmake index e4a82d1..527447b 100644 --- a/Modules/MacroAddFileDependencies.cmake +++ b/Modules/MacroAddFileDependencies.cmake @@ -1,6 +1,6 @@ # - MACRO_ADD_FILE_DEPENDENCIES(<_file> depend_files...) # Using the macro MACRO_ADD_FILE_DEPENDENCIES() is discouraged. There are usually -# better ways to specifiy the correct dependencies. +# better ways to specify the correct dependencies. # # MACRO_ADD_FILE_DEPENDENCIES(<_file> depend_files...) is just a convenience # wrapper around the OBJECT_DEPENDS source file property. You can just @@ -16,7 +16,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) MACRO (MACRO_ADD_FILE_DEPENDENCIES _file) diff --git a/Modules/Platform/AIX-GNU.cmake b/Modules/Platform/AIX-GNU.cmake index fc3880e..79c06ba 100644 --- a/Modules/Platform/AIX-GNU.cmake +++ b/Modules/Platform/AIX-GNU.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # This module is shared by multiple languages; use include blocker. diff --git a/Modules/Platform/BlueGeneP-base.cmake b/Modules/Platform/BlueGeneP-base.cmake new file mode 100644 index 0000000..2ca920f --- /dev/null +++ b/Modules/Platform/BlueGeneP-base.cmake @@ -0,0 +1,118 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov> +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +# +# BlueGeneP base platform file. +# +# NOTE: Do not set your platform to "BlueGeneP-base". This file is included +# by the real platform files. Use one of these two platforms instead: +# +# BlueGeneP-dynamic For dynamically linked builds +# BlueGeneP-static For statically linked builds +# +# This platform file tries its best to adhere to the behavior of the MPI +# compiler wrappers included with the latest BG/P drivers. +# + + +# +# For BGP builds, we're cross compiling, but we don't want to re-root things +# (e.g. with CMAKE_FIND_ROOT_PATH) because users may have libraries anywhere on +# the shared filesystems, and this may lie outside the root. Instead, we set the +# system directories so that the various system BGP CNK library locations are +# searched first. This is not the clearest thing in the world, given IBM's driver +# layout, but this should cover all the standard ones. +# +set(CMAKE_SYSTEM_LIBRARY_PATH + /bgsys/drivers/ppcfloor/comm/default/lib # default comm layer (used by mpi compiler wrappers) + /bgsys/drivers/ppcfloor/comm/sys/lib # DCMF, other lower-level comm libraries + /bgsys/drivers/ppcfloor/runtime/SPI # other low-level stuff + /bgsys/drivers/ppcfloor/gnu-linux/lib # CNK python installation directory + /bgsys/drivers/ppcfloor/gnu-linux/powerpc-bgp-linux/lib # CNK Linux image -- standard runtime libs, pthread, etc. +) + +# +# This adds directories that find commands should specifically ignore for cross compiles. +# Most of these directories are the includeand lib directories for the frontend on BG/P systems. +# Not ignoring these can cause things like FindX11 to find a frontend PPC version mistakenly. +# We use this on BG instead of re-rooting because backend libraries are typically strewn about +# the filesystem, and we can't re-root ALL backend libraries to a single place. +# +set(CMAKE_SYSTEM_IGNORE_PATH + /lib /lib64 /include + /usr/lib /usr/lib64 /usr/include + /usr/local/lib /usr/local/lib64 /usr/local/include + /usr/X11/lib /usr/X11/lib64 /usr/X11/include + /usr/lib/X11 /usr/lib64/X11 /usr/include/X11 + /usr/X11R6/lib /usr/X11R6/lib64 /usr/X11R6/include + /usr/X11R7/lib /usr/X11R7/lib64 /usr/X11R7/include +) + +# +# Indicate that this is a unix-like system +# +set(UNIX 1) + +# +# Library prefixes, suffixes, extra libs. +# +set(CMAKE_LINK_LIBRARY_SUFFIX "") +set(CMAKE_STATIC_LIBRARY_PREFIX "lib") # lib +set(CMAKE_STATIC_LIBRARY_SUFFIX ".a") # .a + +set(CMAKE_SHARED_LIBRARY_PREFIX "lib") # lib +set(CMAKE_SHARED_LIBRARY_SUFFIX ".so") # .so +set(CMAKE_EXECUTABLE_SUFFIX "") # .exe +set(CMAKE_DL_LIBS "dl") + +# +# This macro needs to be called for dynamic library support. Unfortunately on BGP, +# We can't support both static and dynamic links in the same platform file. The +# dynamic link platform file needs to call this explicitly to set up dynamic linking. +# +macro(__BlueGeneP_set_dynamic_flags compiler_id lang) + if (${compiler_id} STREQUAL XL) + # Flags for XL compilers if we explicitly detected XL + set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-qpic") # -pic + set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-qmkshrobj -qnostaticlink") # -shared + set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG "-Wl,-rpath,") # -rpath + set(BGP_${lang}_DYNAMIC_EXE_FLAGS "-qnostaticlink -qnostaticlink=libgcc") + else() + # Assume flags for GNU compilers (if the ID is GNU *or* anything else). + set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-fPIC") # -pic + set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared") # -shared + set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG "-Wl,-rpath,") # -rpath + set(BGP_${lang}_DYNAMIC_EXE_FLAGS "-dynamic") + endif() + + set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "") # +s, flag for exe link to use shared lib + set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG_SEP ":") # : or empty + + set(BGP_${lang}_DEFAULT_EXE_FLAGS + "<FLAGS> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>") + set(CMAKE_${lang}_LINK_EXECUTABLE + "<CMAKE_${lang}_COMPILER> -Wl,-relax ${BGP_${lang}_DYNAMIC_EXE_FLAGS} ${BGP_${lang}_DEFAULT_EXE_FLAGS}") +endmacro() + +# +# This macro needs to be called for static builds. Right now it just adds -Wl,-relax +# to the link line. +# +macro(__BlueGeneP_set_static_flags compiler_id lang) + set(BGP_${lang}_DEFAULT_EXE_FLAGS + "<FLAGS> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>") + set(CMAKE_${lang}_LINK_EXECUTABLE + "<CMAKE_${lang}_COMPILER> -Wl,-relax ${BGP_${lang}_DEFAULT_EXE_FLAGS}") +endmacro() diff --git a/Modules/Platform/BlueGeneP-dynamic-GNU-C.cmake b/Modules/Platform/BlueGeneP-dynamic-GNU-C.cmake new file mode 100644 index 0000000..bd4696b --- /dev/null +++ b/Modules/Platform/BlueGeneP-dynamic-GNU-C.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov> +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +__BlueGeneP_set_dynamic_flags(GNU C) diff --git a/Modules/Platform/BlueGeneP-dynamic-GNU-CXX.cmake b/Modules/Platform/BlueGeneP-dynamic-GNU-CXX.cmake new file mode 100644 index 0000000..9c995dc --- /dev/null +++ b/Modules/Platform/BlueGeneP-dynamic-GNU-CXX.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov> +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +__BlueGeneP_set_dynamic_flags(GNU CXX) diff --git a/Modules/Platform/BlueGeneP-dynamic-GNU-Fortran.cmake b/Modules/Platform/BlueGeneP-dynamic-GNU-Fortran.cmake new file mode 100644 index 0000000..19d6be8 --- /dev/null +++ b/Modules/Platform/BlueGeneP-dynamic-GNU-Fortran.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov> +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +__BlueGeneP_set_dynamic_flags(GNU Fortran) diff --git a/Modules/Platform/BlueGeneP-dynamic-XL-C.cmake b/Modules/Platform/BlueGeneP-dynamic-XL-C.cmake new file mode 100644 index 0000000..2dbbbc0 --- /dev/null +++ b/Modules/Platform/BlueGeneP-dynamic-XL-C.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov> +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +__BlueGeneP_set_dynamic_flags(XL C) diff --git a/Modules/Platform/BlueGeneP-dynamic-XL-CXX.cmake b/Modules/Platform/BlueGeneP-dynamic-XL-CXX.cmake new file mode 100644 index 0000000..2bc5127 --- /dev/null +++ b/Modules/Platform/BlueGeneP-dynamic-XL-CXX.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov> +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +__BlueGeneP_set_dynamic_flags(XL CXX) diff --git a/Modules/Platform/BlueGeneP-dynamic-XL-Fortran.cmake b/Modules/Platform/BlueGeneP-dynamic-XL-Fortran.cmake new file mode 100644 index 0000000..59da63d --- /dev/null +++ b/Modules/Platform/BlueGeneP-dynamic-XL-Fortran.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov> +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +__BlueGeneP_set_dynamic_flags(XL Fortran) diff --git a/Modules/Platform/BlueGeneP-dynamic.cmake b/Modules/Platform/BlueGeneP-dynamic.cmake new file mode 100644 index 0000000..8f96f2f --- /dev/null +++ b/Modules/Platform/BlueGeneP-dynamic.cmake @@ -0,0 +1,19 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov> +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +include(Platform/BlueGeneP-base) +set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE) +set(CMAKE_FIND_LIBRARY_PREFIXES "lib") +set(CMAKE_FIND_LIBRARY_SUFFIXES ".so" ".a") diff --git a/Modules/Platform/BlueGeneP-static-GNU-C.cmake b/Modules/Platform/BlueGeneP-static-GNU-C.cmake new file mode 100644 index 0000000..412a7a3 --- /dev/null +++ b/Modules/Platform/BlueGeneP-static-GNU-C.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov> +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +__BlueGeneP_set_static_flags(GNU C) diff --git a/Modules/Platform/BlueGeneP-static-GNU-CXX.cmake b/Modules/Platform/BlueGeneP-static-GNU-CXX.cmake new file mode 100644 index 0000000..418f0d8 --- /dev/null +++ b/Modules/Platform/BlueGeneP-static-GNU-CXX.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov> +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +__BlueGeneP_set_static_flags(GNU CXX) diff --git a/Modules/Platform/BlueGeneP-static-GNU-Fortran.cmake b/Modules/Platform/BlueGeneP-static-GNU-Fortran.cmake new file mode 100644 index 0000000..119195b --- /dev/null +++ b/Modules/Platform/BlueGeneP-static-GNU-Fortran.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov> +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +__BlueGeneP_set_static_flags(GNU Fortran) diff --git a/Modules/Platform/BlueGeneP-static-XL-C.cmake b/Modules/Platform/BlueGeneP-static-XL-C.cmake new file mode 100644 index 0000000..1f20959 --- /dev/null +++ b/Modules/Platform/BlueGeneP-static-XL-C.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov> +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +__BlueGeneP_set_static_flags(XL C) diff --git a/Modules/Platform/BlueGeneP-static-XL-CXX.cmake b/Modules/Platform/BlueGeneP-static-XL-CXX.cmake new file mode 100644 index 0000000..f027a53 --- /dev/null +++ b/Modules/Platform/BlueGeneP-static-XL-CXX.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov> +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +__BlueGeneP_set_static_flags(XL CXX) diff --git a/Modules/Platform/BlueGeneP-static-XL-Fortran.cmake b/Modules/Platform/BlueGeneP-static-XL-Fortran.cmake new file mode 100644 index 0000000..778d4bd --- /dev/null +++ b/Modules/Platform/BlueGeneP-static-XL-Fortran.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov> +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +__BlueGeneP_set_static_flags(XL Fortran) diff --git a/Modules/Platform/BlueGeneP-static.cmake b/Modules/Platform/BlueGeneP-static.cmake new file mode 100644 index 0000000..c4f5f21 --- /dev/null +++ b/Modules/Platform/BlueGeneP-static.cmake @@ -0,0 +1,19 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov> +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +include(Platform/BlueGeneP-base) +set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE) +set(CMAKE_FIND_LIBRARY_PREFIXES "lib") +set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") diff --git a/Modules/Platform/CYGWIN-GNU.cmake b/Modules/Platform/CYGWIN-GNU.cmake index 6a80f62..6f72a75 100644 --- a/Modules/Platform/CYGWIN-GNU.cmake +++ b/Modules/Platform/CYGWIN-GNU.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # This module is shared by multiple languages; use include blocker. @@ -45,6 +45,7 @@ macro(__cygwin_compiler_gnu lang) SET(CMAKE_${type}_LINK_DYNAMIC_${lang}_FLAGS "-Wl,-Bdynamic") ENDFOREACH(type) + set(CMAKE_EXE_EXPORTS_${lang}_FLAG "-Wl,--export-all-symbols") # TODO: Is -Wl,--enable-auto-import now always default? set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS} -Wl,--enable-auto-import") set(CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS}") diff --git a/Modules/Platform/Darwin-GNU.cmake b/Modules/Platform/Darwin-GNU.cmake index 4c2194a..f425eb9 100644 --- a/Modules/Platform/Darwin-GNU.cmake +++ b/Modules/Platform/Darwin-GNU.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # This module is shared by multiple languages; use include blocker. diff --git a/Modules/Platform/GNU.cmake b/Modules/Platform/GNU.cmake index fe3d47b..e0ed86c 100644 --- a/Modules/Platform/GNU.cmake +++ b/Modules/Platform/GNU.cmake @@ -4,5 +4,8 @@ SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") +SET(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,") SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") +SET(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic") + INCLUDE(Platform/UnixPaths) diff --git a/Modules/Platform/HP-UX-GNU.cmake b/Modules/Platform/HP-UX-GNU.cmake index da9fe48..eb909fe 100644 --- a/Modules/Platform/HP-UX-GNU.cmake +++ b/Modules/Platform/HP-UX-GNU.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # This module is shared by multiple languages; use include blocker. diff --git a/Modules/Platform/Linux-Clang-C.cmake b/Modules/Platform/Linux-Clang-C.cmake new file mode 100644 index 0000000..dbf8956 --- /dev/null +++ b/Modules/Platform/Linux-Clang-C.cmake @@ -0,0 +1 @@ +INCLUDE(Platform/Linux-GNU-C) diff --git a/Modules/Platform/Linux-Clang-CXX.cmake b/Modules/Platform/Linux-Clang-CXX.cmake new file mode 100644 index 0000000..8fe251c --- /dev/null +++ b/Modules/Platform/Linux-Clang-CXX.cmake @@ -0,0 +1 @@ +INCLUDE(Platform/Linux-GNU-CXX) diff --git a/Modules/Platform/Linux-GNU.cmake b/Modules/Platform/Linux-GNU.cmake index d257f34..0e254c6 100644 --- a/Modules/Platform/Linux-GNU.cmake +++ b/Modules/Platform/Linux-GNU.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # This module is shared by multiple languages; use include blocker. diff --git a/Modules/Platform/Linux-Intel.cmake b/Modules/Platform/Linux-Intel.cmake index dff90e9..dea8b90 100644 --- a/Modules/Platform/Linux-Intel.cmake +++ b/Modules/Platform/Linux-Intel.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # This module is shared by multiple languages; use include blocker. diff --git a/Modules/Platform/Linux-PGI.cmake b/Modules/Platform/Linux-PGI.cmake index 868ee33..ef06acd 100644 --- a/Modules/Platform/Linux-PGI.cmake +++ b/Modules/Platform/Linux-PGI.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # This module is shared by multiple languages; use include blocker. diff --git a/Modules/Platform/Linux-PathScale.cmake b/Modules/Platform/Linux-PathScale.cmake index 8537e4c..c131af2 100644 --- a/Modules/Platform/Linux-PathScale.cmake +++ b/Modules/Platform/Linux-PathScale.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # This module is shared by multiple languages; use include blocker. diff --git a/Modules/Platform/Linux-SunPro-CXX.cmake b/Modules/Platform/Linux-SunPro-CXX.cmake index 5490473..8ee9658 100644 --- a/Modules/Platform/Linux-SunPro-CXX.cmake +++ b/Modules/Platform/Linux-SunPro-CXX.cmake @@ -1,2 +1,9 @@ -SET(CMAKE_SHARED_LIBRARY_RPATH_LINK_CXX_FLAG "-rpath-link ") +# Sun C++ 5.9 does not support -Wl, but Sun C++ 5.11 does not work without it. +# Query the compiler flags to detect whether to use -Wl. +execute_process(COMMAND ${CMAKE_CXX_COMPILER} -flags OUTPUT_VARIABLE _cxx_flags ERROR_VARIABLE _cxx_error) +if("${_cxx_flags}" MATCHES "\n-W[^\n]*component") + set(CMAKE_SHARED_LIBRARY_RPATH_LINK_CXX_FLAG "-Wl,-rpath-link,") +else() + set(CMAKE_SHARED_LIBRARY_RPATH_LINK_CXX_FLAG "-rpath-link ") +endif() SET(CMAKE_EXE_EXPORTS_CXX_FLAG "--export-dynamic") diff --git a/Modules/Platform/OSF1.cmake b/Modules/Platform/OSF1.cmake index 652bed4..076410a 100644 --- a/Modules/Platform/OSF1.cmake +++ b/Modules/Platform/OSF1.cmake @@ -25,6 +25,7 @@ IF(CMAKE_SYSTEM MATCHES "OSF1-V.*") SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") ENDIF(CMAKE_SYSTEM MATCHES "OSF1-V.*") +SET(CMAKE_MAKE_INCLUDE_FROM_ROOT 1) # include $(CMAKE_BINARY_DIR)/... IF(CMAKE_COMPILER_IS_GNUCXX) # include the gcc flags diff --git a/Modules/Platform/SunOS-GNU.cmake b/Modules/Platform/SunOS-GNU.cmake index 613ea6b..7169056 100644 --- a/Modules/Platform/SunOS-GNU.cmake +++ b/Modules/Platform/SunOS-GNU.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # This module is shared by multiple languages; use include blocker. diff --git a/Modules/Platform/UnixPaths.cmake b/Modules/Platform/UnixPaths.cmake index 025ae51..ae3c187 100644 --- a/Modules/Platform/UnixPaths.cmake +++ b/Modules/Platform/UnixPaths.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # Block multiple inclusion because "CMakeCInformation.cmake" includes diff --git a/Modules/Platform/Windows-Borland.cmake b/Modules/Platform/Windows-Borland.cmake index 7b7ae84..5c402bd 100644 --- a/Modules/Platform/Windows-Borland.cmake +++ b/Modules/Platform/Windows-Borland.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # This module is shared by multiple languages; use include blocker. diff --git a/Modules/Platform/Windows-GNU-Fortran.cmake b/Modules/Platform/Windows-GNU-Fortran.cmake index c66feed..8273a19 100644 --- a/Modules/Platform/Windows-GNU-Fortran.cmake +++ b/Modules/Platform/Windows-GNU-Fortran.cmake @@ -1,2 +1,3 @@ include(Platform/Windows-GNU) __windows_compiler_gnu(Fortran) +set(CMAKE_Fortran_USE_RESPONSE_FILE_FOR_OBJECTS 0) diff --git a/Modules/Platform/Windows-GNU.cmake b/Modules/Platform/Windows-GNU.cmake index 6d84940..79b2f80 100644 --- a/Modules/Platform/Windows-GNU.cmake +++ b/Modules/Platform/Windows-GNU.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # This module is shared by multiple languages; use include blocker. @@ -49,6 +49,13 @@ set(CMAKE_CREATE_WIN32_EXE "-mwindows") set(CMAKE_GNULD_IMAGE_VERSION "-Wl,--major-image-version,<TARGET_VERSION_MAJOR>,--minor-image-version,<TARGET_VERSION_MINOR>") +# Check if GNU ld is too old to support @FILE syntax. +set(__WINDOWS_GNU_LD_RESPONSE 1) +execute_process(COMMAND ld -v OUTPUT_VARIABLE _help ERROR_VARIABLE _help) +if("${_help}" MATCHES "GNU ld .* 2\\.1[1-6]") + set(__WINDOWS_GNU_LD_RESPONSE 0) +endif() + macro(__windows_compiler_gnu lang) if(MSYS OR MINGW) @@ -68,6 +75,8 @@ macro(__windows_compiler_gnu lang) endif() set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "") # No -fPIC on Windows + set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_OBJECTS ${__WINDOWS_GNU_LD_RESPONSE}) + set(CMAKE_${lang}_RESPONSE_FILE_LINK_FLAG "-Wl,@") # Binary link rules. set(CMAKE_${lang}_CREATE_SHARED_MODULE diff --git a/Modules/Platform/Windows-icl.cmake b/Modules/Platform/Windows-icl.cmake index c717c7c..9088cc7 100644 --- a/Modules/Platform/Windows-icl.cmake +++ b/Modules/Platform/Windows-icl.cmake @@ -6,6 +6,10 @@ IF(CMAKE_VERBOSE_MAKEFILE) ELSE(CMAKE_VERBOSE_MAKEFILE) SET(CMAKE_CL_NOLOGO "/nologo") ENDIF(CMAKE_VERBOSE_MAKEFILE) + +SET(CMAKE_C_USE_RESPONSE_FILE_FOR_OBJECTS 1) +SET(CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS 1) + # create a shared C++ library SET(CMAKE_CXX_CREATE_SHARED_LIBRARY "xilink ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /dll <LINK_FLAGS> <OBJECTS> <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}") diff --git a/Modules/Platform/Windows-wcl386.cmake b/Modules/Platform/Windows-wcl386.cmake index b260489..7fc345f 100644 --- a/Modules/Platform/Windows-wcl386.cmake +++ b/Modules/Platform/Windows-wcl386.cmake @@ -31,7 +31,7 @@ SET(CMAKE_C_CREATE_IMPORT_LIBRARY SET(CMAKE_CXX_CREATE_IMPORT_LIBRARY ${CMAKE_C_CREATE_IMPORT_LIBRARY}) SET(CMAKE_C_LINK_EXECUTABLE - "wlink ${CMAKE_START_TEMP_FILE} ${CMAKE_WLINK_QUIET} name '<TARGET_UNQUOTED>' option caseexact file {<OBJECTS>} <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}") + "wlink ${CMAKE_START_TEMP_FILE} ${CMAKE_WLINK_QUIET} name '<TARGET_UNQUOTED>' <LINK_FLAGS> option caseexact file {<OBJECTS>} <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}") SET(CMAKE_CXX_LINK_EXECUTABLE ${CMAKE_C_LINK_EXECUTABLE}) @@ -52,7 +52,7 @@ SET(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} <FLAGS> -dWIN32 -d+ <DEFINES> -fo<PREPROCESSED_SOURCE> -pl -cc++ <SOURCE>${CMAKE_END_TEMP_FILE}") SET(CMAKE_CXX_CREATE_SHARED_MODULE - "wlink ${CMAKE_START_TEMP_FILE} system nt_dll ${CMAKE_WLINK_QUIET} name '<TARGET_UNQUOTED>' option caseexact file {<OBJECTS>} <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}") + "wlink ${CMAKE_START_TEMP_FILE} system nt_dll ${CMAKE_WLINK_QUIET} name '<TARGET_UNQUOTED>' <LINK_FLAGS> option caseexact file {<OBJECTS>} <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}") SET(CMAKE_CXX_CREATE_SHARED_LIBRARY ${CMAKE_CXX_CREATE_SHARED_MODULE} ${CMAKE_CXX_CREATE_IMPORT_LIBRARY}) @@ -64,7 +64,7 @@ SET(CMAKE_C_CREATE_SHARED_LIBRARY ${CMAKE_CXX_CREATE_SHARED_LIBRARY}) SET(CMAKE_C_CREATE_SHARED_MODULE ${CMAKE_CXX_CREATE_SHARED_MODULE}) # create a C++ static library -SET(CMAKE_CXX_CREATE_STATIC_LIBRARY "wlib ${CMAKE_LIB_QUIET} -n -b '<TARGET_UNQUOTED>' <OBJECTS> ") +SET(CMAKE_CXX_CREATE_STATIC_LIBRARY "wlib ${CMAKE_LIB_QUIET} -n -b '<TARGET_UNQUOTED>' <LINK_FLAGS> <OBJECTS> ") # create a C static library SET(CMAKE_C_CREATE_STATIC_LIBRARY ${CMAKE_CXX_CREATE_STATIC_LIBRARY}) diff --git a/Modules/Platform/WindowsPaths.cmake b/Modules/Platform/WindowsPaths.cmake index 8c67175..c7b15b3 100644 --- a/Modules/Platform/WindowsPaths.cmake +++ b/Modules/Platform/WindowsPaths.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # Block multiple inclusion because "CMakeCInformation.cmake" includes diff --git a/Modules/Qt4ConfigDependentSettings.cmake b/Modules/Qt4ConfigDependentSettings.cmake index ccbc828..bfb50de 100644 --- a/Modules/Qt4ConfigDependentSettings.cmake +++ b/Modules/Qt4ConfigDependentSettings.cmake @@ -10,7 +10,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) @@ -34,12 +34,12 @@ SET(QT_QTDBUS_LIB_DEPENDENCIES "") SET(QT_QTHELP_LIB_DEPENDENCIES ${QT_QTCLUCENE_LIBRARY}) -IF(WIN32) +IF(Q_WS_WIN) # On Windows, qconfig.pri has "static" for static library builds IF(QT_CONFIG MATCHES "static") SET(QT_IS_STATIC 1) ENDIF(QT_CONFIG MATCHES "static") -ELSE(WIN32) +ELSE(Q_WS_WIN) # On other platforms, check file extension to know if its static IF(QT_QTCORE_LIBRARY_RELEASE) GET_FILENAME_COMPONENT(qtcore_lib_ext "${QT_QTCORE_LIBRARY_RELEASE}" EXT) @@ -53,12 +53,12 @@ ELSE(WIN32) SET(QT_IS_STATIC 1) ENDIF(${qtcore_lib_ext} STREQUAL ${CMAKE_STATIC_LIBRARY_SUFFIX}) ENDIF(QT_QTCORE_LIBRARY_DEBUG) -ENDIF(WIN32) +ENDIF(Q_WS_WIN) # build using shared Qt needs -DQT_DLL on Windows -IF(WIN32 AND NOT QT_IS_STATIC) +IF(Q_WS_WIN AND NOT QT_IS_STATIC) SET(QT_DEFINITIONS ${QT_DEFINITIONS} -DQT_DLL) -ENDIF(WIN32 AND NOT QT_IS_STATIC) +ENDIF(Q_WS_WIN AND NOT QT_IS_STATIC) IF(NOT QT_IS_STATIC) RETURN() @@ -71,11 +71,8 @@ SET (QT_QTOPENGL_LIB_DEPENDENCIES ${OPENGL_glu_LIBRARY} ${OPENGL_gl_LIBRARY}) ## system png IF(QT_QCONFIG MATCHES "system-png") - FIND_LIBRARY(QT_PNG_LIBRARY NAMES png) - MARK_AS_ADVANCED(QT_PNG_LIBRARY) - IF(QT_PNG_LIBRARY) - SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_PNG_LIBRARY}) - ENDIF(QT_PNG_LIBRARY) + find_package(PNG) + SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${PNG_LIBRARY}) ENDIF(QT_QCONFIG MATCHES "system-png") @@ -141,16 +138,6 @@ IF(QT_QCONFIG MATCHES "xfixes") ENDIF(QT_QCONFIG MATCHES "xfixes") -## system-freetype -IF(QT_QCONFIG MATCHES "system-freetype") - FIND_LIBRARY(QT_FREETYPE_LIBRARY NAMES freetype) - MARK_AS_ADVANCED(QT_FREETYPE_LIBRARY) - IF(QT_FREETYPE_LIBRARY) - SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_FREETYPE_LIBRARY}) - ENDIF(QT_FREETYPE_LIBRARY) -ENDIF(QT_QCONFIG MATCHES "system-freetype") - - ## fontconfig IF(QT_QCONFIG MATCHES "fontconfig") FIND_LIBRARY(QT_FONTCONFIG_LIBRARY NAMES fontconfig) @@ -161,13 +148,19 @@ IF(QT_QCONFIG MATCHES "fontconfig") ENDIF(QT_QCONFIG MATCHES "fontconfig") +## system-freetype +IF(QT_QCONFIG MATCHES "system-freetype") + find_package(Freetype) + if(FREETYPE_LIBRARIES) + SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${FREETYPE_LIBRARIES}) + endif(FREETYPE_LIBRARIES) +ENDIF(QT_QCONFIG MATCHES "system-freetype") + + ## system-zlib IF(QT_QCONFIG MATCHES "system-zlib") - FIND_LIBRARY(QT_ZLIB_LIBRARY NAMES z) - MARK_AS_ADVANCED(QT_ZLIB_LIBRARY) - IF(QT_ZLIB_LIBRARY) - SET(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ${QT_ZLIB_LIBRARY}) - ENDIF(QT_ZLIB_LIBRARY) + find_package(ZLIB) + SET(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ${ZLIB_LIBRARIES}) ENDIF(QT_QCONFIG MATCHES "system-zlib") @@ -192,29 +185,11 @@ ENDIF(NOT Q_WS_WIN) ## dbus IF(QT_QCONFIG MATCHES "dbus") - # if the dbus library isn't found, we'll assume its not required to build - # shared Qt on Linux doesn't require it - IF(NOT QT_DBUS_LIBRARY) - EXECUTE_PROCESS(COMMAND pkg-config --libs-only-L dbus-1 - OUTPUT_VARIABLE _dbus_query_output - RESULT_VARIABLE _dbus_result - ERROR_VARIABLE _dbus_query_output ) - - IF(_dbus_result MATCHES 0) - STRING(REPLACE "-L" "" _dbus_query_output "${_dbus_query_output}") - SEPARATE_ARGUMENTS(_dbus_query_output) - ELSE(_dbus_result MATCHES 0) - SET(_dbus_query_output) - ENDIF(_dbus_result MATCHES 0) - - FIND_LIBRARY(QT_DBUS_LIBRARY NAMES dbus-1 PATHS ${_dbus_query_output} ) - - IF(QT_DBUS_LIBRARY) - SET(QT_QTDBUS_LIB_DEPENDENCIES ${QT_QTDBUS_LIB_DEPENDENCIES} ${QT_DBUS_LIBRARY}) - ENDIF(QT_DBUS_LIBRARY) - - MARK_AS_ADVANCED(QT_DBUS_LIBRARY) - ENDIF(NOT QT_DBUS_LIBRARY) + FIND_LIBRARY(QT_DBUS_LIBRARY NAMES dbus-1 ) + IF(QT_DBUS_LIBRARY) + SET(QT_QTDBUS_LIB_DEPENDENCIES ${QT_QTDBUS_LIB_DEPENDENCIES} ${QT_DBUS_LIBRARY}) + ENDIF(QT_DBUS_LIBRARY) + MARK_AS_ADVANCED(QT_DBUS_LIBRARY) ENDIF(QT_QCONFIG MATCHES "dbus") @@ -222,29 +197,11 @@ ENDIF(QT_QCONFIG MATCHES "dbus") ## glib IF(QT_QCONFIG MATCHES "glib") - # if the glib libraries aren't found, we'll assume its not required to build - # shared Qt on Linux doesn't require it - # Qt 4.2.0+ uses glib-2.0 - IF(NOT QT_GLIB_LIBRARY OR NOT QT_GTHREAD_LIBRARY) - EXECUTE_PROCESS(COMMAND pkg-config --libs-only-L glib-2.0 gthread-2.0 - OUTPUT_VARIABLE _glib_query_output - RESULT_VARIABLE _glib_result - ERROR_VARIABLE _glib_query_output ) - - IF(_glib_result MATCHES 0) - STRING(REPLACE "-L" "" _glib_query_output "${_glib_query_output}") - SEPARATE_ARGUMENTS(_glib_query_output) - ELSE(_glib_result MATCHES 0) - SET(_glib_query_output) - ENDIF(_glib_result MATCHES 0) - - FIND_LIBRARY(QT_GLIB_LIBRARY NAMES glib-2.0 PATHS ${_glib_query_output} ) - FIND_LIBRARY(QT_GTHREAD_LIBRARY NAMES gthread-2.0 PATHS ${_glib_query_output} ) - - MARK_AS_ADVANCED(QT_GLIB_LIBRARY) - MARK_AS_ADVANCED(QT_GTHREAD_LIBRARY) - ENDIF(NOT QT_GLIB_LIBRARY OR NOT QT_GTHREAD_LIBRARY) + FIND_LIBRARY(QT_GLIB_LIBRARY NAMES glib-2.0 ) + FIND_LIBRARY(QT_GTHREAD_LIBRARY NAMES gthread-2.0 ) + MARK_AS_ADVANCED(QT_GLIB_LIBRARY) + MARK_AS_ADVANCED(QT_GTHREAD_LIBRARY) IF(QT_GLIB_LIBRARY AND QT_GTHREAD_LIBRARY) SET(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} @@ -254,23 +211,8 @@ IF(QT_QCONFIG MATCHES "glib") # Qt 4.5+ also links to gobject-2.0 IF(QT_VERSION_MINOR GREATER 4) - IF(NOT QT_GOBJECT_LIBRARY) - EXECUTE_PROCESS(COMMAND pkg-config --libs-only-L gobject-2.0 - OUTPUT_VARIABLE _glib_query_output - RESULT_VARIABLE _glib_result - ERROR_VARIABLE _glib_query_output ) - - IF(_glib_result MATCHES 0) - STRING(REPLACE "-L" "" _glib_query_output "${_glib_query_output}") - SEPARATE_ARGUMENTS(_glib_query_output) - ELSE(_glib_result MATCHES 0) - SET(_glib_query_output) - ENDIF(_glib_result MATCHES 0) - - FIND_LIBRARY(QT_GOBJECT_LIBRARY NAMES gobject-2.0 PATHS ${_glib_query_output} ) - - MARK_AS_ADVANCED(QT_GOBJECT_LIBRARY) - ENDIF(NOT QT_GOBJECT_LIBRARY) + FIND_LIBRARY(QT_GOBJECT_LIBRARY NAMES gobject-2.0 PATHS ${_glib_query_output} ) + MARK_AS_ADVANCED(QT_GOBJECT_LIBRARY) IF(QT_GOBJECT_LIBRARY) SET(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} @@ -301,8 +243,11 @@ IF(Q_WS_X11) # X11 libraries Qt always depends on SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${X11_Xext_LIB} ${X11_X11_LIB}) - QT_QUERY_QMAKE(QT_LIBS_THREAD "QMAKE_LIBS_THREAD") - SET(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ${QT_LIBS_THREAD}) + set(CMAKE_THREAD_PREFER_PTHREADS 1) + find_package(Threads) + if(CMAKE_USE_PTHREADS_INIT) + SET(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ${CMAKE_THREAD_LIBS_INIT}) + endif(CMAKE_USE_PTHREADS_INIT) SET (QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ${CMAKE_DL_LIBS}) diff --git a/Modules/Qt4Macros.cmake b/Modules/Qt4Macros.cmake index bd72c8f..10cf1d1 100644 --- a/Modules/Qt4Macros.cmake +++ b/Modules/Qt4Macros.cmake @@ -10,7 +10,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) diff --git a/Modules/SelectLibraryConfigurations.cmake b/Modules/SelectLibraryConfigurations.cmake index edba5d9..51b4dda 100644 --- a/Modules/SelectLibraryConfigurations.cmake +++ b/Modules/SelectLibraryConfigurations.cmake @@ -26,7 +26,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # This macro was adapted from the FindQt4 CMake module and is maintained by Will diff --git a/Modules/SquishTestScript.cmake b/Modules/SquishTestScript.cmake index d42a84c..9eac970 100644 --- a/Modules/SquishTestScript.cmake +++ b/Modules/SquishTestScript.cmake @@ -19,7 +19,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) cmake_minimum_required(VERSION 2.6 FATAL_ERROR) diff --git a/Modules/SystemInformation.cmake b/Modules/SystemInformation.cmake index ef9b427..d973e90f 100644 --- a/Modules/SystemInformation.cmake +++ b/Modules/SystemInformation.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) PROJECT(DumpInformation) diff --git a/Modules/TestBigEndian.cmake b/Modules/TestBigEndian.cmake index 7514127..9960602 100644 --- a/Modules/TestBigEndian.cmake +++ b/Modules/TestBigEndian.cmake @@ -14,7 +14,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) MACRO(TEST_BIG_ENDIAN VARIABLE) diff --git a/Modules/TestCXXAcceptsFlag.cmake b/Modules/TestCXXAcceptsFlag.cmake index 98b2f9b..52d0cf3 100644 --- a/Modules/TestCXXAcceptsFlag.cmake +++ b/Modules/TestCXXAcceptsFlag.cmake @@ -17,7 +17,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) MACRO(CHECK_CXX_ACCEPTS_FLAG FLAGS VARIABLE) diff --git a/Modules/TestForANSIForScope.cmake b/Modules/TestForANSIForScope.cmake index 6581d07..ae2acef 100644 --- a/Modules/TestForANSIForScope.cmake +++ b/Modules/TestForANSIForScope.cmake @@ -13,7 +13,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) IF("CMAKE_ANSI_FOR_SCOPE" MATCHES "^CMAKE_ANSI_FOR_SCOPE$") diff --git a/Modules/TestForANSIStreamHeaders.cmake b/Modules/TestForANSIStreamHeaders.cmake index f62f3a4..19c1ab2 100644 --- a/Modules/TestForANSIStreamHeaders.cmake +++ b/Modules/TestForANSIStreamHeaders.cmake @@ -13,7 +13,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) INCLUDE(CheckIncludeFileCXX) diff --git a/Modules/TestForSSTREAM.cmake b/Modules/TestForSSTREAM.cmake index 4c8b11b..8dd53e7 100644 --- a/Modules/TestForSSTREAM.cmake +++ b/Modules/TestForSSTREAM.cmake @@ -13,7 +13,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) IF("CMAKE_HAS_ANSI_STRING_STREAM" MATCHES "^CMAKE_HAS_ANSI_STRING_STREAM$") diff --git a/Modules/TestForSTDNamespace.cmake b/Modules/TestForSTDNamespace.cmake index f0966d0..932d6e9 100644 --- a/Modules/TestForSTDNamespace.cmake +++ b/Modules/TestForSTDNamespace.cmake @@ -13,7 +13,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) IF("CMAKE_STD_NAMESPACE" MATCHES "^CMAKE_STD_NAMESPACE$") diff --git a/Modules/UseEcos.cmake b/Modules/UseEcos.cmake index 9785cd5..60e1e46 100644 --- a/Modules/UseEcos.cmake +++ b/Modules/UseEcos.cmake @@ -26,7 +26,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # first check that ecosconfig is available diff --git a/Modules/UsePkgConfig.cmake b/Modules/UsePkgConfig.cmake index e8194d5..d101e61 100644 --- a/Modules/UsePkgConfig.cmake +++ b/Modules/UsePkgConfig.cmake @@ -20,7 +20,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) FIND_PROGRAM(PKGCONFIG_EXECUTABLE NAMES pkg-config ) diff --git a/Modules/UseQt4.cmake b/Modules/UseQt4.cmake index 63a0919..ab028ed 100644 --- a/Modules/UseQt4.cmake +++ b/Modules/UseQt4.cmake @@ -13,7 +13,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) ADD_DEFINITIONS(${QT_DEFINITIONS}) @@ -27,9 +27,9 @@ INCLUDE_DIRECTORIES(${QT_INCLUDE_DIR}) SET(QT_LIBRARIES "") IF (QT_USE_QTMAIN) - IF (WIN32) + IF (Q_WS_WIN) SET(QT_LIBRARIES ${QT_LIBRARIES} ${QT_QTMAIN_LIBRARY}) - ENDIF (WIN32) + ENDIF (Q_WS_WIN) ENDIF (QT_USE_QTMAIN) IF(QT_DONT_USE_QTGUI) diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake index c79efac..b547dc7 100644 --- a/Modules/UseSWIG.cmake +++ b/Modules/UseSWIG.cmake @@ -30,7 +30,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) SET(SWIG_CXX_EXTENSION "cxx") diff --git a/Modules/UseVTK40.cmake b/Modules/UseVTK40.cmake index 560039f..c1157d6 100644 --- a/Modules/UseVTK40.cmake +++ b/Modules/UseVTK40.cmake @@ -10,7 +10,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # This is an implementation detail for using VTK 4.0 with the diff --git a/Modules/UseVTKBuildSettings40.cmake b/Modules/UseVTKBuildSettings40.cmake index 693743c..4df59b9 100644 --- a/Modules/UseVTKBuildSettings40.cmake +++ b/Modules/UseVTKBuildSettings40.cmake @@ -10,7 +10,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # Implementation detail for FindVTK.cmake to let it provide a diff --git a/Modules/UseVTKConfig40.cmake b/Modules/UseVTKConfig40.cmake index 2100d84..ca5e7aa 100644 --- a/Modules/UseVTKConfig40.cmake +++ b/Modules/UseVTKConfig40.cmake @@ -10,7 +10,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # This is an implementation detail for using VTK 4.0 with the diff --git a/Modules/Use_wxWindows.cmake b/Modules/Use_wxWindows.cmake index 2bae99c..01a1516 100644 --- a/Modules/Use_wxWindows.cmake +++ b/Modules/Use_wxWindows.cmake @@ -24,7 +24,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # ----------------------------------------------------- diff --git a/Modules/UsewxWidgets.cmake b/Modules/UsewxWidgets.cmake index b001f6a..037b715 100644 --- a/Modules/UsewxWidgets.cmake +++ b/Modules/UsewxWidgets.cmake @@ -28,7 +28,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # debug message and logging. diff --git a/Modules/VTKCompatibility.cmake b/Modules/VTKCompatibility.cmake index c0b3d62..802969f 100644 --- a/Modules/VTKCompatibility.cmake +++ b/Modules/VTKCompatibility.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) IF(APPLE) diff --git a/Modules/ecos_clean.cmake b/Modules/ecos_clean.cmake index b76137c..7a563ae 100644 --- a/Modules/ecos_clean.cmake +++ b/Modules/ecos_clean.cmake @@ -9,7 +9,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) file(GLOB _files ${ECOS_DIR}/*) diff --git a/Modules/kde3uic.cmake b/Modules/kde3uic.cmake index b52dc09..6f904ac 100644 --- a/Modules/kde3uic.cmake +++ b/Modules/kde3uic.cmake @@ -10,7 +10,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # used internally by KDE3Macros.cmake |