diff options
Diffstat (limited to 'Modules')
120 files changed, 1902 insertions, 523 deletions
diff --git a/Modules/AndroidTestUtilities/PushToAndroidDevice.cmake b/Modules/AndroidTestUtilities/PushToAndroidDevice.cmake index 04529b1..fccff67 100644 --- a/Modules/AndroidTestUtilities/PushToAndroidDevice.cmake +++ b/Modules/AndroidTestUtilities/PushToAndroidDevice.cmake @@ -31,7 +31,7 @@ function(android_push_test_files_to_device) set(out_var ${out_var} PARENT_SCOPE) if(res_var) string(REGEX REPLACE ";" " " com "${ARGN}") - message(FATAL_ERROR "Error occured during adb command: adb ${com}\nError: ${err_var}.") + message(FATAL_ERROR "Error occurred during adb command: adb ${com}\nError: ${err_var}.") endif() endfunction() diff --git a/Modules/AutoRccInfo.cmake.in b/Modules/AutoRccInfo.cmake.in new file mode 100644 index 0000000..5457a6f --- /dev/null +++ b/Modules/AutoRccInfo.cmake.in @@ -0,0 +1,11 @@ +# Meta +set(ARCC_MULTI_CONFIG @_multi_config@) +# Directories and files +set(ARCC_CMAKE_BINARY_DIR "@CMAKE_BINARY_DIR@/") +set(ARCC_CMAKE_SOURCE_DIR "@CMAKE_SOURCE_DIR@/") +set(ARCC_CMAKE_CURRENT_SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@/") +set(ARCC_CMAKE_CURRENT_BINARY_DIR "@CMAKE_CURRENT_BINARY_DIR@/") +set(ARCC_BUILD_DIR @_build_dir@) +# Qt environment +set(ARCC_RCC_EXECUTABLE @_qt_rcc_executable@) +set(ARCC_RCC_LIST_OPTIONS @_qt_rcc_list_options@) diff --git a/Modules/AutogenInfo.cmake.in b/Modules/AutogenInfo.cmake.in index 7f4b398..9a4a06d 100644 --- a/Modules/AutogenInfo.cmake.in +++ b/Modules/AutogenInfo.cmake.in @@ -9,12 +9,11 @@ set(AM_CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE "@CMAKE_INCLUDE_DIRECTORIES_PROJ set(AM_BUILD_DIR @_build_dir@) set(AM_SOURCES @_sources@) set(AM_HEADERS @_headers@) +set(AM_SETTINGS_FILE @_settings_file@) # Qt environment set(AM_QT_VERSION_MAJOR @_qt_version_major@) -set(AM_QT_VERSION_MINOR @_qt_version_minor@) set(AM_QT_MOC_EXECUTABLE @_qt_moc_executable@) set(AM_QT_UIC_EXECUTABLE @_qt_uic_executable@) -set(AM_QT_RCC_EXECUTABLE @_qt_rcc_executable@) # MOC settings set(AM_MOC_SKIP @_moc_skip@) set(AM_MOC_DEFINITIONS @_moc_compile_defs@) @@ -30,8 +29,3 @@ set(AM_UIC_TARGET_OPTIONS @_uic_target_options@) set(AM_UIC_OPTIONS_FILES @_qt_uic_options_files@) set(AM_UIC_OPTIONS_OPTIONS @_qt_uic_options_options@) set(AM_UIC_SEARCH_PATHS @_uic_search_paths@) -# RCC settings -set(AM_RCC_SOURCES @_rcc_files@) -set(AM_RCC_BUILDS @_rcc_builds@) -set(AM_RCC_OPTIONS @_rcc_options@) -set(AM_RCC_INPUTS @_rcc_inputs@) diff --git a/Modules/BasicConfigVersion-SameMinorVersion.cmake.in b/Modules/BasicConfigVersion-SameMinorVersion.cmake.in new file mode 100644 index 0000000..59ca253 --- /dev/null +++ b/Modules/BasicConfigVersion-SameMinorVersion.cmake.in @@ -0,0 +1,50 @@ +# This is a basic version file for the Config-mode of find_package(). +# It is used by write_basic_package_version_file() as input file for configure_file() +# to create a version-file which can be installed along a config.cmake file. +# +# The created file sets PACKAGE_VERSION_EXACT if the current version string and +# the requested version string are exactly the same and it sets +# PACKAGE_VERSION_COMPATIBLE if the current version is >= requested version, +# but only if the requested major and minor versions are the same as the current +# one. +# The variable CVF_VERSION must be set before calling configure_file(). + + +set(PACKAGE_VERSION "@CVF_VERSION@") + +if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION) + set(PACKAGE_VERSION_COMPATIBLE FALSE) +else() + + if("@CVF_VERSION@" MATCHES "^([0-9]+)\\.([0-9]+)") + set(CVF_VERSION_MAJOR "${CMAKE_MATCH_1}") + set(CVF_VERSION_MINOR "${CMAKE_MATCH_2}") + else() + set(CVF_VERSION_MAJOR "@CVF_VERSION@") + set(CVF_VERSION_MINOR "") + endif() + + if((PACKAGE_FIND_VERSION_MAJOR STREQUAL CVF_VERSION_MAJOR) AND + (PACKAGE_FIND_VERSION_MINOR STREQUAL CVF_VERSION_MINOR)) + set(PACKAGE_VERSION_COMPATIBLE TRUE) + else() + set(PACKAGE_VERSION_COMPATIBLE FALSE) + endif() + + if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION) + set(PACKAGE_VERSION_EXACT TRUE) + endif() +endif() + + +# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it: +if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "@CMAKE_SIZEOF_VOID_P@" STREQUAL "") + return() +endif() + +# check that the installed version has the same 32/64bit-ness as the one which is currently searching: +if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "@CMAKE_SIZEOF_VOID_P@") + math(EXPR installedBits "@CMAKE_SIZEOF_VOID_P@ * 8") + set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)") + set(PACKAGE_VERSION_UNSUITABLE TRUE) +endif() diff --git a/Modules/CMakeDetermineASMCompiler.cmake b/Modules/CMakeDetermineASMCompiler.cmake index f7cf54a..ed8f598 100644 --- a/Modules/CMakeDetermineASMCompiler.cmake +++ b/Modules/CMakeDetermineASMCompiler.cmake @@ -163,8 +163,8 @@ if (NOT _CMAKE_TOOLCHAIN_PREFIX) endif () -include(CMakeFindBinUtils) set(_CMAKE_PROCESSING_LANGUAGE "ASM") +include(CMakeFindBinUtils) include(Compiler/${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}-FindBinUtils OPTIONAL) unset(_CMAKE_PROCESSING_LANGUAGE) diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake index 4e56ce1..7e6ca1e 100644 --- a/Modules/CMakeDetermineCCompiler.cmake +++ b/Modules/CMakeDetermineCCompiler.cmake @@ -166,8 +166,8 @@ if (CMAKE_CROSSCOMPILING AND NOT _CMAKE_TOOLCHAIN_PREFIX) endif () -include(CMakeFindBinUtils) set(_CMAKE_PROCESSING_LANGUAGE "C") +include(CMakeFindBinUtils) include(Compiler/${CMAKE_C_COMPILER_ID}-FindBinUtils OPTIONAL) unset(_CMAKE_PROCESSING_LANGUAGE) diff --git a/Modules/CMakeDetermineCUDACompiler.cmake b/Modules/CMakeDetermineCUDACompiler.cmake index c9cd7e2..f5a3ebd 100644 --- a/Modules/CMakeDetermineCUDACompiler.cmake +++ b/Modules/CMakeDetermineCUDACompiler.cmake @@ -73,7 +73,10 @@ if(NOT CMAKE_CUDA_COMPILER_ID_RUN) CMAKE_DETERMINE_COMPILER_ID(CUDA CUDAFLAGS CMakeCUDACompilerId.cu) endif() +set(_CMAKE_PROCESSING_LANGUAGE "CUDA") include(CMakeFindBinUtils) +unset(_CMAKE_PROCESSING_LANGUAGE) + if(MSVC_CUDA_ARCHITECTURE_ID) set(SET_MSVC_CUDA_ARCHITECTURE_ID "set(MSVC_CUDA_ARCHITECTURE_ID ${MSVC_CUDA_ARCHITECTURE_ID})") diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake index 4541844..c0fb3b6 100644 --- a/Modules/CMakeDetermineCXXCompiler.cmake +++ b/Modules/CMakeDetermineCXXCompiler.cmake @@ -164,8 +164,8 @@ if (CMAKE_CROSSCOMPILING AND NOT _CMAKE_TOOLCHAIN_PREFIX) endif () -include(CMakeFindBinUtils) set(_CMAKE_PROCESSING_LANGUAGE "CXX") +include(CMakeFindBinUtils) include(Compiler/${CMAKE_CXX_COMPILER_ID}-FindBinUtils OPTIONAL) unset(_CMAKE_PROCESSING_LANGUAGE) diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 347106e..15c304c 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -742,12 +742,12 @@ function(CMAKE_DIAGNOSE_UNSUPPORTED_CLANG lang envvar) return() endif() - # Test whether a GNU-like command-line option works. - execute_process(COMMAND "${CMAKE_${lang}_COMPILER}" --version + # Test whether an MSVC-like command-line option works. + execute_process(COMMAND "${CMAKE_${lang}_COMPILER}" /? RESULT_VARIABLE _clang_result OUTPUT_VARIABLE _clang_stdout ERROR_VARIABLE _clang_stderr) - if(NOT _clang_result EQUAL 0) + if(_clang_result EQUAL 0) return() endif() diff --git a/Modules/CMakeDetermineFortranCompiler.cmake b/Modules/CMakeDetermineFortranCompiler.cmake index 2549c22..cf502f6 100644 --- a/Modules/CMakeDetermineFortranCompiler.cmake +++ b/Modules/CMakeDetermineFortranCompiler.cmake @@ -258,8 +258,8 @@ if (CMAKE_CROSSCOMPILING AND NOT _CMAKE_TOOLCHAIN_PREFIX) endif () -include(CMakeFindBinUtils) set(_CMAKE_PROCESSING_LANGUAGE "Fortran") +include(CMakeFindBinUtils) include(Compiler/${CMAKE_Fortran_COMPILER_ID}-FindBinUtils OPTIONAL) unset(_CMAKE_PROCESSING_LANGUAGE) diff --git a/Modules/CMakeDetermineSwiftCompiler.cmake b/Modules/CMakeDetermineSwiftCompiler.cmake index 2604906..dd02d54 100644 --- a/Modules/CMakeDetermineSwiftCompiler.cmake +++ b/Modules/CMakeDetermineSwiftCompiler.cmake @@ -34,7 +34,9 @@ if (NOT _CMAKE_TOOLCHAIN_LOCATION) get_filename_component(_CMAKE_TOOLCHAIN_LOCATION "${CMAKE_Swift_COMPILER}" PATH) endif () +set(_CMAKE_PROCESSING_LANGUAGE "Swift") include(CMakeFindBinUtils) +unset(_CMAKE_PROCESSING_LANGUAGE) # configure variables set in this file for fast reload later on configure_file(${CMAKE_ROOT}/Modules/CMakeSwiftCompiler.cmake.in diff --git a/Modules/CMakeFindBinUtils.cmake b/Modules/CMakeFindBinUtils.cmake index e4103d0..ece0547 100644 --- a/Modules/CMakeFindBinUtils.cmake +++ b/Modules/CMakeFindBinUtils.cmake @@ -20,16 +20,9 @@ # on UNIX, cygwin and mingw # if it's the MS C/CXX compiler, search for link -if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC" - OR "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC" - OR "x${CMAKE_Fortran_SIMULATE_ID}" STREQUAL "xMSVC" - OR "x${CMAKE_C_COMPILER_ID}" STREQUAL "xMSVC" - OR "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC" - OR "x${CMAKE_CUDA_SIMULATE_ID}" STREQUAL "xMSVC" - OR (CMAKE_HOST_WIN32 AND ( - "x${CMAKE_C_COMPILER_ID}" STREQUAL "xPGI" - OR "x${CMAKE_Fortran_COMPILER_ID}" STREQUAL "xPGI" - )) +if("x${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_SIMULATE_ID}" STREQUAL "xMSVC" + OR "x${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ID}" STREQUAL "xMSVC" + OR (CMAKE_HOST_WIN32 AND "x${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ID}" STREQUAL "xPGI") OR (CMAKE_GENERATOR MATCHES "Visual Studio" AND NOT CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android")) diff --git a/Modules/CMakeFindCodeBlocks.cmake b/Modules/CMakeFindCodeBlocks.cmake index b76e5c5..13bceb1 100644 --- a/Modules/CMakeFindCodeBlocks.cmake +++ b/Modules/CMakeFindCodeBlocks.cmake @@ -28,3 +28,6 @@ endif() # This variable is used by the CodeBlocks generator and appended to the make invocation commands. set(CMAKE_CODEBLOCKS_MAKE_ARGUMENTS "${_CMAKE_CODEBLOCKS_INITIAL_MAKE_ARGS}" CACHE STRING "Additional command line arguments when CodeBlocks invokes make. Enter e.g. -j<some_number> to get parallel builds") + +# This variable is used by the CodeBlocks generator and allows the user to overwrite the autodetected CodeBlocks compiler id +set(CMAKE_CODEBLOCKS_COMPILER_ID "" CACHE STRING "Id string of the compiler for the CodeBlocks IDE. Automatically detected when left empty") diff --git a/Modules/CMakeFindSublimeText2.cmake b/Modules/CMakeFindSublimeText2.cmake new file mode 100644 index 0000000..022d010 --- /dev/null +++ b/Modules/CMakeFindSublimeText2.cmake @@ -0,0 +1,23 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + + +# This file is included in CMakeSystemSpecificInformation.cmake if +# the Sublime Text 2 extra generator has been selected. + +find_program(CMAKE_SUBLIMETEXT_EXECUTABLE + NAMES subl3 subl sublime_text + PATHS + "/Applications/Sublime Text.app/Contents/SharedSupport/bin" + "/Applications/Sublime Text 3.app/Contents/SharedSupport/bin" + "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin" + "$ENV{HOME}/Applications/Sublime Text.app/Contents/SharedSupport/bin" + "$ENV{HOME}/Applications/Sublime Text 3.app/Contents/SharedSupport/bin" + "$ENV{HOME}/Applications/Sublime Text 2.app/Contents/SharedSupport/bin" + "/opt/sublime_text" + "/opt/sublime_text_3" + DOC "The Sublime Text executable") + +if(CMAKE_SUBLIMETEXT_EXECUTABLE) + set(CMAKE_OPEN_PROJECT_COMMAND "${CMAKE_SUBLIMETEXT_EXECUTABLE} --project <PROJECT_FILE>" ) +endif() diff --git a/Modules/CMakeFortranCompilerId.F.in b/Modules/CMakeFortranCompilerId.F.in index 49789f1..da3d953 100644 --- a/Modules/CMakeFortranCompilerId.F.in +++ b/Modules/CMakeFortranCompilerId.F.in @@ -2,6 +2,26 @@ #if 0 ! Identify the compiler #endif +#if defined(_MSC_VER) + PRINT *, 'INFO:simulate[MSVC]' +# if _MSC_VER >= 1900 + PRINT *, 'INFO:simulate_version[019.00]' +# elif _MSC_VER >= 1800 + PRINT *, 'INFO:simulate_version[018.00]' +# elif _MSC_VER >= 1700 + PRINT *, 'INFO:simulate_version[017.00]' +# elif _MSC_VER >= 1600 + PRINT *, 'INFO:simulate_version[016.00]' +# elif _MSC_VER >= 1500 + PRINT *, 'INFO:simulate_version[015.00]' +# elif _MSC_VER >= 1400 + PRINT *, 'INFO:simulate_version[014.00]' +# elif _MSC_VER >= 1310 + PRINT *, 'INFO:simulate_version[013.01]' +# else + PRINT *, 'INFO:simulate_version[013.00]' +# endif +#endif #if defined(__INTEL_COMPILER) || defined(__ICC) PRINT *, 'INFO:compiler[Intel]' # define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100) @@ -14,27 +34,6 @@ # if defined(__INTEL_COMPILER_BUILD_DATE) # define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE) # endif - -# if defined(_MSC_VER) - PRINT *, 'INFO:simulate[MSVC]' -# if _MSC_VER >= 1900 - PRINT *, 'INFO:simulate_version[019.00]' -# elif _MSC_VER >= 1800 - PRINT *, 'INFO:simulate_version[018.00]' -# elif _MSC_VER >= 1700 - PRINT *, 'INFO:simulate_version[017.00]' -# elif _MSC_VER >= 1600 - PRINT *, 'INFO:simulate_version[016.00]' -# elif _MSC_VER >= 1500 - PRINT *, 'INFO:simulate_version[015.00]' -# elif _MSC_VER >= 1400 - PRINT *, 'INFO:simulate_version[014.00]' -# elif _MSC_VER >= 1310 - PRINT *, 'INFO:simulate_version[013.01]' -# else - PRINT *, 'INFO:simulate_version[013.00]' -# endif -# endif #elif defined(__SUNPRO_F95) PRINT *, 'INFO:compiler[SunPro]' # define COMPILER_VERSION_MAJOR HEX(__SUNPRO_F95>>8) diff --git a/Modules/CMakeFortranInformation.cmake b/Modules/CMakeFortranInformation.cmake index 8005da6..b315d33 100644 --- a/Modules/CMakeFortranInformation.cmake +++ b/Modules/CMakeFortranInformation.cmake @@ -169,7 +169,7 @@ foreach(c "" _DEBUG _RELEASE _MINSIZEREL _RELWITHDEBINFO) endforeach() set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS_INIT}" CACHE STRING - "Flags for Fortran compiler.") + "Flags used by the compiler during all build types.") include(CMakeCommonLanguageInclude) diff --git a/Modules/CMakePackageConfigHelpers.cmake b/Modules/CMakePackageConfigHelpers.cmake index 90c2a57..e37f34f 100644 --- a/Modules/CMakePackageConfigHelpers.cmake +++ b/Modules/CMakePackageConfigHelpers.cmake @@ -122,7 +122,7 @@ # # write_basic_package_version_file(<filename> # [VERSION <major.minor.patch>] -# COMPATIBILITY <AnyNewerVersion|SameMajorVersion|ExactVersion> ) +# COMPATIBILITY <AnyNewerVersion|SameMajorVersion|SameMinorVersion|ExactVersion> ) # # # Writes a file for use as ``<package>ConfigVersion.cmake`` file to @@ -144,6 +144,9 @@ # requested, e.g. version 2.0 will not be considered compatible if 1.0 is # requested. This mode should be used for packages which guarantee backward # compatibility within the same major version. +# If ``SameMinorVersion`` is used, the behaviour is the same as +# ``SameMajorVersion``, but both major and minor version must be the same as +# requested, e.g version 0.2 will not be compatible if 0.1 is requested. # If ``ExactVersion`` is used, then the package is only considered compatible if # the requested version matches exactly its own version number (not considering # the tweak version). For example, version 1.2.3 of a package is only @@ -154,10 +157,9 @@ # macro. # # Internally, this macro executes :command:`configure_file()` to create the -# resulting version file. Depending on the ``COMPATIBLITY``, either the file -# ``BasicConfigVersion-SameMajorVersion.cmake.in`` or -# ``BasicConfigVersion-AnyNewerVersion.cmake.in`` is used. Please note that -# these two files are internal to CMake and you should not call +# resulting version file. Depending on the ``COMPATIBILITY``, the corresponding +# ``BasicConfigVersion-<COMPATIBILITY>.cmake.in`` file is used. +# Please note that these files are internal to CMake and you should not call # :command:`configure_file()` on them yourself, but they can be used as starting # point to create more sophisticted custom ``ConfigVersion.cmake`` files. # diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake index 3915943..812917f 100644 --- a/Modules/CPack.cmake +++ b/Modules/CPack.cmake @@ -338,7 +338,7 @@ function(cpack_encode_variables) set(value "${${var}}") endif() - string(APPEND commands "\nSET(${var} \"${value}\")") + string(APPEND commands "\nset(${var} \"${value}\")") endif() endforeach() @@ -384,6 +384,12 @@ _cpack_set_default(CPACK_RESOURCE_FILE_WELCOME _cpack_set_default(CPACK_MODULE_PATH "${CMAKE_MODULE_PATH}") +# Set default directory creation permissions mode +if(CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS) + _cpack_set_default(CPACK_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS + "${CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS}") +endif() + if(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL) set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON) endif() diff --git a/Modules/CPackComponent.cmake b/Modules/CPackComponent.cmake index 2374fbd..6c122e5 100644 --- a/Modules/CPackComponent.cmake +++ b/Modules/CPackComponent.cmake @@ -66,7 +66,7 @@ # the component differently depending on the value of this variable: # # * ONE_PER_GROUP (default): creates one package file per component group -# * ALL_COMPONENTS_IN_ONE : creates a single package with all (requested) component +# * ALL_COMPONENTS_IN_ONE : creates a single package with all (requested) components # * IGNORE : creates one package per component, i.e. IGNORE component group # # One can specify different grouping for different CPack generator by diff --git a/Modules/CPackDeb.cmake b/Modules/CPackDeb.cmake index 1879827..de1df3d 100644 --- a/Modules/CPackDeb.cmake +++ b/Modules/CPackDeb.cmake @@ -610,12 +610,7 @@ function(cpack_deb_prepare_package_vars) if(CPACK_DEBIAN_PACKAGE_SHLIBDEPS OR CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS) # Generating binary list - Get type of all install files - cmake_policy(PUSH) - # Tell file(GLOB_RECURSE) not to follow directory symlinks - # even if the project does not set this policy to NEW. - cmake_policy(SET CMP0009 NEW) - file(GLOB_RECURSE FILE_PATHS_ LIST_DIRECTORIES false RELATIVE "${WDIR}" "${WDIR}/*") - cmake_policy(POP) + file(GLOB_RECURSE FILE_PATHS_ LIST_DIRECTORIES false RELATIVE "${WDIR}" "${WDIR}/*") find_program(FILE_EXECUTABLE file) if(NOT FILE_EXECUTABLE) @@ -931,13 +926,10 @@ function(cpack_deb_prepare_package_vars) if(CPACK_DEBIAN_ARCHIVE_TYPE) set(archive_types_ "paxr;gnutar") - cmake_policy(PUSH) - cmake_policy(SET CMP0057 NEW) - if(NOT CPACK_DEBIAN_ARCHIVE_TYPE IN_LIST archive_types_) - message(FATAL_ERROR "CPACK_DEBIAN_ARCHIVE_TYPE set to unsupported" - "type ${CPACK_DEBIAN_ARCHIVE_TYPE}") - endif() - cmake_policy(POP) + if(NOT CPACK_DEBIAN_ARCHIVE_TYPE IN_LIST archive_types_) + message(FATAL_ERROR "CPACK_DEBIAN_ARCHIVE_TYPE set to unsupported" + "type ${CPACK_DEBIAN_ARCHIVE_TYPE}") + endif() else() set(CPACK_DEBIAN_ARCHIVE_TYPE "paxr") endif() @@ -987,7 +979,7 @@ function(cpack_deb_prepare_package_vars) if(READELF_EXECUTABLE) foreach(_FILE IN LISTS CPACK_DEB_SHARED_OBJECT_FILES) extract_so_info("${_FILE}" libname soversion) - if(libname AND soversion) + if(libname AND DEFINED soversion) list(APPEND CPACK_DEBIAN_PACKAGE_SHLIBS_LIST "${libname} ${soversion} ${CPACK_DEBIAN_PACKAGE_NAME} (${CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS_POLICY} ${CPACK_DEBIAN_PACKAGE_VERSION})") else() @@ -1039,13 +1031,9 @@ function(cpack_deb_prepare_package_vars) set(CPACK_OUTPUT_FILE_NAME "${CPACK_DEBIAN_PACKAGE_NAME}_${CPACK_DEBIAN_PACKAGE_VERSION}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}.deb") else() - cmake_policy(PUSH) - cmake_policy(SET CMP0010 NEW) - if(NOT CPACK_DEBIAN_FILE_NAME MATCHES ".*\\.(deb|ipk)") - cmake_policy(POP) - message(FATAL_ERROR "'${CPACK_DEBIAN_FILE_NAME}' is not a valid DEB package file name as it must end with '.deb' or '.ipk'!") - endif() - cmake_policy(POP) + if(NOT CPACK_DEBIAN_FILE_NAME MATCHES ".*\\.(deb|ipk)") + message(FATAL_ERROR "'${CPACK_DEBIAN_FILE_NAME}' is not a valid DEB package file name as it must end with '.deb' or '.ipk'!") + endif() set(CPACK_OUTPUT_FILE_NAME "${CPACK_DEBIAN_FILE_NAME}") endif() diff --git a/Modules/CPackIFW.cmake b/Modules/CPackIFW.cmake index 8d8b070..05a54a0 100644 --- a/Modules/CPackIFW.cmake +++ b/Modules/CPackIFW.cmake @@ -817,7 +817,7 @@ if(CPACK_IFW_INSTALLERBASE_EXECUTABLE AND NOT CPACK_IFW_FRAMEWORK_VERSION_FORCED endif() endif() endforeach() - # Finaly try to get version from executable path + # Finally try to get version from executable path if(NOT CPACK_IFW_FRAMEWORK_VERSION) string(REGEX MATCH "[0-9]+(\\.[0-9]+)*" CPACK_IFW_FRAMEWORK_VERSION "${CPACK_IFW_INSTALLERBASE_EXECUTABLE}") @@ -864,7 +864,7 @@ macro(_cpack_ifw_resolve_script _variable) endif() endmacro() -# Resolve full path to lisense file +# Resolve full path to license file macro(_cpack_ifw_resolve_lisenses _variable) if(${_variable}) set(_ifw_license_file FALSE) diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake index 9f77ec3..bb5181f 100644 --- a/Modules/CPackRPM.cmake +++ b/Modules/CPackRPM.cmake @@ -545,7 +545,7 @@ # /usr/share/doc # # May be used to exclude path (directories or files) from the auto-generated -# list of paths discovered by CPack RPM. The defaut value contains a +# list of paths discovered by CPack RPM. The default value contains a # reasonable set of values if the variable is not defined by the user. If the # variable is defined by the user then CPackRPM will NOT any of the default # path. If you want to add some path to the default list then you can use @@ -691,6 +691,22 @@ # are the same as for :variable:`CPACK_RPM_DEFAULT_FILE_PERMISSIONS`. # Note that <compName> must be in upper-case. # +# .. variable:: CPACK_RPM_INSTALL_WITH_EXEC +# +# force execute permissions on programs and shared libraries +# +# * Mandatory : NO +# * Default : - (system default) +# +# Force set owner, group and world execute permissions on programs and shared +# libraries. This can be used for creating valid rpm packages on systems such +# as Debian where shared libraries do not have execute permissions set. +# +# .. note:: +# +# Programs and shared libraries without execute permissions are ignored during +# separation of debug symbols from the binary for debuginfo packages. +# # Packaging of Symbolic Links # ^^^^^^^^^^^^^^^^^^^^^^^^^^^ # @@ -751,7 +767,8 @@ # .. note:: # # Packages generated from packages without binary files, with binary files but -# without execute permissions or without debug symbols will be empty. +# without execute permissions or without debug symbols will cause packaging +# termination. # # .. variable:: CPACK_BUILD_SOURCE_DIRS # @@ -782,7 +799,7 @@ # # .. note:: # -# Each source path prefix is additionaly suffixed by ``src_<index>`` where +# Each source path prefix is additionally suffixed by ``src_<index>`` where # index is index of the path used from :variable:`CPACK_BUILD_SOURCE_DIRS` # variable. This produces ``<CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX>/src_<index>`` # replacement path. @@ -939,6 +956,34 @@ # Author: Eric Noulard with the help of Alexander Neundorf. +function(get_file_permissions FILE RETURN_VAR) + execute_process(COMMAND ls -l ${FILE} + OUTPUT_VARIABLE permissions_ + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + + string(REPLACE " " ";" permissions_ "${permissions_}") + list(GET permissions_ 0 permissions_) + + unset(text_notation_) + set(any_chars_ ".") + foreach(PERMISSION_TYPE "OWNER" "GROUP" "WORLD") + if(permissions_ MATCHES "${any_chars_}r.*") + list(APPEND text_notation_ "${PERMISSION_TYPE}_READ") + endif() + string(APPEND any_chars_ ".") + if(permissions_ MATCHES "${any_chars_}w.*") + list(APPEND text_notation_ "${PERMISSION_TYPE}_WRITE") + endif() + string(APPEND any_chars_ ".") + if(permissions_ MATCHES "${any_chars_}x.*") + list(APPEND text_notation_ "${PERMISSION_TYPE}_EXECUTE") + endif() + endforeach() + + set(${RETURN_VAR} "${text_notation_}" PARENT_SCOPE) +endfunction() + function(get_unix_permissions_octal_notation PERMISSIONS_VAR RETURN_VAR) set(PERMISSIONS ${${PERMISSIONS_VAR}}) list(LENGTH PERMISSIONS PERM_LEN_PRE) @@ -1020,12 +1065,7 @@ function(cpack_rpm_prepare_relocation_paths) endforeach() # warn about all the paths that are not relocatable - cmake_policy(PUSH) - # Tell file(GLOB_RECURSE) not to follow directory symlinks - # even if the project does not set this policy to NEW. - cmake_policy(SET CMP0009 NEW) - file(GLOB_RECURSE FILE_PATHS_ "${WDIR}/*") - cmake_policy(POP) + file(GLOB_RECURSE FILE_PATHS_ "${WDIR}/*") foreach(TMP_PATH ${FILE_PATHS_}) string(LENGTH "${WDIR}" WDIR_LEN) string(SUBSTRING "${TMP_PATH}" ${WDIR_LEN} -1 TMP_PATH) @@ -1052,10 +1092,7 @@ endfunction() function(cpack_rpm_prepare_content_list) # get files list - cmake_policy(PUSH) - cmake_policy(SET CMP0009 NEW) - file(GLOB_RECURSE CPACK_RPM_INSTALL_FILES LIST_DIRECTORIES true RELATIVE "${WDIR}" "${WDIR}/*") - cmake_policy(POP) + file(GLOB_RECURSE CPACK_RPM_INSTALL_FILES LIST_DIRECTORIES true RELATIVE "${WDIR}" "${WDIR}/*") set(CPACK_RPM_INSTALL_FILES "/${CPACK_RPM_INSTALL_FILES}") string(REPLACE ";" ";/" CPACK_RPM_INSTALL_FILES "${CPACK_RPM_INSTALL_FILES}") @@ -1074,10 +1111,7 @@ function(cpack_rpm_prepare_content_list) set(_DISTINCT_PATH "${_RPM_RELOCATION_PREFIX}") string(REPLACE "/" ";" _CPACK_RPM_PACKAGE_PREFIX_ELEMS " ${_RPM_RELOCATION_PREFIX}") - cmake_policy(PUSH) - cmake_policy(SET CMP0007 NEW) - list(REMOVE_AT _CPACK_RPM_PACKAGE_PREFIX_ELEMS -1) - cmake_policy(POP) + list(REMOVE_AT _CPACK_RPM_PACKAGE_PREFIX_ELEMS -1) unset(_TMP_LIST) # Now generate all of the parent dirs of the relocation path foreach(_PREFIX_PATH_ELEM ${_CPACK_RPM_PACKAGE_PREFIX_ELEMS}) @@ -1515,7 +1549,7 @@ function(cpack_rpm_debugsymbol_check INSTALL_FILES WORKING_DIR) RESULT_VARIABLE OBJDUMP_EXEC_RESULT OUTPUT_VARIABLE OBJDUMP_OUT ERROR_QUIET) - # Check that if the given file was executable or not + # Check if the given file is an executable or not if(NOT OBJDUMP_EXEC_RESULT) string(FIND "${OBJDUMP_OUT}" "debug" FIND_RESULT) if(FIND_RESULT GREATER -1) @@ -1560,6 +1594,30 @@ function(cpack_rpm_debugsymbol_check INSTALL_FILES WORKING_DIR) else() message(WARNING "CPackRPM: File: ${F} does not contain debug symbols. They will possibly be missing from debuginfo package!") endif() + + get_file_permissions("${WORKING_DIR}/${F}" permissions_) + if(NOT "USER_EXECUTE" IN_LIST permissions_ AND + NOT "GROUP_EXECUTE" IN_LIST permissions_ AND + NOT "WORLD_EXECUTE" IN_LIST permissions_) + if(CPACK_RPM_INSTALL_WITH_EXEC) + execute_process(COMMAND chmod a+x ${WORKING_DIR}/${F} + RESULT_VARIABLE res_ + ERROR_VARIABLE err_ + OUTPUT_QUIET) + + if(res_) + message(FATAL_ERROR "CPackRPM: could not apply execute permissions " + "requested by CPACK_RPM_INSTALL_WITH_EXEC variable on " + "'${WORKING_DIR}/${F}'! Reason: '${err_}'") + endif() + else() + message(AUTHOR_WARNING "CPackRPM: File: ${WORKING_DIR}/${F} does not " + "have execute permissions. Debuginfo symbols will not be extracted" + "! Missing debuginfo may cause packaging failure. Consider setting " + "execute permissions or setting 'CPACK_RPM_INSTALL_WITH_EXEC' " + "variable.") + endif() + endif() endif() endforeach() @@ -1926,19 +1984,15 @@ function(cpack_rpm_generate_package) endif() if(DEFINED CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}) - cmake_policy(PUSH) - cmake_policy(SET CMP0057 NEW) - # Prefix can be replaced by Prefixes but the old version stil works so we'll ignore it for now - # Requires* is a special case because it gets transformed to Requires(pre/post/preun/postun) - # Auto* is a special case because the tags can not be queried by querytags rpmbuild flag - set(special_case_tags_ PREFIX REQUIRES_PRE REQUIRES_POST REQUIRES_PREUN REQUIRES_POSTUN AUTOPROV AUTOREQ AUTOREQPROV) - if(NOT _RPM_SPEC_HEADER IN_LIST RPMBUILD_TAG_LIST AND NOT _RPM_SPEC_HEADER IN_LIST special_case_tags_) - cmake_policy(POP) - message(AUTHOR_WARNING "CPackRPM:Warning: ${_RPM_SPEC_HEADER} not " - "supported in provided rpmbuild. Tag will not be used.") - continue() - endif() - cmake_policy(POP) + # Prefix can be replaced by Prefixes but the old version stil works so we'll ignore it for now + # Requires* is a special case because it gets transformed to Requires(pre/post/preun/postun) + # Auto* is a special case because the tags can not be queried by querytags rpmbuild flag + set(special_case_tags_ PREFIX REQUIRES_PRE REQUIRES_POST REQUIRES_PREUN REQUIRES_POSTUN AUTOPROV AUTOREQ AUTOREQPROV) + if(NOT _RPM_SPEC_HEADER IN_LIST RPMBUILD_TAG_LIST AND NOT _RPM_SPEC_HEADER IN_LIST special_case_tags_) + message(AUTHOR_WARNING "CPackRPM:Warning: ${_RPM_SPEC_HEADER} not " + "supported in provided rpmbuild. Tag will not be used.") + continue() + endif() if(CPACK_RPM_PACKAGE_DEBUG) message("CPackRPM:Debug: using CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}") @@ -1985,13 +2039,13 @@ function(cpack_rpm_generate_package) # CPACK_RPM_POST_INSTALL_SCRIPT_FILE (or CPACK_RPM_<COMPONENT>_POST_INSTALL_SCRIPT_FILE) # CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE (or CPACK_RPM_<COMPONENT>_POST_UNINSTALL_SCRIPT_FILE) # May be used to embed a post (un)installation script in the spec file. - # The refered script file(s) will be read and directly + # The referred script file(s) will be read and directly # put after the %post or %postun section # ---------------------------------------------------------------- # CPACK_RPM_PRE_INSTALL_SCRIPT_FILE (or CPACK_RPM_<COMPONENT>_PRE_INSTALL_SCRIPT_FILE) # CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE (or CPACK_RPM_<COMPONENT>_PRE_UNINSTALL_SCRIPT_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 + # The referred script file(s) will be read and directly # put after the %pre or %preun section foreach(RPM_SCRIPT_FILE_TYPE_ "INSTALL" "UNINSTALL") foreach(RPM_SCRIPT_FILE_TIME_ "PRE" "POST") @@ -2022,7 +2076,7 @@ function(cpack_rpm_generate_package) # 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 + # The referred 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) @@ -2152,7 +2206,7 @@ function(cpack_rpm_generate_package) string(STRIP "${CPACK_RPM_INSTALL_FILES}" CPACK_RPM_INSTALL_FILES_LIST) # Transform endline separated - string into CMake List string(REPLACE "\n" ";" CPACK_RPM_INSTALL_FILES_LIST "${CPACK_RPM_INSTALL_FILES_LIST}") - # Remove unecessary quotes + # Remove unnecessary quotes string(REPLACE "\"" "" CPACK_RPM_INSTALL_FILES_LIST "${CPACK_RPM_INSTALL_FILES_LIST}") # Remove ABSOLUTE install file from INSTALL FILE LIST list(REMOVE_ITEM CPACK_RPM_INSTALL_FILES_LIST ${CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL}) @@ -2230,12 +2284,9 @@ function(cpack_rpm_generate_package) continue() endif() - cmake_policy(PUSH) - cmake_policy(SET CMP0009 NEW) - file(GLOB_RECURSE files_for_move_ LIST_DIRECTORIES false RELATIVE - "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/${component_}" - "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/${component_}/*") - cmake_policy(POP) + file(GLOB_RECURSE files_for_move_ LIST_DIRECTORIES false RELATIVE + "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/${component_}" + "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/${component_}/*") foreach(f_ IN LISTS files_for_move_) get_filename_component(dir_path_ "${f_}" DIRECTORY) @@ -2367,13 +2418,9 @@ ${TMP_DEBUGINFO_ADDITIONAL_SOURCES} "CPACK_RPM_FILE_NAME") if(NOT CPACK_RPM_FILE_NAME STREQUAL "RPM-DEFAULT") if(CPACK_RPM_FILE_NAME) - cmake_policy(PUSH) - cmake_policy(SET CMP0010 NEW) - if(NOT CPACK_RPM_FILE_NAME MATCHES ".*\\.rpm") - cmake_policy(POP) - message(FATAL_ERROR "'${CPACK_RPM_FILE_NAME}' is not a valid RPM package file name as it must end with '.rpm'!") - endif() - cmake_policy(POP) + if(NOT CPACK_RPM_FILE_NAME MATCHES ".*\\.rpm") + message(FATAL_ERROR "'${CPACK_RPM_FILE_NAME}' is not a valid RPM package file name as it must end with '.rpm'!") + endif() else() # old file name format for back compatibility string(TOUPPER "${CPACK_RPM_MAIN_COMPONENT}" @@ -2413,7 +2460,7 @@ ${TMP_DEBUGINFO_ADDITIONAL_SOURCES} endif() # Disable debuginfo packages - srpm generates invalid packages due to - # releasing controll to cpack to generate binary packages. + # releasing control to cpack to generate binary packages. # Note however that this doesn't prevent cpack to generate debuginfo # packages when run from srpm with --rebuild. set(TMP_RPM_DISABLE_DEBUGINFO "%define debug_package %{nil}") @@ -2691,13 +2738,8 @@ mv %_topdir/tmpBBroot $RPM_BUILD_ROOT endif() # find generated rpm files and take their names - cmake_policy(PUSH) - # Tell file(GLOB_RECURSE) not to follow directory symlinks - # even if the project does not set this policy to NEW. - cmake_policy(SET CMP0009 NEW) - file(GLOB_RECURSE GENERATED_FILES "${CPACK_RPM_DIRECTORY}/RPMS/*.rpm" - "${CPACK_RPM_DIRECTORY}/SRPMS/*.rpm") - cmake_policy(POP) + file(GLOB_RECURSE GENERATED_FILES "${CPACK_RPM_DIRECTORY}/RPMS/*.rpm" + "${CPACK_RPM_DIRECTORY}/SRPMS/*.rpm") if(NOT GENERATED_FILES) message(FATAL_ERROR "RPM package was not generated! ${CPACK_RPM_DIRECTORY}") diff --git a/Modules/CPackWIX.cmake b/Modules/CPackWIX.cmake index 1dc37d4..c723e72 100644 --- a/Modules/CPackWIX.cmake +++ b/Modules/CPackWIX.cmake @@ -289,7 +289,7 @@ # if(NOT CPACK_WIX_ROOT) - file(TO_CMAKE_PATH "$ENV{WIX}" CPACK_WIX_ROOT) + string(REPLACE "\\" "/" CPACK_WIX_ROOT "$ENV{WIX}") endif() find_program(CPACK_WIX_CANDLE_EXECUTABLE candle diff --git a/Modules/CTest.cmake b/Modules/CTest.cmake index 9370596..a08282e 100644 --- a/Modules/CTest.cmake +++ b/Modules/CTest.cmake @@ -65,7 +65,7 @@ endfunction() include(CTestUseLaunchers) if(BUILD_TESTING) - # Setup some auxilary macros + # Setup some auxiliary macros macro(SET_IF_NOT_SET var val) if(NOT DEFINED "${var}") set("${var}" "${val}") diff --git a/Modules/CheckCCompilerFlag.cmake b/Modules/CheckCCompilerFlag.cmake index 5a7298b..9d2c74d 100644 --- a/Modules/CheckCCompilerFlag.cmake +++ b/Modules/CheckCCompilerFlag.cmake @@ -32,6 +32,7 @@ effect or even a specific one is beyond the scope of this module. in such variables may cause a false negative for this check. #]=======================================================================] +include_guard(GLOBAL) include(CheckCSourceCompiles) include(CMakeCheckCompilerFlagCommonPatterns) diff --git a/Modules/CheckCSourceCompiles.cmake b/Modules/CheckCSourceCompiles.cmake index 56e68d5..114213a 100644 --- a/Modules/CheckCSourceCompiles.cmake +++ b/Modules/CheckCSourceCompiles.cmake @@ -60,6 +60,7 @@ Check if given C source compiles and links into an executable. #]=======================================================================] +include_guard(GLOBAL) macro(CHECK_C_SOURCE_COMPILES SOURCE VAR) if(NOT DEFINED "${VAR}") diff --git a/Modules/CheckCSourceRuns.cmake b/Modules/CheckCSourceRuns.cmake index 8da9f1e..fa51346 100644 --- a/Modules/CheckCSourceRuns.cmake +++ b/Modules/CheckCSourceRuns.cmake @@ -60,6 +60,8 @@ subsequently be run. #]=======================================================================] +include_guard(GLOBAL) + macro(CHECK_C_SOURCE_RUNS SOURCE VAR) if(NOT DEFINED "${VAR}") set(MACRO_CHECK_FUNCTION_DEFINITIONS diff --git a/Modules/CheckCXXCompilerFlag.cmake b/Modules/CheckCXXCompilerFlag.cmake index f731b70..dd60835 100644 --- a/Modules/CheckCXXCompilerFlag.cmake +++ b/Modules/CheckCXXCompilerFlag.cmake @@ -32,6 +32,7 @@ effect or even a specific one is beyond the scope of this module. in such variables may cause a false negative for this check. #]=======================================================================] +include_guard(GLOBAL) include(CheckCXXSourceCompiles) include(CMakeCheckCompilerFlagCommonPatterns) diff --git a/Modules/CheckCXXSourceCompiles.cmake b/Modules/CheckCXXSourceCompiles.cmake index 4634a7b..ed8661b 100644 --- a/Modules/CheckCXXSourceCompiles.cmake +++ b/Modules/CheckCXXSourceCompiles.cmake @@ -60,6 +60,8 @@ Check if given C++ source compiles and links into an executable. #]=======================================================================] +include_guard(GLOBAL) + macro(CHECK_CXX_SOURCE_COMPILES SOURCE VAR) if(NOT DEFINED "${VAR}") set(_FAIL_REGEX) diff --git a/Modules/CheckCXXSourceRuns.cmake b/Modules/CheckCXXSourceRuns.cmake index 558708c..83bf2f2 100644 --- a/Modules/CheckCXXSourceRuns.cmake +++ b/Modules/CheckCXXSourceRuns.cmake @@ -60,6 +60,8 @@ subsequently be run. #]=======================================================================] +include_guard(GLOBAL) + macro(CHECK_CXX_SOURCE_RUNS SOURCE VAR) if(NOT DEFINED "${VAR}") set(MACRO_CHECK_FUNCTION_DEFINITIONS diff --git a/Modules/CheckCXXSymbolExists.cmake b/Modules/CheckCXXSymbolExists.cmake index 8552154..117a458 100644 --- a/Modules/CheckCXXSymbolExists.cmake +++ b/Modules/CheckCXXSymbolExists.cmake @@ -32,6 +32,7 @@ # CMAKE_REQUIRED_LIBRARIES = list of libraries to link # CMAKE_REQUIRED_QUIET = execute quietly without messages +include_guard(GLOBAL) include(CheckSymbolExists) macro(CHECK_CXX_SYMBOL_EXISTS SYMBOL FILES VARIABLE) diff --git a/Modules/CheckFortranCompilerFlag.cmake b/Modules/CheckFortranCompilerFlag.cmake index 8a1a8b9..2cb2532 100644 --- a/Modules/CheckFortranCompilerFlag.cmake +++ b/Modules/CheckFortranCompilerFlag.cmake @@ -32,6 +32,7 @@ effect or even a specific one is beyond the scope of this module. in such variables may cause a false negative for this check. #]=======================================================================] +include_guard(GLOBAL) include(CheckFortranSourceCompiles) include(CMakeCheckCompilerFlagCommonPatterns) diff --git a/Modules/CheckFortranFunctionExists.cmake b/Modules/CheckFortranFunctionExists.cmake index 5fc740a..f3ced93 100644 --- a/Modules/CheckFortranFunctionExists.cmake +++ b/Modules/CheckFortranFunctionExists.cmake @@ -24,6 +24,8 @@ # # CMAKE_REQUIRED_LIBRARIES = list of libraries to link +include_guard(GLOBAL) + macro(CHECK_FORTRAN_FUNCTION_EXISTS FUNCTION VARIABLE) if(NOT DEFINED ${VARIABLE}) message(STATUS "Looking for Fortran ${FUNCTION}") diff --git a/Modules/CheckFortranSourceCompiles.cmake b/Modules/CheckFortranSourceCompiles.cmake index 4df17e3..d2b0cca 100644 --- a/Modules/CheckFortranSourceCompiles.cmake +++ b/Modules/CheckFortranSourceCompiles.cmake @@ -66,6 +66,7 @@ Check if given Fortran source compiles and links into an executable. #]=======================================================================] +include_guard(GLOBAL) macro(CHECK_Fortran_SOURCE_COMPILES SOURCE VAR) if(NOT DEFINED "${VAR}") diff --git a/Modules/CheckFunctionExists.cmake b/Modules/CheckFunctionExists.cmake index ef08062..d00aa8a 100644 --- a/Modules/CheckFunctionExists.cmake +++ b/Modules/CheckFunctionExists.cmake @@ -38,6 +38,8 @@ # * ``check_function_exists()`` only verifies linking, it does not verify # that the function is declared in system headers. +include_guard(GLOBAL) + macro(CHECK_FUNCTION_EXISTS FUNCTION VARIABLE) if(NOT DEFINED "${VARIABLE}" OR "x${${VARIABLE}}" STREQUAL "x${VARIABLE}") set(MACRO_CHECK_FUNCTION_DEFINITIONS diff --git a/Modules/CheckIncludeFile.cmake b/Modules/CheckIncludeFile.cmake index c566e14..e5554c4 100644 --- a/Modules/CheckIncludeFile.cmake +++ b/Modules/CheckIncludeFile.cmake @@ -34,6 +34,8 @@ # at once. See the :module:`CheckIncludeFileCXX` module to check for headers # using the ``CXX`` language. +include_guard(GLOBAL) + macro(CHECK_INCLUDE_FILE INCLUDE VARIABLE) if(NOT DEFINED "${VARIABLE}") if(CMAKE_REQUIRED_INCLUDES) diff --git a/Modules/CheckIncludeFileCXX.cmake b/Modules/CheckIncludeFileCXX.cmake index 19b1ef6..7948bab 100644 --- a/Modules/CheckIncludeFileCXX.cmake +++ b/Modules/CheckIncludeFileCXX.cmake @@ -33,6 +33,8 @@ # See modules :module:`CheckIncludeFile` and :module:`CheckIncludeFiles` # to check for one or more ``C`` headers. +include_guard(GLOBAL) + macro(CHECK_INCLUDE_FILE_CXX INCLUDE VARIABLE) if(NOT DEFINED "${VARIABLE}" OR "x${${VARIABLE}}" STREQUAL "x${VARIABLE}") if(CMAKE_REQUIRED_INCLUDES) diff --git a/Modules/CheckIncludeFiles.cmake b/Modules/CheckIncludeFiles.cmake index bef11a5..59afdab 100644 --- a/Modules/CheckIncludeFiles.cmake +++ b/Modules/CheckIncludeFiles.cmake @@ -6,19 +6,24 @@ # ----------------- # # Provides a macro to check if a list of one or more header files can -# be included together in ``C``. +# be included together. # # .. command:: CHECK_INCLUDE_FILES # # :: # -# CHECK_INCLUDE_FILES("<includes>" <variable>) +# CHECK_INCLUDE_FILES("<includes>" <variable> [LANGUAGE <language>]) # # Check if the given ``<includes>`` list may be included together -# in a ``C`` source file and store the result in an internal cache +# in a source file and store the result in an internal cache # entry named ``<variable>``. Specify the ``<includes>`` argument # as a :ref:`;-list <CMake Language Lists>` of header file names. # +# If LANGUAGE is set, the specified compiler will be used to perform the +# check. Acceptable values are ``C`` and ``CXX``. If not set, the C compiler +# will be used if enabled. If the C compiler is not enabled, the C++ +# compiler will be used if enabled. +# # The following variables may be set before calling this macro to modify # the way the check is run: # @@ -34,9 +39,36 @@ # See modules :module:`CheckIncludeFile` and :module:`CheckIncludeFileCXX` # to check for a single header file in ``C`` or ``CXX`` languages. +include_guard(GLOBAL) + macro(CHECK_INCLUDE_FILES INCLUDE VARIABLE) if(NOT DEFINED "${VARIABLE}") set(CMAKE_CONFIGURABLE_FILE_CONTENT "/* */\n") + + if("x${ARGN}" STREQUAL "x") + if(CMAKE_C_COMPILER_LOADED) + set(_lang C) + elseif(CMAKE_CXX_COMPILER_LOADED) + set(_lang CXX) + else() + message(FATAL_ERROR "CHECK_INCLUDE_FILES needs either C or CXX language enabled.\n") + endif() + elseif("x${ARGN}" MATCHES "^xLANGUAGE;([a-zA-Z]+)$") + set(_lang "${CMAKE_MATCH_1}") + elseif("x${ARGN}" MATCHES "^xLANGUAGE$") + message(FATAL_ERROR "No languages listed for LANGUAGE option.\nSupported languages: C, CXX.\n") + else() + message(FATAL_ERROR "Unknown arguments:\n ${ARGN}\n") + endif() + + if(_lang STREQUAL "C") + set(src ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CheckIncludeFiles/${VARIABLE}.c) + elseif(_lang STREQUAL "CXX") + set(src ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CheckIncludeFiles/${VARIABLE}.cpp) + else() + message(FATAL_ERROR "Unknown language:\n ${_lang}\nSupported languages: C, CXX.\n") + endif() + if(CMAKE_REQUIRED_INCLUDES) set(CHECK_INCLUDE_FILES_INCLUDE_DIRS "-DINCLUDE_DIRECTORIES=${CMAKE_REQUIRED_INCLUDES}") else() @@ -51,7 +83,7 @@ macro(CHECK_INCLUDE_FILES INCLUDE VARIABLE) string(APPEND CMAKE_CONFIGURABLE_FILE_CONTENT "\n\nint main(void){return 0;}\n") configure_file("${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in" - "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFiles.c" @ONLY) + "${src}" @ONLY) set(_INCLUDE ${INCLUDE}) # remove empty elements if("${_INCLUDE}" MATCHES "^([^;]+);.+;([^;]+)$") @@ -68,7 +100,7 @@ macro(CHECK_INCLUDE_FILES INCLUDE VARIABLE) endif() try_compile(${VARIABLE} ${CMAKE_BINARY_DIR} - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFiles.c + ${src} COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_INCLUDE_FILES_FLAGS} diff --git a/Modules/CheckLanguage.cmake b/Modules/CheckLanguage.cmake index 1ea91d2..ce92bfe 100644 --- a/Modules/CheckLanguage.cmake +++ b/Modules/CheckLanguage.cmake @@ -31,6 +31,8 @@ # message(STATUS "No Fortran support") # endif() +include_guard(GLOBAL) + macro(check_language lang) if(NOT DEFINED CMAKE_${lang}_COMPILER) set(_desc "Looking for a ${lang} compiler") @@ -43,11 +45,17 @@ file(WRITE \"\${CMAKE_CURRENT_BINARY_DIR}/result.cmake\" \"set(CMAKE_${lang}_COMPILER \\\"\${CMAKE_${lang}_COMPILER}\\\")\\n\" ) ") + if(CMAKE_GENERATOR_INSTANCE) + set(_D_CMAKE_GENERATOR_INSTANCE "-DCMAKE_GENERATOR_INSTANCE:INTERNAL=${CMAKE_GENERATOR_INSTANCE}") + else() + set(_D_CMAKE_GENERATOR_INSTANCE "") + endif() execute_process( WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/Check${lang} COMMAND ${CMAKE_COMMAND} . -G ${CMAKE_GENERATOR} -A "${CMAKE_GENERATOR_PLATFORM}" -T "${CMAKE_GENERATOR_TOOLSET}" + ${_D_CMAKE_GENERATOR_INSTANCE} OUTPUT_VARIABLE output ERROR_VARIABLE output RESULT_VARIABLE result diff --git a/Modules/CheckLibraryExists.cmake b/Modules/CheckLibraryExists.cmake index 528a450..487cc59 100644 --- a/Modules/CheckLibraryExists.cmake +++ b/Modules/CheckLibraryExists.cmake @@ -29,6 +29,8 @@ # CMAKE_REQUIRED_LIBRARIES = list of libraries to link # CMAKE_REQUIRED_QUIET = execute quietly without messages +include_guard(GLOBAL) + macro(CHECK_LIBRARY_EXISTS LIBRARY FUNCTION LOCATION VARIABLE) if(NOT DEFINED "${VARIABLE}") set(MACRO_CHECK_LIBRARY_EXISTS_DEFINITION diff --git a/Modules/CheckPrototypeDefinition.cmake b/Modules/CheckPrototypeDefinition.cmake index 7859594..ceb4d88 100644 --- a/Modules/CheckPrototypeDefinition.cmake +++ b/Modules/CheckPrototypeDefinition.cmake @@ -41,9 +41,9 @@ # - get_filename_component(__check_proto_def_dir "${CMAKE_CURRENT_LIST_FILE}" PATH) +include_guard(GLOBAL) function(CHECK_PROTOTYPE_DEFINITION _FUNCTION _PROTOTYPE _RETURN _HEADER _VARIABLE) diff --git a/Modules/CheckStructHasMember.cmake b/Modules/CheckStructHasMember.cmake index 085b464..8689a5c 100644 --- a/Modules/CheckStructHasMember.cmake +++ b/Modules/CheckStructHasMember.cmake @@ -38,6 +38,7 @@ # Example: CHECK_STRUCT_HAS_MEMBER("struct timeval" tv_sec sys/select.h # HAVE_TIMEVAL_TV_SEC LANGUAGE C) +include_guard(GLOBAL) include(CheckCSourceCompiles) include(CheckCXXSourceCompiles) diff --git a/Modules/CheckSymbolExists.cmake b/Modules/CheckSymbolExists.cmake index 6d52d56..d9c9ae4 100644 --- a/Modules/CheckSymbolExists.cmake +++ b/Modules/CheckSymbolExists.cmake @@ -43,6 +43,8 @@ the way the check is run: execute quietly without messages #]=======================================================================] +include_guard(GLOBAL) + macro(CHECK_SYMBOL_EXISTS SYMBOL FILES VARIABLE) if(CMAKE_C_COMPILER_LOADED) __CHECK_SYMBOL_EXISTS_IMPL("${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckSymbolExists.c" "${SYMBOL}" "${FILES}" "${VARIABLE}" ) diff --git a/Modules/CheckTypeSize.cmake b/Modules/CheckTypeSize.cmake index fcf1df7..2b5deec 100644 --- a/Modules/CheckTypeSize.cmake +++ b/Modules/CheckTypeSize.cmake @@ -71,11 +71,13 @@ include(CheckIncludeFile) include(CheckIncludeFileCXX) +get_filename_component(__check_type_size_dir "${CMAKE_CURRENT_LIST_FILE}" PATH) + +include_guard(GLOBAL) + cmake_policy(PUSH) cmake_policy(SET CMP0054 NEW) -get_filename_component(__check_type_size_dir "${CMAKE_CURRENT_LIST_FILE}" PATH) - #----------------------------------------------------------------------------- # Helper function. DO NOT CALL DIRECTLY. function(__check_type_size_impl type var map builtin language) diff --git a/Modules/CheckVariableExists.cmake b/Modules/CheckVariableExists.cmake index fd5c36c..ab456d1 100644 --- a/Modules/CheckVariableExists.cmake +++ b/Modules/CheckVariableExists.cmake @@ -32,6 +32,8 @@ # CMAKE_REQUIRED_LIBRARIES = list of libraries to link # CMAKE_REQUIRED_QUIET = execute quietly without messages +include_guard(GLOBAL) + macro(CHECK_VARIABLE_EXISTS VAR VARIABLE) if(NOT DEFINED "${VARIABLE}") set(MACRO_CHECK_VARIABLE_DEFINITIONS diff --git a/Modules/Compiler/Clang.cmake b/Modules/Compiler/Clang.cmake index 9f5e921..7ce1adb 100644 --- a/Modules/Compiler/Clang.cmake +++ b/Modules/Compiler/Clang.cmake @@ -11,7 +11,8 @@ set(__COMPILER_CLANG 1) include(Compiler/CMakeCommonCompilerMacros) if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC" - OR "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC") + OR "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC" + OR "x${CMAKE_Fortran_SIMULATE_ID}" STREQUAL "xMSVC") macro(__compiler_clang lang) endmacro() else() diff --git a/Modules/Compiler/IAR-FindBinUtils.cmake b/Modules/Compiler/IAR-FindBinUtils.cmake index d662f56..5fecb26 100644 --- a/Modules/Compiler/IAR-FindBinUtils.cmake +++ b/Modules/Compiler/IAR-FindBinUtils.cmake @@ -17,7 +17,7 @@ if("${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}" STREQUAL "A find_program(CMAKE_IAR_ARCHIVE iarchive.exe HINTS ${__iar_hints} DOC "The IAR archiver") - # find auxillary tools + # find auxiliary tools find_program(CMAKE_IAR_ELFTOOL ielftool.exe HINTS ${__iar_hints} DOC "The IAR ELF Tool") find_program(CMAKE_IAR_ELFDUMP ielfdumparm.exe HINTS ${__iar_hints} diff --git a/Modules/Compiler/IAR.cmake b/Modules/Compiler/IAR.cmake index 52ebaf2..43243b9 100644 --- a/Modules/Compiler/IAR.cmake +++ b/Modules/Compiler/IAR.cmake @@ -29,7 +29,7 @@ # "Silent" Operation # # this really is different to most programs I know. -# nothing meaningfull from the operation is lost, just some redundant +# nothing meaningful from the operation is lost, just some redundant # code and data size printouts (that can be inspected with common tools). # This module is shared by multiple languages; use include blocker. diff --git a/Modules/Compiler/TI-C.cmake b/Modules/Compiler/TI-C.cmake index ebc79f4..e149237 100644 --- a/Modules/Compiler/TI-C.cmake +++ b/Modules/Compiler/TI-C.cmake @@ -2,6 +2,8 @@ set(CMAKE_LIBRARY_PATH_FLAG "--search_path=") set(CMAKE_LINK_LIBRARY_FLAG "--library=") set(CMAKE_INCLUDE_FLAG_C "--include_path=") +set(CMAKE_DEPFILE_FLAGS_C "--preproc_with_compile --preproc_dependency=<DEPFILE>") + set(CMAKE_C_CREATE_ASSEMBLY_SOURCE "<CMAKE_C_COMPILER> --compile_only --skip_assembler --c_file=<SOURCE> <DEFINES> <INCLUDES> <FLAGS> --output_file=<ASSEMBLY_SOURCE>") set(CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> --preproc_only --c_file=<SOURCE> <DEFINES> <INCLUDES> <FLAGS> --output_file=<PREPROCESSED_SOURCE>") diff --git a/Modules/Compiler/TI-CXX.cmake b/Modules/Compiler/TI-CXX.cmake index 4104c3b..8b0069b 100644 --- a/Modules/Compiler/TI-CXX.cmake +++ b/Modules/Compiler/TI-CXX.cmake @@ -2,6 +2,8 @@ set(CMAKE_LIBRARY_PATH_FLAG "--search_path=") set(CMAKE_LINK_LIBRARY_FLAG "--library=") set(CMAKE_INCLUDE_FLAG_CXX "--include_path=") +set(CMAKE_DEPFILE_FLAGS_CCX "--preproc_with_compile --preproc_dependency=<DEPFILE>") + set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE "<CMAKE_CXX_COMPILER> --compile_only --skip_assembler --cpp_file=<SOURCE> <DEFINES> <INCLUDES> <FLAGS> --output_file=<ASSEMBLY_SOURCE>") set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> --preproc_only --cpp_file=<SOURCE> <DEFINES> <INCLUDES> <FLAGS> --output_file=<PREPROCESSED_SOURCE>") diff --git a/Modules/Documentation.cmake b/Modules/Documentation.cmake index fc398e6..6e21249 100644 --- a/Modules/Documentation.cmake +++ b/Modules/Documentation.cmake @@ -40,7 +40,7 @@ if (BUILD_DOCUMENTATION) ) # - # The documentation process is controled by a batch file. + # The documentation process is controlled by a batch file. # We will probably need bash to create the custom target # diff --git a/Modules/ExternalProject-download.cmake.in b/Modules/ExternalProject-download.cmake.in index 7f92596..99fb917 100644 --- a/Modules/ExternalProject-download.cmake.in +++ b/Modules/ExternalProject-download.cmake.in @@ -116,6 +116,8 @@ foreach(i RANGE ${retry_number}) @TLS_VERIFY_CODE@ @TLS_CAINFO_CODE@ + @NETRC_CODE@ + @NETRC_FILE_CODE@ file( DOWNLOAD diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index 419c9d6..d284e27 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -193,6 +193,28 @@ External Project Definition ``CMAKE_TLS_CAINFO`` variable will be used instead (see :command:`file(DOWNLOAD)`) + ``NETRC <level>`` + Specify whether the .netrc file is to be used for operation. If this + option is not specified, the value of the ``CMAKE_NETRC`` variable + will be used instead (see :command:`file(DOWNLOAD)`) + Valid levels are: + + ``IGNORED`` + The .netrc file is ignored. + This is the default. + ``OPTIONAL`` + The .netrc file is optional, and information in the URL is preferred. + The file will be scanned to find which ever information is not specified + in the URL. + ``REQUIRED`` + The .netrc file is required, and information in the URL is ignored. + + ``NETRC_FILE <file>`` + Specify an alternative .netrc file to the one in your home directory + if the ``NETRC`` level is ``OPTIONAL`` or ``REQUIRED``. If this option + is not specified, the value of the ``CMAKE_NETRC_FILE`` variable will + be used instead (see :command:`file(DOWNLOAD)`) + *Git* NOTE: A git version of 1.6.5 or later is required if this download method is used. @@ -359,6 +381,11 @@ External Project Definition :variable:`CMAKE_GENERATOR_TOOLSET`). It is an error to provide this option without the ``CMAKE_GENERATOR`` option. + ``CMAKE_GENERATOR_INSTANCE <instance>`` + Pass a generator-specific instance selection to the CMake command (see + :variable:`CMAKE_GENERATOR_INSTANCE`). It is an error to provide this + option without the ``CMAKE_GENERATOR`` option. + ``CMAKE_ARGS <arg>...`` The specified arguments are passed to the ``cmake`` command line. They can be any argument the ``cmake`` command understands, not just cache @@ -687,8 +714,9 @@ control needed to implement such step-level capabilities. The command line, comment, working directory and byproducts of every standard and custom step are processed to replace the tokens ``<SOURCE_DIR>``, ``<SOURCE_SUBDIR>``, ``<BINARY_DIR>``, ``<INSTALL_DIR>`` - and ``<TMP_DIR>`` with their corresponding property values defined in the - original call to :command:`ExternalProject_Add`. + ``<TMP_DIR>``, ``<DOWNLOAD_DIR>`` and ``<DOWNLOADED_FILE>`` with their + corresponding property values defined in the original call to + :command:`ExternalProject_Add`. .. command:: ExternalProject_Add_StepTargets @@ -1346,7 +1374,7 @@ endif() endfunction(_ep_write_gitupdate_script) -function(_ep_write_downloadfile_script script_filename REMOTE LOCAL timeout no_progress hash tls_verify tls_cainfo userpwd http_headers) +function(_ep_write_downloadfile_script script_filename REMOTE LOCAL timeout no_progress hash tls_verify tls_cainfo userpwd http_headers netrc netrc_file) if(timeout) set(TIMEOUT_ARGS TIMEOUT ${timeout}) set(TIMEOUT_MSG "${timeout} seconds") @@ -1371,6 +1399,8 @@ function(_ep_write_downloadfile_script script_filename REMOTE LOCAL timeout no_p set(TLS_VERIFY_CODE "") set(TLS_CAINFO_CODE "") + set(NETRC_CODE "") + set(NETRC_FILE_CODE "") # check for curl globals in the project if(DEFINED CMAKE_TLS_VERIFY) @@ -1379,6 +1409,12 @@ function(_ep_write_downloadfile_script script_filename REMOTE LOCAL timeout no_p if(DEFINED CMAKE_TLS_CAINFO) set(TLS_CAINFO_CODE "set(CMAKE_TLS_CAINFO \"${CMAKE_TLS_CAINFO}\")") endif() + if(DEFINED CMAKE_NETRC) + set(NETRC_CODE "set(CMAKE_NETRC \"${CMAKE_NETRC}\")") + endif() + if(DEFINED CMAKE_NETRC_FILE) + set(NETRC_FILE_CODE "set(CMAKE_NETRC_FILE \"${CMAKE_NETRC_FILE}\")") + endif() # now check for curl locals so that the local values # will override the globals @@ -1393,6 +1429,16 @@ function(_ep_write_downloadfile_script script_filename REMOTE LOCAL timeout no_p if(tls_cainfo_len GREATER 0) set(TLS_CAINFO_CODE "set(CMAKE_TLS_CAINFO \"${tls_cainfo}\")") endif() + # check for netrc argument + string(LENGTH "${netrc}" netrc_len) + if(netrc_len GREATER 0) + set(NETRC_CODE "set(CMAKE_NETRC \"${netrc}\")") + endif() + # check for netrc_file argument + string(LENGTH "${netrc_file}" netrc_file_len) + if(netrc_file_len GREATER 0) + set(NETRC_FILE_CODE "set(CMAKE_NETRC_FILE \"${netrc_file}\")") + endif() if(userpwd STREQUAL ":") set(USERPWD_ARGS) @@ -1620,7 +1666,7 @@ macro(_ep_replace_location_tags target_name) set(vars ${ARGN}) foreach(var ${vars}) if(${var}) - foreach(dir SOURCE_DIR SOURCE_SUBDIR BINARY_DIR INSTALL_DIR TMP_DIR DOWNLOADED_FILE) + foreach(dir SOURCE_DIR SOURCE_SUBDIR BINARY_DIR INSTALL_DIR TMP_DIR DOWNLOAD_DIR DOWNLOADED_FILE) get_property(val TARGET ${target_name} PROPERTY _EP_${dir}) string(REPLACE "<${dir}>" "${val}" ${var} "${${var}}") endforeach() @@ -2436,11 +2482,13 @@ function(_ep_add_download_command name) get_property(no_progress TARGET ${name} PROPERTY _EP_DOWNLOAD_NO_PROGRESS) get_property(tls_verify TARGET ${name} PROPERTY _EP_TLS_VERIFY) get_property(tls_cainfo TARGET ${name} PROPERTY _EP_TLS_CAINFO) + get_property(netrc TARGET ${name} PROPERTY _EP_NETRC) + get_property(netrc_file TARGET ${name} PROPERTY _EP_NETRC_FILE) get_property(http_username TARGET ${name} PROPERTY _EP_HTTP_USERNAME) get_property(http_password TARGET ${name} PROPERTY _EP_HTTP_PASSWORD) get_property(http_headers TARGET ${name} PROPERTY _EP_HTTP_HEADER) set(download_script "${stamp_dir}/download-${name}.cmake") - _ep_write_downloadfile_script("${download_script}" "${url}" "${file}" "${timeout}" "${no_progress}" "${hash}" "${tls_verify}" "${tls_cainfo}" "${http_username}:${http_password}" "${http_headers}") + _ep_write_downloadfile_script("${download_script}" "${url}" "${file}" "${timeout}" "${no_progress}" "${hash}" "${tls_verify}" "${tls_cainfo}" "${http_username}:${http_password}" "${http_headers}" "${netrc}" "${netrc_file}") set(cmd ${CMAKE_COMMAND} -P "${download_script}" COMMAND) if (no_extract) @@ -2712,6 +2760,7 @@ function(_ep_extract_configure_command var name) endif() get_target_property(cmake_generator ${name} _EP_CMAKE_GENERATOR) + get_target_property(cmake_generator_instance ${name} _EP_CMAKE_GENERATOR_INSTANCE) get_target_property(cmake_generator_platform ${name} _EP_CMAKE_GENERATOR_PLATFORM) get_target_property(cmake_generator_toolset ${name} _EP_CMAKE_GENERATOR_TOOLSET) if(cmake_generator) @@ -2722,6 +2771,9 @@ function(_ep_extract_configure_command var name) if(cmake_generator_toolset) list(APPEND cmd "-T${cmake_generator_toolset}") endif() + if(cmake_generator_instance) + list(APPEND cmd "-DCMAKE_GENERATOR_INSTANCE:INTERNAL=${cmake_generator_instance}") + endif() else() if(CMAKE_EXTRA_GENERATOR) list(APPEND cmd "-G${CMAKE_EXTRA_GENERATOR} - ${CMAKE_GENERATOR}") @@ -2740,6 +2792,12 @@ function(_ep_extract_configure_command var name) if(CMAKE_GENERATOR_TOOLSET) list(APPEND cmd "-T${CMAKE_GENERATOR_TOOLSET}") endif() + if(cmake_generator_instance) + message(FATAL_ERROR "Option CMAKE_GENERATOR_INSTANCE not allowed without CMAKE_GENERATOR.") + endif() + if(CMAKE_GENERATOR_INSTANCE) + list(APPEND cmd "-DCMAKE_GENERATOR_INSTANCE:INTERNAL=${CMAKE_GENERATOR_INSTANCE}") + endif() endif() list(APPEND cmd "<SOURCE_DIR><SOURCE_SUBDIR>") diff --git a/Modules/FeatureSummary.cmake b/Modules/FeatureSummary.cmake index 1b93304..fbce235 100644 --- a/Modules/FeatureSummary.cmake +++ b/Modules/FeatureSummary.cmake @@ -493,7 +493,7 @@ endfunction() by the project when available at buildtime, but it also work without. ``RECOMMENDED`` is similar to ``OPTIONAL``, i.e. the project will build if the package is not present, but the functionality of the resulting - binaries will be severly limited. If a ``REQUIRED`` package is not + binaries will be severely limited. If a ``REQUIRED`` package is not available at buildtime, the project may not even build. This can be combined with the ``FATAL_ON_MISSING_REQUIRED_PACKAGES`` argument for ``feature_summary()``. Last, a ``RUNTIME`` package is a package which is diff --git a/Modules/FetchContent.cmake b/Modules/FetchContent.cmake new file mode 100644 index 0000000..98cdf6c --- /dev/null +++ b/Modules/FetchContent.cmake @@ -0,0 +1,916 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +#[=======================================================================[.rst: +FetchContent +------------------ + +.. only:: html + + .. contents:: + +Overview +^^^^^^^^ + +This module enables populating content at configure time via any method +supported by the :module:`ExternalProject` module. Whereas +:command:`ExternalProject_Add` downloads at build time, the +``FetchContent`` module makes content available immediately, allowing the +configure step to use the content in commands like :command:`add_subdirectory`, +:command:`include` or :command:`file` operations. + +Content population details would normally be defined separately from the +command that performs the actual population. Projects should also +check whether the content has already been populated somewhere else in the +project hierarchy. Typical usage would look something like this: + +.. code-block:: cmake + + FetchContent_Declare( + googletest + GIT_REPOSITORY https://github.com/google/googletest.git + GIT_TAG release-1.8.0 + ) + + FetchContent_GetProperties(googletest) + if(NOT googletest_POPULATED) + FetchContent_Populate(googletest) + add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR}) + endif() + +When using the above pattern with a hierarchical project arrangement, +projects at higher levels in the hierarchy are able to define or override +the population details of content specified anywhere lower in the project +hierarchy. The ability to detect whether content has already been +populated ensures that even if multiple child projects want certain content +to be available, the first one to populate it wins. The other child project +can simply make use of the already available content instead of repeating +the population for itself. See the +:ref:`Examples <fetch-content-examples>` section which demonstrates +this scenario. + +The ``FetchContent`` module also supports defining and populating +content in a single call, with no check for whether the content has been +populated elsewhere in the project already. This is a more low level +operation and would not normally be the way the module is used, but it is +sometimes useful as part of implementing some higher level feature or to +populate some content in CMake's script mode. + + +Declaring Content Details +^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. command:: FetchContent_Declare + + .. code-block:: cmake + + FetchContent_Declare(<name> <contentOptions>...) + + The ``FetchContent_Declare()`` function records the options that describe + how to populate the specified content, but if such details have already + been recorded earlier in this project (regardless of where in the project + hierarchy), this and all later calls for the same content ``<name>`` are + ignored. This "first to record, wins" approach is what allows hierarchical + projects to have parent projects override content details of child projects. + + The content ``<name>`` can be any string without spaces, but good practice + would be to use only letters, numbers and underscores. The name will be + treated case-insensitively and it should be obvious for the content it + represents, often being the name of the child project or the value given + to its top level :command:`project` command (if it is a CMake project). + For well-known public projects, the name should generally be the official + name of the project. Choosing an unusual name makes it unlikely that other + projects needing that same content will use the same name, leading to + the content being populated multiple times. + + The ``<contentOptions>`` can be any of the download or update/patch options + that the :command:`ExternalProject_Add` command understands. The configure, + build, install and test steps are explicitly disabled and therefore options + related to them will be ignored. In most cases, ``<contentOptions>`` will + just be a couple of options defining the download method and method-specific + details like a commit tag or archive hash. For example: + + .. code-block:: cmake + + FetchContent_Declare( + googletest + GIT_REPOSITORY https://github.com/google/googletest.git + GIT_TAG release-1.8.0 + ) + + FetchContent_Declare( + myCompanyIcons + URL https://intranet.mycompany.com/assets/iconset_1.12.tar.gz + URL_HASH 5588a7b18261c20068beabfb4f530b87 + ) + + FetchContent_Declare( + myCompanyCertificates + SVN_REPOSITORY svn+ssh://svn.mycompany.com/srv/svn/trunk/certs + SVN_REVISION -r12345 + ) + +Populating The Content +^^^^^^^^^^^^^^^^^^^^^^ + +.. command:: FetchContent_Populate + + .. code-block:: cmake + + FetchContent_Populate( <name> ) + + In most cases, the only argument given to ``FetchContent_Populate()`` is the + ``<name>``. When used this way, the command assumes the content details have + been recorded by an earlier call to :command:`FetchContent_Declare`. The + details are stored in a global property, so they are unaffected by things + like variable or directory scope. Therefore, it doesn't matter where in the + project the details were previously declared, as long as they have been + declared before the call to ``FetchContent_Populate()``. Those saved details + are then used to construct a call to :command:`ExternalProject_Add` in a + private sub-build to perform the content population immediately. The + implementation of ``ExternalProject_Add()`` ensures that if the content has + already been populated in a previous CMake run, that content will be reused + rather than repopulating them again. For the common case where population + involves downloading content, the cost of the download is only paid once. + + An internal global property records when a particular content population + request has been processed. If ``FetchContent_Populate()`` is called more + than once for the same content name within a configure run, the second call + will halt with an error. Projects can and should check whether content + population has already been processed with the + :command:`FetchContent_GetProperties` command before calling + ``FetchContent_Populate()``. + + ``FetchContent_Populate()`` will set three variables in the scope of the + caller; ``<lcName>_POPULATED``, ``<lcName>_SOURCE_DIR`` and + ``<lcName>_BINARY_DIR``, where ``<lcName>`` is the lowercased ``<name>``. + ``<lcName>_POPULATED`` will always be set to ``True`` by the call. + ``<lcName>_SOURCE_DIR`` is the location where the + content can be found upon return (it will have already been populated), while + ``<lcName>_BINARY_DIR`` is a directory intended for use as a corresponding + build directory. The main use case for the two directory variables is to + call :command:`add_subdirectory` immediately after population, i.e.: + + .. code-block:: cmake + + FetchContent_Populate(FooBar ...) + add_subdirectory(${foobar_SOURCE_DIR} ${foobar_BINARY_DIR}) + + The values of the three variables can also be retrieved from anywhere in the + project hierarchy using the :command:`FetchContent_GetProperties` command. + + A number of cache variables influence the behavior of all content population + performed using details saved from a :command:`FetchContent_Declare` call: + + ``FETCHCONTENT_BASE_DIR`` + In most cases, the saved details do not specify any options relating to the + directories to use for the internal sub-build, final source and build areas. + It is generally best to leave these decisions up to the ``FetchContent`` + module to handle on the project's behalf. The ``FETCHCONTENT_BASE_DIR`` + cache variable controls the point under which all content population + directories are collected, but in most cases developers would not need to + change this. The default location is ``${CMAKE_BINARY_DIR}/_deps``, but if + developers change this value, they should aim to keep the path short and + just below the top level of the build tree to avoid running into path + length problems on Windows. + + ``FETCHCONTENT_QUIET`` + The logging output during population can be quite verbose, making the + configure stage quite noisy. This cache option (``ON`` by default) hides + all population output unless an error is encountered. If experiencing + problems with hung downloads, temporarily switching this option off may + help diagnose which content population is causing the issue. + + ``FETCHCONTENT_FULLY_DISCONNECTED`` + When this option is enabled, no attempt is made to download or update + any content. It is assumed that all content has already been populated in + a previous run or the source directories have been pointed at existing + contents the developer has provided manually (using options described + further below). When the developer knows that no changes have been made to + any content details, turning this option ``ON`` can significantly speed up + the configure stage. It is ``OFF`` by default. + + ``FETCHCONTENT_UPDATES_DISCONNECTED`` + This is a less severe download/update control compared to + ``FETCHCONTENT_FULLY_DISCONNECTED``. Instead of bypassing all download and + update logic, the ``FETCHCONTENT_UPDATES_DISCONNECTED`` only disables the + update stage. Therefore, if content has not been downloaded previously, + it will still be downloaded when this option is enabled. This can speed up + the configure stage, but not as much as + ``FETCHCONTENT_FULLY_DISCONNECTED``. It is ``OFF`` by default. + + In addition to the above cache variables, the following cache variables are + also defined for each content name (``<ucName>`` is the uppercased value of + ``<name>``): + + ``FETCHCONTENT_SOURCE_DIR_<ucName>`` + If this is set, no download or update steps are performed for the specified + content and the ``<lcName>_SOURCE_DIR`` variable returned to the caller is + pointed at this location. This gives developers a way to have a separate + checkout of the content that they can modify freely without interference + from the build. The build simply uses that existing source, but it still + defines ``<lcName>_BINARY_DIR`` to point inside its own build area. + Developers are strongly encouraged to use this mechanism rather than + editing the sources populated in the default location, as changes to + sources in the default location can be lost when content population details + are changed by the project. + + ``FETCHCONTENT_UPDATES_DISCONNECTED_<ucName>`` + This is the per-content equivalent of + ``FETCHCONTENT_UPDATES_DISCONNECTED``. If the global option or this option + is ``ON``, then updates will be disabled for the named content. + Disabling updates for individual content can be useful for content whose + details rarely change, while still leaving other frequently changing + content with updates enabled. + + + The ``FetchContent_Populate()`` command also supports a syntax allowing the + content details to be specified directly rather than using any saved + details. This is more low-level and use of this form is generally to be + avoided in favour of using saved content details as outlined above. + Nevertheless, in certain situations it can be useful to invoke the content + population as an isolated operation (typically as part of implementing some + other higher level feature or when using CMake in script mode): + + .. code-block:: cmake + + FetchContent_Populate( <name> + [QUIET] + [SUBBUILD_DIR <subBuildDir>] + [SOURCE_DIR <srcDir>] + [BINARY_DIR <binDir>] + ... + ) + + This form has a number of key differences to that where only ``<name>`` is + provided: + + - All required population details are assumed to have been provided directly + in the call to ``FetchContent_Populate()``. Any saved details for + ``<name>`` are ignored. + - No check is made for whether content for ``<name>`` has already been + populated. + - No global property is set to record that the population has occurred. + - No global properties record the source or binary directories used for the + populated content. + - The ``FETCHCONTENT_FULLY_DISCONNECTED`` and + ``FETCHCONTENT_UPDATES_DISCONNECTED`` cache variables are ignored. + + The ``<lcName>_SOURCE_DIR`` and ``<lcName>_BINARY_DIR`` variables are still + returned to the caller, but since these locations are not stored as global + properties when this form is used, they are only available to the calling + scope and below rather than the entire project hierarchy. No + ``<lcName>_POPULATED`` variable is set in the caller's scope with this form. + + The supported options for ``FetchContent_Populate()`` are the same as those + for :command:`FetchContent_Declare()`. Those few options shown just + above are either specific to ``FetchContent_Populate()`` or their behavior is + slightly modified from how :command:`ExternalProject_Add` treats them. + + ``QUIET`` + The ``QUIET`` option can be given to hide the output associated with + populating the specified content. If the population fails, the output will + be shown regardless of whether this option was given or not so that the + cause of the failure can be diagnosed. The global ``FETCHCONTENT_QUIET`` + cache variable has no effect on ``FetchContent_Populate()`` calls where the + content details are provided directly. + + ``SUBBUILD_DIR`` + The ``SUBBUILD_DIR`` argument can be provided to change the location of the + sub-build created to perform the population. The default value is + ``${CMAKE_CURRENT_BINARY_DIR}/<lcName>-subbuild`` and it would be unusual + to need to override this default. If a relative path is specified, it will + be interpreted as relative to :variable:`CMAKE_CURRENT_BINARY_DIR`. + + ``SOURCE_DIR``, ``BINARY_DIR`` + The ``SOURCE_DIR`` and ``BINARY_DIR`` arguments are supported by + :command:`ExternalProject_Add`, but different default values are used by + ``FetchContent_Populate()``. ``SOURCE_DIR`` defaults to + ``${CMAKE_CURRENT_BINARY_DIR}/<lcName>-src`` and ``BINARY_DIR`` defaults to + ``${CMAKE_CURRENT_BINARY_DIR}/<lcName>-build``. If a relative path is + specified, it will be interpreted as relative to + :variable:`CMAKE_CURRENT_BINARY_DIR`. + + In addition to the above explicit options, any other unrecognized options are + passed through unmodified to :command:`ExternalProject_Add` to perform the + download, patch and update steps. The following options are explicitly + prohibited (they are disabled by the ``FetchContent_Populate()`` command): + + - ``CONFIGURE_COMMAND`` + - ``BUILD_COMMAND`` + - ``INSTALL_COMMAND`` + - ``TEST_COMMAND`` + + If using ``FetchContent_Populate()`` within CMake's script mode, be aware + that the implementation sets up a sub-build which therefore requires a CMake + generator and build tool to be available. If these cannot be found by + default, then the :variable:`CMAKE_GENERATOR` and/or + :variable:`CMAKE_MAKE_PROGRAM` variables will need to be set appropriately + on the command line invoking the script. + + +Retrieve Population Properties +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. command:: FetchContent_GetProperties + + When using saved content details, a call to :command:`FetchContent_Populate` + records information in global properties which can be queried at any time. + This information includes the source and binary directories associated with + the content and also whether or not the content population has been processed + during the current configure run. + + .. code-block:: cmake + + FetchContent_GetProperties( <name> + [SOURCE_DIR <srcDirVar>] + [BINARY_DIR <binDirVar>] + [POPULATED <doneVar>] + ) + + The ``SOURCE_DIR``, ``BINARY_DIR`` and ``POPULATED`` options can be used to + specify which properties should be retrieved. Each option accepts a value + which is the name of the variable in which to store that property. Most of + the time though, only ``<name>`` is given, in which case the call will then + set the same variables as a call to + :command:`FetchContent_Populate(name) <FetchContent_Populate>`. This allows + the following canonical pattern to be used, which ensures that the relevant + variables will always be defined regardless of whether or not the population + has been performed elsewhere in the project already: + + .. code-block:: cmake + + FetchContent_GetProperties(foobar) + if(NOT foobar_POPULATED) + FetchContent_Populate(foobar) + + # Set any custom variables, etc. here, then + # populate the content as part of this build + + add_subdirectory(${foobar_SOURCE_DIR} ${foobar_BINARY_DIR}) + endif() + + The above pattern allows other parts of the overall project hierarchy to + re-use the same content and ensure that it is only populated once. + + +.. _`fetch-content-examples`: + +Examples +^^^^^^^^ + +Consider a project hierarchy where ``projA`` is the top level project and it +depends on projects ``projB`` and ``projC``. Both ``projB`` and ``projC`` +can be built standalone and they also both depend on another project +``projD``. For simplicity, this example will assume that all four projects +are available on a company git server. The ``CMakeLists.txt`` of each project +might have sections like the following: + +*projA*: + +.. code-block:: cmake + + include(FetchContent) + FetchContent_Declare( + projB + GIT_REPOSITORY git@mycompany.com/git/projB.git + GIT_TAG 4a89dc7e24ff212a7b5167bef7ab079d + ) + FetchContent_Declare( + projC + GIT_REPOSITORY git@mycompany.com/git/projC.git + GIT_TAG 4ad4016bd1d8d5412d135cf8ceea1bb9 + ) + FetchContent_Declare( + projD + GIT_REPOSITORY git@mycompany.com/git/projD.git + GIT_TAG origin/integrationBranch + ) + + FetchContent_GetProperties(projB) + if(NOT projb_POPULATED) + FetchContent_Populate(projB) + add_subdirectory(${projb_SOURCE_DIR} ${projb_BINARY_DIR}) + endif() + + FetchContent_GetProperties(projC) + if(NOT projc_POPULATED) + FetchContent_Populate(projC) + add_subdirectory(${projc_SOURCE_DIR} ${projc_BINARY_DIR}) + endif() + +*projB*: + +.. code-block:: cmake + + include(FetchContent) + FetchContent_Declare( + projD + GIT_REPOSITORY git@mycompany.com/git/projD.git + GIT_TAG 20b415f9034bbd2a2e8216e9a5c9e632 + ) + + FetchContent_GetProperties(projD) + if(NOT projd_POPULATED) + FetchContent_Populate(projD) + add_subdirectory(${projd_SOURCE_DIR} ${projd_BINARY_DIR}) + endif() + + +*projC*: + +.. code-block:: cmake + + include(FetchContent) + FetchContent_Declare( + projD + GIT_REPOSITORY git@mycompany.com/git/projD.git + GIT_TAG 7d9a17ad2c962aa13e2fbb8043fb6b8a + ) + + FetchContent_GetProperties(projD) + if(NOT projd_POPULATED) + FetchContent_Populate(projD) + add_subdirectory(${projd_SOURCE_DIR} ${projd_BINARY_DIR}) + endif() + +A few key points should be noted in the above: + +- ``projB`` and ``projC`` define different content details for ``projD``, + but ``projA`` also defines a set of content details for ``projD`` and + because ``projA`` will define them first, the details from ``projB`` and + ``projC`` will not be used. The override details defined by ``projA`` + are not required to match either of those from ``projB`` or ``projC``, but + it is up to the higher level project to ensure that the details it does + define still make sense for the child projects. +- While ``projA`` defined content details for ``projD``, it did not need + to explicitly call ``FetchContent_Populate(projD)`` itself. Instead, it + leaves that to a child project to do (in this case it will be ``projB`` + since it is added to the build ahead of ``projC``). If ``projA`` needed to + customize how the ``projD`` content was brought into the build as well + (e.g. define some CMake variables before calling + :command:`add_subdirectory` after populating), it would do the call to + ``FetchContent_Populate()``, etc. just as it did for the ``projB`` and + ``projC`` content. For higher level projects, it is usually enough to + just define the override content details and leave the actual population + to the child projects. This saves repeating the same thing at each level + of the project hierarchy unnecessarily. +- Even though ``projA`` is the top level project in this example, it still + checks whether ``projB`` and ``projC`` have already been populated before + going ahead to do those populations. This makes ``projA`` able to be more + easily incorporated as a child of some other higher level project in the + future if required. Always protect a call to + :command:`FetchContent_Populate` with a check to + :command:`FetchContent_GetProperties`, even in what may be considered a top + level project at the time. + + +The following example demonstrates how one might download and unpack a +firmware tarball using CMake's :manual:`script mode <cmake(1)>`. The call to +:command:`FetchContent_Populate` specifies all the content details and the +unpacked firmware will be placed in a ``firmware`` directory below the +current working directory. + +*getFirmware.cmake*: + +.. code-block:: cmake + + # NOTE: Intended to be run in script mode with cmake -P + include(FetchContent) + FetchContent_Populate( + firmware + URL https://mycompany.com/assets/firmware-1.23-arm.tar.gz + URL_HASH MD5=68247684da89b608d466253762b0ff11 + SOURCE_DIR firmware + ) + +#]=======================================================================] + + +set(__FetchContent_privateDir "${CMAKE_CURRENT_LIST_DIR}/FetchContent") + +#======================================================================= +# Recording and retrieving content details for later population +#======================================================================= + +# Internal use, projects must not call this directly. It is +# intended for use by FetchContent_Declare() only. +# +# Sets a content-specific global property (not meant for use +# outside of functions defined here in this file) which can later +# be retrieved using __FetchContent_getSavedDetails() with just the +# same content name. If there is already a value stored in the +# property, it is left unchanged and this call has no effect. +# This allows parent projects to define the content details, +# overriding anything a child project may try to set (properties +# are not cached between runs, so the first thing to set it in a +# build will be in control). +function(__FetchContent_declareDetails contentName) + + string(TOLOWER ${contentName} contentNameLower) + set(propertyName "_FetchContent_${contentNameLower}_savedDetails") + get_property(alreadyDefined GLOBAL PROPERTY ${propertyName} DEFINED) + if(NOT alreadyDefined) + define_property(GLOBAL PROPERTY ${propertyName} + BRIEF_DOCS "Internal implementation detail of FetchContent_Populate()" + FULL_DOCS "Details used by FetchContent_Populate() for ${contentName}" + ) + set_property(GLOBAL PROPERTY ${propertyName} ${ARGN}) + endif() + +endfunction() + + +# Internal use, projects must not call this directly. It is +# intended for use by the FetchContent_Declare() function. +# +# Retrieves details saved for the specified content in an +# earlier call to __FetchContent_declareDetails(). +function(__FetchContent_getSavedDetails contentName outVar) + + string(TOLOWER ${contentName} contentNameLower) + set(propertyName "_FetchContent_${contentNameLower}_savedDetails") + get_property(alreadyDefined GLOBAL PROPERTY ${propertyName} DEFINED) + if(NOT alreadyDefined) + message(FATAL_ERROR "No content details recorded for ${contentName}") + endif() + get_property(propertyValue GLOBAL PROPERTY ${propertyName}) + set(${outVar} "${propertyValue}" PARENT_SCOPE) + +endfunction() + + +# Saves population details of the content, sets defaults for the +# SOURCE_DIR and BUILD_DIR. +function(FetchContent_Declare contentName) + + set(options "") + set(oneValueArgs SVN_REPOSITORY) + set(multiValueArgs "") + + cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + unset(srcDirSuffix) + unset(svnRepoArgs) + if(ARG_SVN_REPOSITORY) + # Add a hash of the svn repository URL to the source dir. This works + # around the problem where if the URL changes, the download would + # fail because it tries to checkout/update rather than switch the + # old URL to the new one. We limit the hash to the first 7 characters + # so that the source path doesn't get overly long (which can be a + # problem on windows due to path length limits). + string(SHA1 urlSHA ${ARG_SVN_REPOSITORY}) + string(SUBSTRING ${urlSHA} 0 7 urlSHA) + set(srcDirSuffix "-${urlSHA}") + set(svnRepoArgs SVN_REPOSITORY ${ARG_SVN_REPOSITORY}) + endif() + + string(TOLOWER ${contentName} contentNameLower) + __FetchContent_declareDetails( + ${contentNameLower} + SOURCE_DIR "${FETCHCONTENT_BASE_DIR}/${contentNameLower}-src${srcDirSuffix}" + BINARY_DIR "${FETCHCONTENT_BASE_DIR}/${contentNameLower}-build" + ${svnRepoArgs} + # List these last so they can override things we set above + ${ARG_UNPARSED_ARGUMENTS} + ) + +endfunction() + + +#======================================================================= +# Set/get whether the specified content has been populated yet. +# The setter also records the source and binary dirs used. +#======================================================================= + +# Internal use, projects must not call this directly. It is +# intended for use by the FetchContent_Populate() function to +# record when FetchContent_Populate() is called for a particular +# content name. +function(__FetchContent_setPopulated contentName sourceDir binaryDir) + + string(TOLOWER ${contentName} contentNameLower) + set(prefix "_FetchContent_${contentNameLower}") + + set(propertyName "${prefix}_sourceDir") + define_property(GLOBAL PROPERTY ${propertyName} + BRIEF_DOCS "Internal implementation detail of FetchContent_Populate()" + FULL_DOCS "Details used by FetchContent_Populate() for ${contentName}" + ) + set_property(GLOBAL PROPERTY ${propertyName} ${sourceDir}) + + set(propertyName "${prefix}_binaryDir") + define_property(GLOBAL PROPERTY ${propertyName} + BRIEF_DOCS "Internal implementation detail of FetchContent_Populate()" + FULL_DOCS "Details used by FetchContent_Populate() for ${contentName}" + ) + set_property(GLOBAL PROPERTY ${propertyName} ${binaryDir}) + + set(propertyName "${prefix}_populated") + define_property(GLOBAL PROPERTY ${propertyName} + BRIEF_DOCS "Internal implementation detail of FetchContent_Populate()" + FULL_DOCS "Details used by FetchContent_Populate() for ${contentName}" + ) + set_property(GLOBAL PROPERTY ${propertyName} True) + +endfunction() + + +# Set variables in the calling scope for any of the retrievable +# properties. If no specific properties are requested, variables +# will be set for all retrievable properties. +# +# This function is intended to also be used by projects as the canonical +# way to detect whether they should call FetchContent_Populate() +# and pull the populated source into the build with add_subdirectory(), +# if they are using the populated content in that way. +function(FetchContent_GetProperties contentName) + + string(TOLOWER ${contentName} contentNameLower) + + set(options "") + set(oneValueArgs SOURCE_DIR BINARY_DIR POPULATED) + set(multiValueArgs "") + + cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + if(NOT ARG_SOURCE_DIR AND + NOT ARG_BINARY_DIR AND + NOT ARG_POPULATED) + # No specific properties requested, provide them all + set(ARG_SOURCE_DIR ${contentNameLower}_SOURCE_DIR) + set(ARG_BINARY_DIR ${contentNameLower}_BINARY_DIR) + set(ARG_POPULATED ${contentNameLower}_POPULATED) + endif() + + set(prefix "_FetchContent_${contentNameLower}") + + if(ARG_SOURCE_DIR) + set(propertyName "${prefix}_sourceDir") + get_property(value GLOBAL PROPERTY ${propertyName}) + if(value) + set(${ARG_SOURCE_DIR} ${value} PARENT_SCOPE) + endif() + endif() + + if(ARG_BINARY_DIR) + set(propertyName "${prefix}_binaryDir") + get_property(value GLOBAL PROPERTY ${propertyName}) + if(value) + set(${ARG_BINARY_DIR} ${value} PARENT_SCOPE) + endif() + endif() + + if(ARG_POPULATED) + set(propertyName "${prefix}_populated") + get_property(value GLOBAL PROPERTY ${propertyName} DEFINED) + set(${ARG_POPULATED} ${value} PARENT_SCOPE) + endif() + +endfunction() + + +#======================================================================= +# Performing the population +#======================================================================= + +# The value of contentName will always have been lowercased by the caller. +# All other arguments are assumed to be options that are understood by +# ExternalProject_Add(), except for QUIET and SUBBUILD_DIR. +function(__FetchContent_directPopulate contentName) + + set(options + QUIET + ) + set(oneValueArgs + SUBBUILD_DIR + SOURCE_DIR + BINARY_DIR + # Prevent the following from being passed through + CONFIGURE_COMMAND + BUILD_COMMAND + INSTALL_COMMAND + TEST_COMMAND + ) + set(multiValueArgs "") + + cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + if(NOT ARG_SUBBUILD_DIR) + message(FATAL_ERROR "Internal error: SUBBUILD_DIR not set") + elseif(NOT IS_ABSOLUTE "${ARG_SUBBUILD_DIR}") + set(ARG_SUBBUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/${ARG_SUBBUILD_DIR}") + endif() + + if(NOT ARG_SOURCE_DIR) + message(FATAL_ERROR "Internal error: SOURCE_DIR not set") + elseif(NOT IS_ABSOLUTE "${ARG_SOURCE_DIR}") + set(ARG_SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/${ARG_SOURCE_DIR}") + endif() + + if(NOT ARG_BINARY_DIR) + message(FATAL_ERROR "Internal error: BINARY_DIR not set") + elseif(NOT IS_ABSOLUTE "${ARG_BINARY_DIR}") + set(ARG_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/${ARG_BINARY_DIR}") + endif() + + # Ensure the caller can know where to find the source and build directories + # with some convenient variables. Doing this here ensures the caller sees + # the correct result in the case where the default values are overridden by + # the content details set by the project. + set(${contentName}_SOURCE_DIR "${ARG_SOURCE_DIR}" PARENT_SCOPE) + set(${contentName}_BINARY_DIR "${ARG_BINARY_DIR}" PARENT_SCOPE) + + # The unparsed arguments may contain spaces, so build up ARG_EXTRA + # in such a way that it correctly substitutes into the generated + # CMakeLists.txt file with each argument quoted. + unset(ARG_EXTRA) + foreach(arg IN LISTS ARG_UNPARSED_ARGUMENTS) + set(ARG_EXTRA "${ARG_EXTRA} \"${arg}\"") + endforeach() + + # Hide output if requested, but save it to a variable in case there's an + # error so we can show the output upon failure. When not quiet, don't + # capture the output to a variable because the user may want to see the + # output as it happens (e.g. progress during long downloads). Combine both + # stdout and stderr in the one capture variable so the output stays in order. + if (ARG_QUIET) + set(outputOptions + OUTPUT_VARIABLE capturedOutput + ERROR_VARIABLE capturedOutput + ) + else() + set(capturedOutput) + set(outputOptions) + message(STATUS "Populating ${contentName}") + endif() + + if(CMAKE_GENERATOR) + set(generatorOpts "-G${CMAKE_GENERATOR}") + if(CMAKE_GENERATOR_PLATFORM) + list(APPEND generatorOpts "-A${CMAKE_GENERATOR_PLATFORM}") + endif() + if(CMAKE_GENERATOR_TOOLSET) + list(APPEND generatorOpts "-T${CMAKE_GENERATOR_TOOLSET}") + endif() + + if(CMAKE_MAKE_PROGRAM) + list(APPEND generatorOpts "-DCMAKE_MAKE_PROGRAM:FILEPATH=${CMAKE_MAKE_PROGRAM}") + endif() + + else() + # Likely we've been invoked via CMake's script mode where no + # generator is set (and hence CMAKE_MAKE_PROGRAM could not be + # trusted even if provided). We will have to rely on being + # able to find the default generator and build tool. + unset(generatorOpts) + endif() + + # Create and build a separate CMake project to carry out the population. + # If we've already previously done these steps, they will not cause + # anything to be updated, so extra rebuilds of the project won't occur. + # Make sure to pass through CMAKE_MAKE_PROGRAM in case the main project + # has this set to something not findable on the PATH. + configure_file("${__FetchContent_privateDir}/CMakeLists.cmake.in" + "${ARG_SUBBUILD_DIR}/CMakeLists.txt") + execute_process( + COMMAND ${CMAKE_COMMAND} ${generatorOpts} . + RESULT_VARIABLE result + ${outputOptions} + WORKING_DIRECTORY "${ARG_SUBBUILD_DIR}" + ) + if(result) + if(capturedOutput) + message("${capturedOutput}") + endif() + message(FATAL_ERROR "CMake step for ${contentName} failed: ${result}") + endif() + execute_process( + COMMAND ${CMAKE_COMMAND} --build . + RESULT_VARIABLE result + ${outputOptions} + WORKING_DIRECTORY "${ARG_SUBBUILD_DIR}" + ) + if(result) + if(capturedOutput) + message("${capturedOutput}") + endif() + message(FATAL_ERROR "Build step for ${contentName} failed: ${result}") + endif() + +endfunction() + + +option(FETCHCONTENT_FULLY_DISCONNECTED "Disables all attempts to download or update content and assumes source dirs already exist") +option(FETCHCONTENT_UPDATES_DISCONNECTED "Enables UPDATE_DISCONNECTED behavior for all content population") +option(FETCHCONTENT_QUIET "Enables QUIET option for all content population" ON) +set(FETCHCONTENT_BASE_DIR "${CMAKE_BINARY_DIR}/_deps" CACHE PATH "Directory under which to collect all populated content") + +# Populate the specified content using details stored from +# an earlier call to FetchContent_Declare(). +function(FetchContent_Populate contentName) + + if(NOT contentName) + message(FATAL_ERROR "Empty contentName not allowed for FetchContent_Populate()") + endif() + + string(TOLOWER ${contentName} contentNameLower) + + if(ARGN) + # This is the direct population form with details fully specified + # as part of the call, so we already have everything we need + __FetchContent_directPopulate( + ${contentNameLower} + SUBBUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/${contentNameLower}-subbuild" + SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/${contentNameLower}-src" + BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/${contentNameLower}-build" + ${ARGN} # Could override any of the above ..._DIR variables + ) + + # Pass source and binary dir variables back to the caller + set(${contentNameLower}_SOURCE_DIR "${${contentNameLower}_SOURCE_DIR}" PARENT_SCOPE) + set(${contentNameLower}_BINARY_DIR "${${contentNameLower}_BINARY_DIR}" PARENT_SCOPE) + + # Don't set global properties, or record that we did this population, since + # this was a direct call outside of the normal declared details form. + # We only want to save values in the global properties for content that + # honours the hierarchical details mechanism so that projects are not + # robbed of the ability to override details set in nested projects. + return() + endif() + + # No details provided, so assume they were saved from an earlier call + # to FetchContent_Declare(). Do a check that we haven't already + # populated this content before in case the caller forgot to check. + FetchContent_GetProperties(${contentName}) + if(${contentNameLower}_POPULATED) + message(FATAL_ERROR "Content ${contentName} already populated in ${${contentNameLower}_SOURCE_DIR}") + endif() + + string(TOUPPER ${contentName} contentNameUpper) + set(FETCHCONTENT_SOURCE_DIR_${contentNameUpper} + "${FETCHCONTENT_SOURCE_DIR_${contentNameUpper}}" + CACHE PATH "When not empty, overrides where to find pre-populated content for ${contentName}") + + if(FETCHCONTENT_SOURCE_DIR_${contentNameUpper}) + # The source directory has been explicitly provided in the cache, + # so no population is required + set(${contentNameLower}_SOURCE_DIR "${FETCHCONTENT_SOURCE_DIR_${contentNameUpper}}") + set(${contentNameLower}_BINARY_DIR "${FETCHCONTENT_BASE_DIR}/${contentNameLower}-build") + + elseif(FETCHCONTENT_FULLY_DISCONNECTED) + # Bypass population and assume source is already there from a previous run + set(${contentNameLower}_SOURCE_DIR "${FETCHCONTENT_BASE_DIR}/${contentNameLower}-src") + set(${contentNameLower}_BINARY_DIR "${FETCHCONTENT_BASE_DIR}/${contentNameLower}-build") + + else() + # Support both a global "disconnect all updates" and a per-content + # update test (either one being set disables updates for this content). + option(FETCHCONTENT_UPDATES_DISCONNECTED_${contentNameUpper} + "Enables UPDATE_DISCONNECTED behavior just for population of ${contentName}") + if(FETCHCONTENT_UPDATES_DISCONNECTED OR + FETCHCONTENT_UPDATES_DISCONNECTED_${contentNameUpper}) + set(disconnectUpdates True) + else() + set(disconnectUpdates False) + endif() + + if(FETCHCONTENT_QUIET) + set(quietFlag QUIET) + else() + unset(quietFlag) + endif() + + __FetchContent_getSavedDetails(${contentName} contentDetails) + if("${contentDetails}" STREQUAL "") + message(FATAL_ERROR "No details have been set for content: ${contentName}") + endif() + + __FetchContent_directPopulate( + ${contentNameLower} + ${quietFlag} + UPDATE_DISCONNECTED ${disconnectUpdates} + SUBBUILD_DIR "${FETCHCONTENT_BASE_DIR}/${contentNameLower}-subbuild" + SOURCE_DIR "${FETCHCONTENT_BASE_DIR}/${contentNameLower}-src" + BINARY_DIR "${FETCHCONTENT_BASE_DIR}/${contentNameLower}-build" + # Put the saved details last so they can override any of the + # the options we set above (this can include SOURCE_DIR or + # BUILD_DIR) + ${contentDetails} + ) + endif() + + __FetchContent_setPopulated( + ${contentName} + ${${contentNameLower}_SOURCE_DIR} + ${${contentNameLower}_BINARY_DIR} + ) + + # Pass variables back to the caller. The variables passed back here + # must match what FetchContent_GetProperties() sets when it is called + # with just the content name. + set(${contentNameLower}_SOURCE_DIR "${${contentNameLower}_SOURCE_DIR}" PARENT_SCOPE) + set(${contentNameLower}_BINARY_DIR "${${contentNameLower}_BINARY_DIR}" PARENT_SCOPE) + set(${contentNameLower}_POPULATED True PARENT_SCOPE) + +endfunction() diff --git a/Modules/FetchContent/CMakeLists.cmake.in b/Modules/FetchContent/CMakeLists.cmake.in new file mode 100644 index 0000000..9a7a771 --- /dev/null +++ b/Modules/FetchContent/CMakeLists.cmake.in @@ -0,0 +1,21 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +cmake_minimum_required(VERSION ${CMAKE_VERSION}) + +# We name the project and the target for the ExternalProject_Add() call +# to something that will highlight to the user what we are working on if +# something goes wrong and an error message is produced. + +project(${contentName}-populate NONE) + +include(ExternalProject) +ExternalProject_Add(${contentName}-populate + ${ARG_EXTRA} + SOURCE_DIR "${ARG_SOURCE_DIR}" + BINARY_DIR "${ARG_BINARY_DIR}" + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "" + TEST_COMMAND "" +) diff --git a/Modules/FindAVIFile.cmake b/Modules/FindAVIFile.cmake index 88a2a25..2df29ca 100644 --- a/Modules/FindAVIFile.cmake +++ b/Modules/FindAVIFile.cmake @@ -21,14 +21,8 @@ if (UNIX) - find_path(AVIFILE_INCLUDE_DIR avifile.h - /usr/local/avifile/include - /usr/local/include/avifile - ) - - find_library(AVIFILE_AVIPLAY_LIBRARY aviplay - /usr/local/avifile/lib - ) + find_path(AVIFILE_INCLUDE_DIR avifile.h PATH_SUFFIXES avifile/include include/avifile include/avifile-0.7) + find_library(AVIFILE_AVIPLAY_LIBRARY aviplay aviplay-0.7 PATH_SUFFIXES avifile/lib) endif () diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake index 2684617..bb8b308 100644 --- a/Modules/FindBLAS.cmake +++ b/Modules/FindBLAS.cmake @@ -36,6 +36,7 @@ # # * Goto # * OpenBLAS +# * FLAME # * ATLAS PhiPACK # * CXML # * DXML @@ -190,6 +191,20 @@ if (BLA_VENDOR STREQUAL "OpenBLAS" OR BLA_VENDOR STREQUAL "All") endif() endif () +if (BLA_VENDOR STREQUAL "FLAME" OR BLA_VENDOR STREQUAL "All") + if(NOT BLAS_LIBRARIES) + # FLAME's blis library (https://github.com/flame/blis) + check_fortran_libraries( + BLAS_LIBRARIES + BLAS + sgemm + "" + "blis" + "" + ) + endif() +endif () + if (BLA_VENDOR STREQUAL "ATLAS" OR BLA_VENDOR STREQUAL "All") if(NOT BLAS_LIBRARIES) # BLAS in ATLAS library? (http://math-atlas.sourceforge.net/) diff --git a/Modules/FindBZip2.cmake b/Modules/FindBZip2.cmake index d2307f1..0375b09 100644 --- a/Modules/FindBZip2.cmake +++ b/Modules/FindBZip2.cmake @@ -38,6 +38,8 @@ if (NOT BZIP2_LIBRARIES) include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake) SELECT_LIBRARY_CONFIGURATIONS(BZIP2) +else () + file(TO_CMAKE_PATH "${BZIP2_LIBRARIES}" BZIP2_LIBRARIES) endif () if (BZIP2_INCLUDE_DIR AND EXISTS "${BZIP2_INCLUDE_DIR}/bzlib.h") diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 88d14ab..0786248 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -391,13 +391,8 @@ endmacro() # version with a regex. # function(_Boost_COMPILER_DUMPVERSION _OUTPUT_VERSION) - - exec_program(${CMAKE_CXX_COMPILER} - ARGS ${CMAKE_CXX_COMPILER_ARG1} -dumpversion - OUTPUT_VARIABLE _boost_COMPILER_VERSION - ) - string(REGEX REPLACE "([0-9])\\.([0-9])(\\.[0-9])?" "\\1\\2" - _boost_COMPILER_VERSION ${_boost_COMPILER_VERSION}) + string(REGEX REPLACE "([0-9]+)\\.([0-9]+)(\\.[0-9]+)?" "\\1\\2" + _boost_COMPILER_VERSION ${CMAKE_CXX_COMPILER_VERSION}) set(${_OUTPUT_VERSION} ${_boost_COMPILER_VERSION} PARENT_SCOPE) endfunction() @@ -434,9 +429,7 @@ endfunction() # Guesses Boost's compiler prefix used in built library names # Returns the guess by setting the variable pointed to by _ret function(_Boost_GUESS_COMPILER_PREFIX _ret) - if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel" - OR CMAKE_CXX_COMPILER MATCHES "icl" - OR CMAKE_CXX_COMPILER MATCHES "icpc") + if("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xIntel") if(WIN32) set (_boost_COMPILER "-iw") else() @@ -1400,8 +1393,8 @@ endif() # support libraries if(WIN32 AND Boost_USE_DEBUG_RUNTIME) if("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC" - OR "${CMAKE_CXX_COMPILER}" MATCHES "icl" - OR "${CMAKE_CXX_COMPILER}" MATCHES "icpc") + OR "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xClang" + OR "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xIntel") string(APPEND _boost_DEBUG_ABI_TAG "g") endif() endif() diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index 1c8ac26..04b5cf9 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -18,35 +18,36 @@ # # Tools for building CUDA C files: libraries and build dependencies. # -# This script locates the NVIDIA CUDA C tools. It should work on linux, -# windows, and mac and should be reasonably up to date with CUDA C +# This script locates the NVIDIA CUDA C tools. It should work on Linux, +# Windows, and macOS and should be reasonably up to date with CUDA C # releases. # -# This script makes use of the standard find_package arguments of -# <VERSION>, REQUIRED and QUIET. CUDA_FOUND will report if an +# This script makes use of the standard :command:`find_package` arguments of +# ``<VERSION>``, ``REQUIRED`` and ``QUIET``. ``CUDA_FOUND`` will report if an # acceptable version of CUDA was found. # -# The script will prompt the user to specify CUDA_TOOLKIT_ROOT_DIR if +# The script will prompt the user to specify ``CUDA_TOOLKIT_ROOT_DIR`` if # the prefix cannot be determined by the location of nvcc in the system -# path and REQUIRED is specified to find_package(). To use a different -# installed version of the toolkit set the environment variable -# CUDA_BIN_PATH before running cmake (e.g. -# CUDA_BIN_PATH=/usr/local/cuda1.0 instead of the default -# /usr/local/cuda) or set CUDA_TOOLKIT_ROOT_DIR after configuring. If -# you change the value of CUDA_TOOLKIT_ROOT_DIR, various components that +# path and ``REQUIRED`` is specified to :command:`find_package`. To use +# a different installed version of the toolkit set the environment variable +# ``CUDA_BIN_PATH`` before running cmake (e.g. +# ``CUDA_BIN_PATH=/usr/local/cuda1.0`` instead of the default +# ``/usr/local/cuda``) or set ``CUDA_TOOLKIT_ROOT_DIR`` after configuring. If +# you change the value of ``CUDA_TOOLKIT_ROOT_DIR``, various components that # depend on the path will be relocated. # -# It might be necessary to set CUDA_TOOLKIT_ROOT_DIR manually on certain -# platforms, or to use a cuda runtime not installed in the default -# location. In newer versions of the toolkit the cuda library is -# included with the graphics driver- be sure that the driver version -# matches what is needed by the cuda runtime version. +# It might be necessary to set ``CUDA_TOOLKIT_ROOT_DIR`` manually on certain +# platforms, or to use a CUDA runtime not installed in the default +# location. In newer versions of the toolkit the CUDA library is +# included with the graphics driver -- be sure that the driver version +# matches what is needed by the CUDA runtime version. # # The following variables affect the behavior of the macros in the # script (in alphebetical order). Note that any of these flags can be # changed multiple times in the same directory before calling -# CUDA_ADD_EXECUTABLE, CUDA_ADD_LIBRARY, CUDA_COMPILE, CUDA_COMPILE_PTX, -# CUDA_COMPILE_FATBIN, CUDA_COMPILE_CUBIN or CUDA_WRAP_SRCS:: +# ``CUDA_ADD_EXECUTABLE``, ``CUDA_ADD_LIBRARY``, ``CUDA_COMPILE``, +# ``CUDA_COMPILE_PTX``, ``CUDA_COMPILE_FATBIN``, ``CUDA_COMPILE_CUBIN`` +# or ``CUDA_WRAP_SRCS``:: # # CUDA_64_BIT_DEVICE_CODE (Default matches host bit size) # -- Set to ON to compile for 64 bit device code, OFF for 32 bit device code. @@ -580,7 +581,7 @@ mark_as_advanced( # Makefile and similar generators don't define CMAKE_CONFIGURATION_TYPES, so we # need to add another entry for the CMAKE_BUILD_TYPE. We also need to add the # standerd set of 4 build types (Debug, MinSizeRel, Release, and RelWithDebInfo) -# for completeness. We need run this loop in order to accomodate the addition +# for completeness. We need run this loop in order to accommodate the addition # of extra configuration types. Duplicate entries will be removed by # REMOVE_DUPLICATES. set(CUDA_configuration_types ${CMAKE_CONFIGURATION_TYPES} ${CMAKE_BUILD_TYPE} Debug MinSizeRel Release RelWithDebInfo) @@ -665,8 +666,7 @@ if(NOT CUDA_TOOLKIT_ROOT_DIR AND NOT CMAKE_CROSSCOMPILING) find_path(CUDA_TOOLKIT_ROOT_DIR NAMES nvcc nvcc.exe PATHS /opt/cuda/bin - /usr/local/bin - /usr/local/cuda/bin + PATH_SUFFIXES cuda/bin DOC "Toolkit location." ) @@ -1755,7 +1755,7 @@ function(CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS output_file cuda_target options add_custom_command( OUTPUT ${output_file} DEPENDS ${object_files} - COMMAND ${CUDA_NVCC_EXECUTABLE} ${nvcc_flags} -dlink ${object_files} -o ${output_file} + COMMAND ${CUDA_NVCC_EXECUTABLE} ${nvcc_flags} -dlink ${object_files} ${CUDA_cublas_device_LIBRARY} -o ${output_file} ${flags} COMMENT "Building NVCC intermediate link file ${output_file_relative_path}" COMMAND_EXPAND_LISTS @@ -1768,7 +1768,7 @@ function(CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS output_file cuda_target options PRE_LINK COMMAND ${CMAKE_COMMAND} -E echo "Building NVCC intermediate link file ${output_file_relative_path}" COMMAND ${CMAKE_COMMAND} -E make_directory "${output_file_dir}" - COMMAND ${CUDA_NVCC_EXECUTABLE} ${nvcc_flags} ${flags} -dlink ${object_files} -o "${output_file}" + COMMAND ${CUDA_NVCC_EXECUTABLE} ${nvcc_flags} ${flags} -dlink ${object_files} ${CUDA_cublas_device_LIBRARY} -o "${output_file}" COMMAND_EXPAND_LISTS ${_verbatim} ) diff --git a/Modules/FindCUDA/run_nvcc.cmake b/Modules/FindCUDA/run_nvcc.cmake index f78119d..86051cf 100644 --- a/Modules/FindCUDA/run_nvcc.cmake +++ b/Modules/FindCUDA/run_nvcc.cmake @@ -181,7 +181,7 @@ cuda_execute_process( set(depends_CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS}") set(CUDA_VERSION @CUDA_VERSION@) if(CUDA_VERSION VERSION_LESS "3.0") - # Note that this will remove all occurances of -G. + # Note that this will remove all occurrences of -G. list(REMOVE_ITEM depends_CUDA_NVCC_FLAGS "-G") endif() diff --git a/Modules/FindCxxTest.cmake b/Modules/FindCxxTest.cmake index 9ba1ff3..2aa5f6f 100644 --- a/Modules/FindCxxTest.cmake +++ b/Modules/FindCxxTest.cmake @@ -145,7 +145,7 @@ # # Version 1.3 (8/19/10) (CMake 2.8.3) # Included patch by Simone Rossetto to check if either Python or Perl -# are present in the system. Whichever intepreter that is detected +# are present in the system. Whichever interpreter that is detected # is now used to run the test generator program. If both interpreters # are detected, the CXXTEST_USE_PYTHON variable is obeyed. # diff --git a/Modules/FindDCMTK.cmake b/Modules/FindDCMTK.cmake index 0d86e8e..f348d3a 100644 --- a/Modules/FindDCMTK.cmake +++ b/Modules/FindDCMTK.cmake @@ -217,7 +217,7 @@ if(EXISTS ${DCMTK_DIR}/CMakeCache.txt) if(NOT EXISTS ${EXTDCMTK_SOURCE_DIR}) message(FATAL_ERROR "DCMTK build directory references -nonexistant DCMTK source directory ${EXTDCMTK_SOURCE_DIR}") +nonexistent DCMTK source directory ${EXTDCMTK_SOURCE_DIR}") endif() endif() diff --git a/Modules/FindDevIL.cmake b/Modules/FindDevIL.cmake index f6c8e3f..e904a30 100644 --- a/Modules/FindDevIL.cmake +++ b/Modules/FindDevIL.cmake @@ -70,5 +70,5 @@ find_library(ILU_LIBRARIES FIND_PACKAGE_HANDLE_STANDARD_ARGS(DevIL DEFAULT_MSG IL_LIBRARIES ILU_LIBRARIES IL_INCLUDE_DIR) -# provide legacy variable for compatiblity +# provide legacy variable for compatibility set(IL_FOUND ${DevIL_FOUND}) diff --git a/Modules/FindFLEX.cmake b/Modules/FindFLEX.cmake index fef7fb4..3945b78 100644 --- a/Modules/FindFLEX.cmake +++ b/Modules/FindFLEX.cmake @@ -52,7 +52,7 @@ # # # -# Flex scanners oftenly use tokens defined by Bison: the code generated +# Flex scanners often use tokens defined by Bison: the code generated # by Flex depends of the header generated by Bison. This module also # defines a macro: # diff --git a/Modules/FindFLTK.cmake b/Modules/FindFLTK.cmake index e6bd3c9..1aa52cc 100644 --- a/Modules/FindFLTK.cmake +++ b/Modules/FindFLTK.cmake @@ -114,12 +114,11 @@ if(NOT FLTK_DIR) # Look in places relative to the system executable search path. ${FLTK_DIR_SEARCH} - PATHS - # Look in standard UNIX install locations. - /usr/local/lib/fltk - /usr/lib/fltk - /usr/local/fltk - /usr/X11R6/include + PATH_SUFFIXES + fltk + fltk/include + lib/fltk + lib/fltk/include # Help the user find it if we cannot. DOC "The ${FLTK_DIR_STRING}" @@ -216,14 +215,11 @@ endif() endif() endif() - set(FLTK_INCLUDE_SEARCH_PATH ${FLTK_INCLUDE_SEARCH_PATH} - /usr/local/fltk - /usr/X11R6/include - ${_FLTK_POSSIBLE_INCLUDE_DIRS} - ) + list(APPEND FLTK_INCLUDE_SEARCH_PATH ${_FLTK_POSSIBLE_INCLUDE_DIRS}) find_path(FLTK_INCLUDE_DIR NAMES FL/Fl.h FL/Fl.H # fltk 1.1.9 has Fl.H (#8376) + PATH_SUFFIXES fltk fltk/include PATHS ${FLTK_INCLUDE_SEARCH_PATH}) # @@ -237,21 +233,16 @@ endif() endif() endif() - set(FLTK_LIBRARY_SEARCH_PATH ${FLTK_LIBRARY_SEARCH_PATH} - /usr/local/fltk/lib - /usr/X11R6/lib - ${FLTK_INCLUDE_DIR}/lib - ${_FLTK_POSSIBLE_LIBRARY_DIR} - ) + list(APPEND FLTK_LIBRARY_SEARCH_PATH ${FLTK_INCLUDE_DIR}/lib ${_FLTK_POSSIBLE_LIBRARY_DIR}) find_library(FLTK_BASE_LIBRARY NAMES fltk fltkd - PATHS ${FLTK_LIBRARY_SEARCH_PATH}) + PATHS ${FLTK_LIBRARY_SEARCH_PATH} PATH_SUFFIXES fltk fltk/lib) find_library(FLTK_GL_LIBRARY NAMES fltkgl fltkgld fltk_gl - PATHS ${FLTK_LIBRARY_SEARCH_PATH}) + PATHS ${FLTK_LIBRARY_SEARCH_PATH} PATH_SUFFIXES fltk fltk/lib) find_library(FLTK_FORMS_LIBRARY NAMES fltkforms fltkformsd fltk_forms - PATHS ${FLTK_LIBRARY_SEARCH_PATH}) + PATHS ${FLTK_LIBRARY_SEARCH_PATH} PATH_SUFFIXES fltk fltk/lib) find_library(FLTK_IMAGES_LIBRARY NAMES fltkimages fltkimagesd fltk_images - PATHS ${FLTK_LIBRARY_SEARCH_PATH}) + PATHS ${FLTK_LIBRARY_SEARCH_PATH} PATH_SUFFIXES fltk fltk/lib) # Find the extra libraries needed for the fltk_images library. if(UNIX) diff --git a/Modules/FindFLTK2.cmake b/Modules/FindFLTK2.cmake index a43e5ff..365a82a 100644 --- a/Modules/FindFLTK2.cmake +++ b/Modules/FindFLTK2.cmake @@ -80,11 +80,11 @@ if(NOT FLTK2_DIR) # Look in places relative to the system executable search path. ${FLTK2_DIR_SEARCH} - # Look in standard UNIX install locations. - /usr/local/lib/fltk2 - /usr/lib/fltk2 - /usr/local/fltk2 - /usr/X11R6/include + PATH_SUFFIXES + fltk2 + fltk2/include + lib/fltk2 + lib/fltk2/include # Help the user find it if we cannot. DOC "The ${FLTK2_DIR_STRING}" @@ -175,25 +175,16 @@ if(FLTK2_DIR) set(FLTK2_WRAP_UI 1) endif() - set(FLTK2_INCLUDE_SEARCH_PATH ${FLTK2_INCLUDE_SEARCH_PATH} - /usr/local/fltk2 - /usr/X11R6/include - ) - - find_path(FLTK2_INCLUDE_DIR fltk/run.h ${FLTK2_INCLUDE_SEARCH_PATH}) + find_path(FLTK2_INCLUDE_DIR fltk/run.h ${FLTK2_INCLUDE_SEARCH_PATH} PATH_SUFFIXES fltk2 fltk2/include) - set(FLTK2_LIBRARY_SEARCH_PATH ${FLTK2_LIBRARY_SEARCH_PATH} - /usr/local/fltk2/lib - /usr/X11R6/lib - ${FLTK2_INCLUDE_DIR}/lib - ) + list(APPEND FLTK2_LIBRARY_SEARCH_PATH ${FLTK2_INCLUDE_DIR}/lib) find_library(FLTK2_BASE_LIBRARY NAMES fltk2 - PATHS ${FLTK2_LIBRARY_SEARCH_PATH}) + PATHS ${FLTK2_LIBRARY_SEARCH_PATH} PATH_SUFFIXES fltk2 fltk2/lib) find_library(FLTK2_GL_LIBRARY NAMES fltk2_gl - PATHS ${FLTK2_LIBRARY_SEARCH_PATH}) + PATHS ${FLTK2_LIBRARY_SEARCH_PATH} PATH_SUFFIXES fltk2 fltk2/lib) find_library(FLTK2_IMAGES_LIBRARY NAMES fltk2_images - PATHS ${FLTK2_LIBRARY_SEARCH_PATH}) + PATHS ${FLTK2_LIBRARY_SEARCH_PATH} PATH_SUFFIXES fltk2 fltk2/lib) # Find the extra libraries needed for the fltk_images library. if(UNIX) diff --git a/Modules/FindFreetype.cmake b/Modules/FindFreetype.cmake index 0e6d336..61643be 100644 --- a/Modules/FindFreetype.cmake +++ b/Modules/FindFreetype.cmake @@ -63,10 +63,6 @@ set(FREETYPE_FIND_ARGS HINTS ENV FREETYPE_DIR PATHS - /usr/X11R6 - /usr/local/X11R6 - /usr/local/X11 - /usr/freeware ENV GTKMM_BASEPATH [HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path] [HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path] @@ -115,6 +111,9 @@ if(NOT FREETYPE_LIBRARY) ) include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake) select_library_configurations(FREETYPE) +else() + # on Windows, ensure paths are in canonical format (forward slahes): + file(TO_CMAKE_PATH "${FREETYPE_LIBRARY}" FREETYPE_LIBRARY) endif() unset(FREETYPE_FIND_ARGS) diff --git a/Modules/FindGDAL.cmake b/Modules/FindGDAL.cmake index 0cce9cb..ceb8eee 100644 --- a/Modules/FindGDAL.cmake +++ b/Modules/FindGDAL.cmake @@ -49,14 +49,6 @@ find_path(GDAL_INCLUDE_DIR gdal.h PATH_SUFFIXES include/gdal include/GDAL - include - PATHS - ~/Library/Frameworks/gdal.framework/Headers - /Library/Frameworks/gdal.framework/Headers - /sw # Fink - /opt/local # DarwinPorts - /opt/csw # Blastwave - /opt ) if(UNIX) @@ -68,12 +60,6 @@ if(UNIX) HINTS ENV GDAL_DIR ENV GDAL_ROOT - PATH_SUFFIXES bin - PATHS - /sw # Fink - /opt/local # DarwinPorts - /opt/csw # Blastwave - /opt ) if(GDAL_CONFIG) @@ -93,13 +79,6 @@ find_library(GDAL_LIBRARY ENV GDAL_DIR ENV GDAL_ROOT ${_gdal_libpath} - PATH_SUFFIXES lib - PATHS - /sw - /opt/local - /opt/csw - /opt - /usr/freeware ) include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) diff --git a/Modules/FindGIF.cmake b/Modules/FindGIF.cmake index 0843d5f..4b2f882 100644 --- a/Modules/FindGIF.cmake +++ b/Modules/FindGIF.cmake @@ -30,10 +30,6 @@ find_path(GIF_INCLUDE_DIR gif_lib.h HINTS ENV GIF_DIR - PATH_SUFFIXES include - PATHS - ~/Library/Frameworks - /usr/freeware ) # the gif library can have many names :-/ @@ -43,10 +39,6 @@ find_library(GIF_LIBRARY NAMES ${POTENTIAL_GIF_LIBS} HINTS ENV GIF_DIR - PATH_SUFFIXES lib - PATHS - ~/Library/Frameworks - /usr/freeware ) # see readme.txt diff --git a/Modules/FindGTK.cmake b/Modules/FindGTK.cmake index 8a89cda..89fb54b 100644 --- a/Modules/FindGTK.cmake +++ b/Modules/FindGTK.cmake @@ -31,20 +31,17 @@ if(UNIX) # - Atanas Georgiev <atanas@cs.columbia.edu> find_path( GTK_glibconfig_INCLUDE_PATH NAMES glibconfig.h + PATH_SUFFIXES glib/include lib/glib/include include/glib12 PATHS /usr/openwin/share/include - /usr/local/include/glib12 - /usr/lib/glib/include - /usr/local/lib/glib/include /opt/gnome/include /opt/gnome/lib/glib/include ) find_path( GTK_glib_INCLUDE_PATH NAMES glib.h - PATH_SUFFIXES gtk-1.2 glib-1.2 glib12 + PATH_SUFFIXES gtk-1.2 glib-1.2 glib12 glib/include lib/glib/include PATHS /usr/openwin/share/include - /usr/lib/glib/include /opt/gnome/include ) diff --git a/Modules/FindGTK2.cmake b/Modules/FindGTK2.cmake index b87b9f3..8d0da51 100644 --- a/Modules/FindGTK2.cmake +++ b/Modules/FindGTK2.cmake @@ -298,8 +298,6 @@ function(_GTK2_FIND_INCLUDE_DIR _var _hdr) /usr/libx32 /usr/lib64 /usr/lib - /usr/X11R6/include - /usr/X11R6/lib /opt/gnome/include /opt/gnome/lib /opt/openwin/include diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake index 3279bf2..41b1002 100644 --- a/Modules/FindHDF5.cmake +++ b/Modules/FindHDF5.cmake @@ -479,7 +479,7 @@ if(NOT HDF5_FOUND AND NOT HDF5_NO_FIND_PACKAGE_CONFIG_FILE) #if we detect that occurrence clear the suffix if(_suffix AND NOT TARGET ${HDF5_${_lang}_TARGET}${_suffix}) if(NOT TARGET ${HDF5_${_lang}_TARGET}) - #cant find this component with or without the suffix + #can't find this component with or without the suffix #so bail out, and let the following locate HDF5 set(HDF5_FOUND FALSE) break() diff --git a/Modules/FindICU.cmake b/Modules/FindICU.cmake index d9705d9..aa531d5 100644 --- a/Modules/FindICU.cmake +++ b/Modules/FindICU.cmake @@ -156,7 +156,7 @@ function(_ICU_FIND) # Find all ICU programs - list(APPEND icu_binary_suffixes "${_bin64}" "bin") + list(APPEND icu_binary_suffixes "${_bin64}" "bin" "sbin") foreach(program ${icu_programs}) string(TOUPPER "${program}" program_upcase) set(cache_var "ICU_${program_upcase}_EXECUTABLE") @@ -172,6 +172,11 @@ function(_ICU_FIND) # Find all ICU libraries list(APPEND icu_library_suffixes "${_lib64}" "lib") set(ICU_REQUIRED_LIBS_FOUND ON) + set(static_prefix ) + # static icu libraries compiled with MSVC have the prefix 's' + if(MSVC) + set(static_prefix "s") + endif() foreach(component ${ICU_FIND_COMPONENTS}) string(TOUPPER "${component}" component_upcase) set(component_cache "ICU_${component_upcase}_LIBRARY") @@ -206,6 +211,20 @@ function(_ICU_FIND) list(APPEND component_debug_libnames "icui18nd") endif() + if(static_prefix) + unset(static_component_libnames) + unset(static_component_debug_libnames) + foreach(component_libname ${component_libnames}) + list(APPEND static_component_libnames + ${static_prefix}${component_libname}) + endforeach() + foreach(component_libname ${component_debug_libnames}) + list(APPEND static_component_debug_libnames + ${static_prefix}${component_libname}) + endforeach() + list(APPEND component_libnames ${static_component_libnames}) + list(APPEND component_debug_libnames ${static_component_debug_libnames}) + endif() find_library("${component_cache_release}" ${component_libnames} HINTS ${icu_roots} PATH_SUFFIXES ${icu_library_suffixes} diff --git a/Modules/FindIconv.cmake b/Modules/FindIconv.cmake new file mode 100644 index 0000000..bf20f6f --- /dev/null +++ b/Modules/FindIconv.cmake @@ -0,0 +1,133 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +#[=======================================================================[.rst: +FindIconv +--------- + +This module finds the ``iconv()`` POSIX.1 functions on the system. +These functions might be provided in the regular C library or externally +in the form of an additional library. + +The following variables are provided to indicate iconv support: + +.. variable:: Iconv_FOUND + + Variable indicating if the iconv support was found. + +.. variable:: Iconv_INCLUDE_DIRS + + The directories containing the iconv headers. + +.. variable:: Iconv_LIBRARIES + + The iconv libraries to be linked. + +.. variable:: Iconv_IS_BUILT_IN + + A variable indicating whether iconv support is stemming from the + C library or not. Even if the C library provides `iconv()`, the presence of + an external `libiconv` implementation might lead to this being false. + +Additionally, the following :prop_tgt:`IMPORTED` target is being provided: + +.. variable:: Iconv::Iconv + + Imported target for using iconv. + +The following cache variables may also be set: + +.. variable:: Iconv_INCLUDE_DIR + + The directory containing the iconv headers. + +.. variable:: Iconv_LIBRARY + + The iconv library (if not implicitly given in the C library). + +.. note:: + On POSIX platforms, iconv might be part of the C library and the cache + variables ``Iconv_INCLUDE_DIR`` and ``Iconv_LIBRARY`` might be empty. + +#]=======================================================================] + +include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake) +if(CMAKE_C_COMPILER_LOADED) + include(${CMAKE_CURRENT_LIST_DIR}/CheckCSourceCompiles.cmake) +elseif(CMAKE_CXX_COMPILER_LOADED) + include(${CMAKE_CURRENT_LIST_DIR}/CheckCXXSourceCompiles.cmake) +else() + # If neither C nor CXX are loaded, implicit iconv makes no sense. + set(Iconv_IS_BUILT_IN FALSE) +endif() + +# iconv can only be provided in libc on a POSIX system. +# If any cache variable is already set, we'll skip this test. +if(NOT DEFINED Iconv_IS_BUILT_IN) + if(UNIX AND NOT DEFINED Iconv_INCLUDE_DIR AND NOT DEFINED Iconv_LIBRARY) + cmake_push_check_state(RESET) + # We always suppress the message here: Otherwise on supported systems + # not having iconv in their C library (e.g. those using libiconv) + # would always display a confusing "Looking for iconv - not found" message + set(CMAKE_FIND_QUIETLY TRUE) + # The following code will not work, but it's sufficient to see if it compiles. + # Note: libiconv will define the iconv functions as macros, so CheckSymbolExists + # will not yield correct results. + set(Iconv_IMPLICIT_TEST_CODE + " + #include <stddef.h> + #include <iconv.h> + int main() { + char *a, *b; + size_t i, j; + iconv_t ic; + ic = iconv_open(\"to\", \"from\"); + iconv(ic, &a, &i, &b, &j); + iconv_close(ic); + } + " + ) + if(CMAKE_C_COMPILER_LOADED) + check_c_source_compiles("${Iconv_IMPLICIT_TEST_CODE}" Iconv_IS_BUILT_IN) + else() + check_cxx_source_compiles("${Iconv_IMPLICIT_TEST_CODE}" Iconv_IS_BUILT_IN) + endif() + cmake_pop_check_state() + else() + set(Iconv_IS_BUILT_IN FALSE) + endif() +endif() + +if(NOT Iconv_IS_BUILT_IN) + find_path(Iconv_INCLUDE_DIR + NAMES "iconv.h" + DOC "iconv include directory") + set(Iconv_LIBRARY_NAMES "iconv" "libiconv") +else() + set(Iconv_INCLUDE_DIR "" CACHE FILEPATH "iconv include directory") + set(Iconv_LIBRARY_NAMES "c") +endif() + +find_library(Iconv_LIBRARY + NAMES ${Iconv_LIBRARY_NAMES} + DOC "iconv library (potentially the C library)") + +mark_as_advanced(Iconv_INCLUDE_DIR) +mark_as_advanced(Iconv_LIBRARY) + +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +if(NOT Iconv_IS_BUILT_IN) + find_package_handle_standard_args(Iconv REQUIRED_VARS Iconv_LIBRARY Iconv_INCLUDE_DIR) +else() + find_package_handle_standard_args(Iconv REQUIRED_VARS Iconv_LIBRARY) +endif() + +if(Iconv_FOUND) + set(Iconv_INCLUDE_DIRS "${Iconv_INCLUDE_DIR}") + set(Iconv_LIBRARIES "${Iconv_LIBRARY}") + if(NOT TARGET Iconv::Iconv) + add_library(Iconv::Iconv INTERFACE IMPORTED) + endif() + set_property(TARGET Iconv::Iconv PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${Iconv_INCLUDE_DIRS}") + set_property(TARGET Iconv::Iconv PROPERTY INTERFACE_LINK_LIBRARIES "${Iconv_LIBRARIES}") +endif() diff --git a/Modules/FindImageMagick.cmake b/Modules/FindImageMagick.cmake index 7d5534b..c16bbf2 100644 --- a/Modules/FindImageMagick.cmake +++ b/Modules/FindImageMagick.cmake @@ -196,24 +196,33 @@ foreach(component ${ImageMagick_FIND_COMPONENTS} if(component STREQUAL "Magick++") FIND_IMAGEMAGICK_API(Magick++ Magick++.h Magick++ CORE_RL_Magick++_ + Magick++-6 Magick++-7 Magick++-Q8 Magick++-Q16 Magick++-Q16HDRI Magick++-Q8HDRI + Magick++-6.Q64 Magick++-6.Q32 Magick++-6.Q64HDRI Magick++-6.Q32HDRI Magick++-6.Q16 Magick++-6.Q8 Magick++-6.Q16HDRI Magick++-6.Q8HDRI + Magick++-7.Q64 Magick++-7.Q32 Magick++-7.Q64HDRI Magick++-7.Q32HDRI Magick++-7.Q16 Magick++-7.Q8 Magick++-7.Q16HDRI Magick++-7.Q8HDRI ) list(APPEND ImageMagick_REQUIRED_VARS ImageMagick_Magick++_LIBRARY) elseif(component STREQUAL "MagickWand") FIND_IMAGEMAGICK_API(MagickWand "wand/MagickWand.h;MagickWand/MagickWand.h" Wand MagickWand CORE_RL_wand_ + MagickWand-6 MagickWand-7 MagickWand-Q16 MagickWand-Q8 MagickWand-Q16HDRI MagickWand-Q8HDRI + MagickWand-6.Q64 MagickWand-6.Q32 MagickWand-6.Q64HDRI MagickWand-6.Q32HDRI MagickWand-6.Q16 MagickWand-6.Q8 MagickWand-6.Q16HDRI MagickWand-6.Q8HDRI + MagickWand-7.Q64 MagickWand-7.Q32 MagickWand-7.Q64HDRI MagickWand-7.Q32HDRI MagickWand-7.Q16 MagickWand-7.Q8 MagickWand-7.Q16HDRI MagickWand-7.Q8HDRI ) list(APPEND ImageMagick_REQUIRED_VARS ImageMagick_MagickWand_LIBRARY) elseif(component STREQUAL "MagickCore") FIND_IMAGEMAGICK_API(MagickCore "magick/MagickCore.h;MagickCore/MagickCore.h" Magick MagickCore CORE_RL_magick_ + MagickCore-6 MagickCore-7 MagickCore-Q16 MagickCore-Q8 MagickCore-Q16HDRI MagickCore-Q8HDRI + MagickCore-6.Q64 MagickCore-6.Q32 MagickCore-6.Q64HDRI MagickCore-6.Q32HDRI MagickCore-6.Q16 MagickCore-6.Q8 MagickCore-6.Q16HDRI MagickCore-6.Q8HDRI + MagickCore-7.Q64 MagickCore-7.Q32 MagickCore-7.Q64HDRI MagickCore-7.Q32HDRI MagickCore-7.Q16 MagickCore-7.Q8 MagickCore-7.Q16HDRI MagickCore-7.Q8HDRI ) list(APPEND ImageMagick_REQUIRED_VARS ImageMagick_MagickCore_LIBRARY) diff --git a/Modules/FindJNI.cmake b/Modules/FindJNI.cmake index cebba10..c4601a1 100644 --- a/Modules/FindJNI.cmake +++ b/Modules/FindJNI.cmake @@ -25,7 +25,7 @@ # JAVA_INCLUDE_PATH2 = the include path to jni_md.h # JAVA_AWT_INCLUDE_PATH = the include path to jawt.h -# Expand {libarch} occurences to java_libarch subdirectory(-ies) and set ${_var} +# Expand {libarch} occurrences to java_libarch subdirectory(-ies) and set ${_var} macro(java_append_library_directories _var) # Determine java arch-specific library subdir # Mostly based on openjdk/jdk/make/common/shared/Platform.gmk as of openjdk @@ -46,7 +46,7 @@ macro(java_append_library_directories _var) set(_java_libarch "arm" "aarch32") elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^mips") # mips* machines are bi-endian mostly so processor does not tell - # endianess of the underlying system. + # endianness of the underlying system. set(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}" "mips" "mipsel" "mipseb" "mips64" "mips64el" "mipsn32" "mipsn32el") elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64le") set(_java_libarch "ppc64" "ppc64le") @@ -126,8 +126,6 @@ list(APPEND JAVA_AWT_LIBRARY_DIRECTORIES "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\${java_install_version};JavaHome]/lib" ) JAVA_APPEND_LIBRARY_DIRECTORIES(JAVA_AWT_LIBRARY_DIRECTORIES - /usr/lib - /usr/local/lib /usr/lib/jvm/java/lib /usr/lib/java/jre/lib/{libarch} /usr/lib/jvm/jre/lib/{libarch} @@ -185,8 +183,6 @@ list(APPEND JAVA_AWT_INCLUDE_DIRECTORIES ) JAVA_APPEND_LIBRARY_DIRECTORIES(JAVA_AWT_INCLUDE_DIRECTORIES - /usr/include - /usr/local/include /usr/lib/java/include /usr/local/lib/java/include /usr/lib/jvm/java/include diff --git a/Modules/FindKDE3.cmake b/Modules/FindKDE3.cmake index 03216a5..daf6818 100644 --- a/Modules/FindKDE3.cmake +++ b/Modules/FindKDE3.cmake @@ -200,8 +200,7 @@ find_path(KDE3_INCLUDE_DIR kpassdlg.h PATHS /opt/kde3/include /opt/kde/include - /usr/include/kde - /usr/local/include/kde + PATH_SUFFIXES include/kde ) #now the KDE library directory diff --git a/Modules/FindLAPACK.cmake b/Modules/FindLAPACK.cmake index a451e6c..a3c87f8 100644 --- a/Modules/FindLAPACK.cmake +++ b/Modules/FindLAPACK.cmake @@ -37,6 +37,7 @@ # # * Intel(mkl) # * OpenBLAS +# * FLAME # * ACML # * Apple # * NAS @@ -201,6 +202,20 @@ if (BLA_VENDOR STREQUAL "OpenBLAS" OR BLA_VENDOR STREQUAL "All") endif() endif () +if (BLA_VENDOR STREQUAL "FLAME" OR BLA_VENDOR STREQUAL "All") + if(NOT LAPACK_LIBRARIES) + check_lapack_libraries( + LAPACK_LIBRARIES + LAPACK + cheev + "" + "flame" + "${BLAS_LIBRARIES}" + "" + ) + endif() +endif () + #acml lapack if (BLA_VENDOR MATCHES "ACML" OR BLA_VENDOR STREQUAL "All") if (BLAS_LIBRARIES MATCHES ".+acml.+") diff --git a/Modules/FindMPEG.cmake b/Modules/FindMPEG.cmake index cd1b021..850a57e 100644 --- a/Modules/FindMPEG.cmake +++ b/Modules/FindMPEG.cmake @@ -22,23 +22,21 @@ # MPEG_mpeg2_LIBRARY, where to find the MPEG library. # MPEG_vo_LIBRARY, where to find the vo library. -find_path(MPEG_INCLUDE_DIR mpeg2dec/include/video_out.h - /usr/local/livid -) +find_path(MPEG_INCLUDE_DIR + NAMES mpeg2.h mpeg2dec/mpeg2.h mpeg2dec/include/video_out.h) -find_library(MPEG_mpeg2_LIBRARY mpeg2 - /usr/local/livid/mpeg2dec/libmpeg2/.libs -) +find_library(MPEG_mpeg2_LIBRARY mpeg2) -find_library( MPEG_vo_LIBRARY vo - /usr/local/livid/mpeg2dec/libvo/.libs -) +find_library(MPEG_vo_LIBRARY vo) include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(MPEG DEFAULT_MSG MPEG_INCLUDE_DIR MPEG_mpeg2_LIBRARY MPEG_vo_LIBRARY) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(MPEG DEFAULT_MSG MPEG_mpeg2_LIBRARY MPEG_INCLUDE_DIR) if(MPEG_FOUND) - set( MPEG_LIBRARIES ${MPEG_mpeg2_LIBRARY} ${MPEG_vo_LIBRARY} ) + set( MPEG_LIBRARIES ${MPEG_mpeg2_LIBRARY} ) + if(MPEG_vo_LIBRARY) + list(APPEND MPEG2_LIBRARIES ${MPEG_vo_LIBRARY}) + endif() endif() mark_as_advanced(MPEG_INCLUDE_DIR MPEG_mpeg2_LIBRARY MPEG_vo_LIBRARY) diff --git a/Modules/FindMPEG2.cmake b/Modules/FindMPEG2.cmake index 2c75d7b..f9ccd6a 100644 --- a/Modules/FindMPEG2.cmake +++ b/Modules/FindMPEG2.cmake @@ -23,28 +23,24 @@ # MPEG2_vo_LIBRARY, where to find the vo library. find_path(MPEG2_INCLUDE_DIR - NAMES mpeg2.h mpeg2dec/mpeg2.h - PATHS /usr/local/livid -) + NAMES mpeg2.h mpeg2dec/mpeg2.h) -find_library(MPEG2_mpeg2_LIBRARY mpeg2 - /usr/local/livid/mpeg2dec/libmpeg2/.libs -) +find_library(MPEG2_mpeg2_LIBRARY mpeg2) -find_library( MPEG2_vo_LIBRARY vo - /usr/local/livid/mpeg2dec/libvo/.libs -) +find_library(MPEG2_vo_LIBRARY vo) include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(MPEG2 DEFAULT_MSG MPEG2_mpeg2_LIBRARY MPEG2_INCLUDE_DIR) if(MPEG2_FOUND) - set( MPEG2_LIBRARIES ${MPEG2_mpeg2_LIBRARY} - ${MPEG2_vo_LIBRARY}) + set(MPEG2_LIBRARIES ${MPEG2_mpeg2_LIBRARY}) + if(MPEG2_vo_LIBRARY) + list(APPEND MPEG2_LIBRARIES ${MPEG2_vo_LIBRARY}) + endif() #some native mpeg2 installations will depend #on libSDL, if found, add it in. - include(${CMAKE_CURRENT_LIST_DIR}/FindSDL.cmake) + find_package(SDL) if(SDL_FOUND) set( MPEG2_LIBRARIES ${MPEG2_LIBRARIES} ${SDL_LIBRARY}) endif() diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake index 7f4c44c..4d9444a 100644 --- a/Modules/FindMPI.cmake +++ b/Modules/FindMPI.cmake @@ -346,7 +346,7 @@ function (_MPI_check_compiler LANG QUERY_FLAG OUTPUT_VARIABLE RESULT_VARIABLE) # library that has invalid or missing version information there would be warning # messages emitted by ld.so in the compiler output. In either case, we'll treat # the output as invalid. - if("${WRAPPER_OUTPUT}" MATCHES "undefined reference|unrecognized|need to set|no version information available") + if("${WRAPPER_OUTPUT}" MATCHES "undefined reference|unrecognized|need to set|no version information available|command not found") set(WRAPPER_RETURN 255) endif() # Ensure that no error output might be passed upwards. @@ -602,6 +602,9 @@ function (_MPI_interrogate_compiler lang) if(MPI_DIRECT_LIB_NAMES_WORK) set(MPI_PLAIN_LIB_NAMES_WORK "${MPI_DIRECT_LIB_NAMES_WORK};${MPI_PLAIN_LIB_NAMES_WORK}") endif() + if(MPI_${LANG}_EXTRA_LIB_NAMES) + list(APPEND MPI_PLAIN_LIB_NAMES_WORK "${MPI_${LANG}_EXTRA_LIB_NAMES}") + endif() # MPI might require pthread to work. The above mechanism wouldn't detect it, but we need to # link it in that case. -lpthread is covered by the normal library treatment on the other hand. @@ -1076,18 +1079,21 @@ foreach (LANG IN ITEMS C CXX) endif() # If a list of libraries was given, we'll split it into new-style cache variables + unset(MPI_${LANG}_EXTRA_LIB_NAMES) if(NOT MPI_${LANG}_LIB_NAMES) foreach(_MPI_LIB IN LISTS MPI_${LANG}_LIBRARIES MPI_LIBRARY MPI_EXTRA_LIBRARY) - get_filename_component(_MPI_PLAIN_LIB_NAME "${_MPI_LIB}" NAME_WE) - get_filename_component(_MPI_LIB_NAME "${_MPI_LIB}" NAME) - get_filename_component(_MPI_LIB_DIR "${_MPI_LIB}" DIRECTORY) - list(APPEND MPI_PLAIN_LIB_NAMES_WORK "${_MPI_PLAIN_LIB_NAME}") - find_library(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY - NAMES "${_MPI_LIB_NAME}" "lib${_MPI_LIB_NAME}" - HINTS ${_MPI_LIB_DIR} $ENV{MPI_LIB} - DOC "Location of the ${_MPI_PLAIN_LIB_NAME} library for MPI" - ) - mark_as_advanced(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY) + if(_MPI_LIB) + get_filename_component(_MPI_PLAIN_LIB_NAME "${_MPI_LIB}" NAME_WE) + get_filename_component(_MPI_LIB_NAME "${_MPI_LIB}" NAME) + get_filename_component(_MPI_LIB_DIR "${_MPI_LIB}" DIRECTORY) + list(APPEND MPI_${LANG}_EXTRA_LIB_NAMES "${_MPI_PLAIN_LIB_NAME}") + find_library(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY + NAMES "${_MPI_LIB_NAME}" "lib${_MPI_LIB_NAME}" + HINTS ${_MPI_LIB_DIR} $ENV{MPI_LIB} + DOC "Location of the ${_MPI_PLAIN_LIB_NAME} library for MPI" + ) + mark_as_advanced(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY) + endif() endforeach() endif() endforeach() @@ -1336,7 +1342,7 @@ foreach(LANG IN ITEMS C CXX Fortran) set(MPI_${LANG}_FIND_VERSION_EXACT ${MPI_FIND_VERSION_EXACT}) unset(MPI_${LANG}_REQUIRED_VARS) - if (MPI_${LANG}_WRAPPER_FOUND OR MPI_${LANG}_GUESS_FOUND) + if (NOT "${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}") foreach(mpilibname IN LISTS MPI_${LANG}_LIB_NAMES) list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${mpilibname}_LIBRARY") endforeach() diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake index 7d4ed6a..06f7d96 100644 --- a/Modules/FindMatlab.cmake +++ b/Modules/FindMatlab.cmake @@ -356,7 +356,7 @@ function(matlab_extract_all_installed_versions_from_registry win64 matlab_versio endif() - if(${win64} AND ${CMAKE_HOST_SYSTEM_PROCESSOR} MATCHES "64") + if(${win64} AND CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "64") set(APPEND_REG "/reg:64") else() set(APPEND_REG "/reg:32") @@ -1198,7 +1198,7 @@ if(_numbers_of_matlab_roots EQUAL 0) # At this point, we have no other choice than trying to find it from PATH. - # If set by the user, this wont change + # If set by the user, this won't change find_program( _matlab_main_tmp NAMES matlab) diff --git a/Modules/FindOpenCL.cmake b/Modules/FindOpenCL.cmake index 0db2dd2..297a5fb 100644 --- a/Modules/FindOpenCL.cmake +++ b/Modules/FindOpenCL.cmake @@ -76,6 +76,7 @@ find_path(OpenCL_INCLUDE_DIR ENV NVSDKCOMPUTE_ROOT ENV CUDA_PATH ENV ATISTREAMSDKROOT + ENV OCL_ROOT PATH_SUFFIXES include OpenCL/common/inc @@ -94,6 +95,7 @@ if(WIN32) ENV CUDA_PATH ENV NVSDKCOMPUTE_ROOT ENV ATISTREAMSDKROOT + ENV OCL_ROOT PATH_SUFFIXES "AMD APP/lib/x86" lib/x86 @@ -109,6 +111,7 @@ if(WIN32) ENV CUDA_PATH ENV NVSDKCOMPUTE_ROOT ENV ATISTREAMSDKROOT + ENV OCL_ROOT PATH_SUFFIXES "AMD APP/lib/x86_64" lib/x86_64 @@ -120,9 +123,12 @@ else() NAMES OpenCL PATHS ENV AMDAPPSDKROOT + ENV CUDA_PATH PATH_SUFFIXES lib/x86_64 - lib/x64) + lib/x64 + lib + lib64) endif() set(OpenCL_LIBRARIES ${OpenCL_LIBRARY}) diff --git a/Modules/FindOpenGL.cmake b/Modules/FindOpenGL.cmake index 9063492..9ccd46b 100644 --- a/Modules/FindOpenGL.cmake +++ b/Modules/FindOpenGL.cmake @@ -99,11 +99,13 @@ # If the GLVND OpenGL and GLX libraries are available, prefer them. # This forces ``OPENGL_gl_LIBRARY`` to be empty. # This is the default if components were requested (since components -# correspond to GLVND libraries). +# correspond to GLVND libraries) or if policy :policy:`CMP0072` is +# set to ``NEW``. # # ``LEGACY`` # Prefer to use the legacy libGL library, if available. -# This is the default if no components were requested. +# This is the default if no components were requested and +# policy :policy:`CMP0072` is not set to ``NEW``. # # For EGL targets the client must rely on GLVND support on the user's system. # Linking should use the ``OpenGL::OpenGL OpenGL::EGL`` targets. Using GLES* @@ -182,7 +184,7 @@ else() find_path(OPENGL_INCLUDE_DIR GL/gl.h /usr/share/doc/NVIDIA_GLX-1.0/include /usr/openwin/share/include - /opt/graphics/OpenGL/include /usr/X11R6/include + /opt/graphics/OpenGL/include ${_OPENGL_INCLUDE_PATH} ) find_path(OPENGL_GLX_INCLUDE_DIR GL/glx.h ${_OPENGL_INCLUDE_PATH}) @@ -190,21 +192,19 @@ else() find_path(OPENGL_xmesa_INCLUDE_DIR GL/xmesa.h /usr/share/doc/NVIDIA_GLX-1.0/include /usr/openwin/share/include - /opt/graphics/OpenGL/include /usr/X11R6/include + /opt/graphics/OpenGL/include ) # Search for the GLVND libraries. We do this regardless of COMPONENTS; we'll # take into account the COMPONENTS logic later. find_library(OPENGL_opengl_LIBRARY NAMES OpenGL - PATHS /usr/X11R6/lib - ${_OPENGL_LIB_PATH} + PATHS ${_OPENGL_LIB_PATH} ) find_library(OPENGL_glx_LIBRARY NAMES GLX - PATHS /usr/X11R6/lib - ${_OPENGL_LIB_PATH} + PATHS ${_OPENGL_LIB_PATH} ) find_library(OPENGL_egl_LIBRARY @@ -217,9 +217,10 @@ else() PATHS ${OPENGL_gl_LIBRARY} /opt/graphics/OpenGL/lib /usr/openwin/lib - /usr/shlib /usr/X11R6/lib + /usr/shlib ) + set(_OpenGL_GL_POLICY_WARN 0) if(NOT DEFINED OpenGL_GL_PREFERENCE) set(OpenGL_GL_PREFERENCE "") endif() @@ -237,8 +238,17 @@ else() set(OpenGL_GL_PREFERENCE "GLVND") else() # No preference was explicitly specified and no GLVND components were - # requested. Prefer libGL for legacy GL. - set(OpenGL_GL_PREFERENCE "LEGACY") + # requested. Use a policy to choose the default. + cmake_policy(GET CMP0072 _OpenGL_GL_POLICY) + if("x${_OpenGL_GL_POLICY}x" STREQUAL "xNEWx") + set(OpenGL_GL_PREFERENCE "GLVND") + else() + set(OpenGL_GL_PREFERENCE "LEGACY") + if("x${_OpenGL_GL_POLICY}x" STREQUAL "xx") + set(_OpenGL_GL_POLICY_WARN 1) + endif() + endif() + unset(_OpenGL_GL_POLICY) endif() if("x${OpenGL_GL_PREFERENCE}x" STREQUAL "xGLVNDx" AND OPENGL_opengl_LIBRARY AND OPENGL_glx_LIBRARY) @@ -252,11 +262,28 @@ else() NAMES GL MesaGL PATHS /opt/graphics/OpenGL/lib /usr/openwin/lib - /usr/shlib /usr/X11R6/lib + /usr/shlib ${_OPENGL_LIB_PATH} ) endif() + if(_OpenGL_GL_POLICY_WARN AND OPENGL_gl_LIBRARY AND OPENGL_opengl_LIBRARY AND OPENGL_glx_LIBRARY) + message(AUTHOR_WARNING + "Policy CMP0072 is not set: FindOpenGL prefers GLVND by default when available. " + "Run \"cmake --help-policy CMP0072\" for policy details. " + "Use the cmake_policy command to set the policy and suppress this warning." + "\n" + "FindOpenGL found both a legacy GL library:\n" + " OPENGL_gl_LIBRARY: ${OPENGL_gl_LIBRARY}\n" + "and GLVND libraries for OpenGL and GLX:\n" + " OPENGL_opengl_LIBRARY: ${OPENGL_opengl_LIBRARY}\n" + " OPENGL_glx_LIBRARY: ${OPENGL_glx_LIBRARY}\n" + "OpenGL_GL_PREFERENCE has not been set to \"GLVND\" or \"LEGACY\", so for " + "compatibility with CMake 3.10 and below the legacy GL library will be used." + ) + endif() + unset(_OpenGL_GL_POLICY_WARN) + # FPHSA cannot handle "this OR that is required", so we conditionally set what # it must look for. First clear any previous config we might have done: set(_OpenGL_REQUIRED_VARS) @@ -323,7 +350,7 @@ else() PATHS ${OPENGL_gl_LIBRARY} /opt/graphics/OpenGL/lib /usr/openwin/lib - /usr/shlib /usr/X11R6/lib + /usr/shlib ) endif () diff --git a/Modules/FindOpenMP.cmake b/Modules/FindOpenMP.cmake index 489476b..893ddc6 100644 --- a/Modules/FindOpenMP.cmake +++ b/Modules/FindOpenMP.cmake @@ -75,6 +75,7 @@ # the OpenMP specification implemented by the ``<lang>`` compiler. cmake_policy(PUSH) +cmake_policy(SET CMP0012 NEW) # if() recognizes numbers and booleans cmake_policy(SET CMP0054 NEW) # if() quoted variables not dereferenced cmake_policy(SET CMP0057 NEW) # if IN_LIST @@ -230,6 +231,7 @@ function(_OPENMP_GET_FLAGS LANG FLAG_MODE OPENMP_FLAG_VAR OPENMP_LIB_NAMES_VAR) DOC "Path to the ${_OPENMP_IMPLICIT_LIB_PLAIN} library for OpenMP" HINTS ${OpenMP_${LANG}_IMPLICIT_LINK_DIRS} CMAKE_FIND_ROOT_PATH_BOTH + NO_DEFAULT_PATH ) endif() mark_as_advanced(OpenMP_${_OPENMP_IMPLICIT_LIB_PLAIN}_LIBRARY) @@ -244,6 +246,8 @@ function(_OPENMP_GET_FLAGS LANG FLAG_MODE OPENMP_FLAG_VAR OPENMP_LIB_NAMES_VAR) find_library(OpenMP_libiomp5md_LIBRARY NAMES "libiomp5md" HINTS ${CMAKE_${LANG}_IMPLICIT_LINK_DIRECTORIES} + CMAKE_FIND_ROOT_PATH_BOTH + NO_DEFAULT_PATH ) mark_as_advanced(OpenMP_libiomp5md_LIBRARY) else() diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake index 0187e0d..c358ff1 100644 --- a/Modules/FindOpenSSL.cmake +++ b/Modules/FindOpenSSL.cmake @@ -110,7 +110,7 @@ if(WIN32 AND NOT CYGWIN) # * MTd for static-debug # Implementation details: - # We are using the libraries located in the VC subdir instead of the parent directory eventhough : + # We are using the libraries located in the VC subdir instead of the parent directory even though : # libeay32MD.lib is identical to ../libeay32.lib, and # ssleay32MD.lib is identical to ../ssleay32.lib # enable OPENSSL_USE_STATIC_LIBS to use the static libs located in lib/VC/static diff --git a/Modules/FindOpenThreads.cmake b/Modules/FindOpenThreads.cmake index 54804b8..b1b116a 100644 --- a/Modules/FindOpenThreads.cmake +++ b/Modules/FindOpenThreads.cmake @@ -58,13 +58,6 @@ find_path(OPENTHREADS_INCLUDE_DIR OpenThreads/Thread ENV OSG_ROOT ${OPENTHREADS_DIR} ${OSG_DIR} - PATHS - /sw # Fink - /opt/local # DarwinPorts - /opt/csw # Blastwave - /opt - /usr/freeware - PATH_SUFFIXES include ) @@ -80,13 +73,6 @@ find_library(OPENTHREADS_LIBRARY ENV OSG_ROOT ${OPENTHREADS_DIR} ${OSG_DIR} - PATHS - /sw - /opt/local - /opt/csw - /opt - /usr/freeware - PATH_SUFFIXES lib ) find_library(OPENTHREADS_LIBRARY_DEBUG @@ -102,13 +88,6 @@ find_library(OPENTHREADS_LIBRARY_DEBUG ENV OSG_ROOT ${OPENTHREADS_DIR} ${OSG_DIR} - PATHS - /sw - /opt/local - /opt/csw - /opt - /usr/freeware - PATH_SUFFIXES lib ) if(OPENTHREADS_LIBRARY_DEBUG) diff --git a/Modules/FindPNG.cmake b/Modules/FindPNG.cmake index dceb6bc..936f01f 100644 --- a/Modules/FindPNG.cmake +++ b/Modules/FindPNG.cmake @@ -51,9 +51,7 @@ endif() find_package(ZLIB ${_FIND_ZLIB_ARG}) if(ZLIB_FOUND) - find_path(PNG_PNG_INCLUDE_DIR png.h - /usr/local/include/libpng # OpenBSD - ) + find_path(PNG_PNG_INCLUDE_DIR png.h PATH_SUFFIXES include/libpng) list(APPEND PNG_NAMES png libpng) unset(PNG_NAMES_DEBUG) diff --git a/Modules/FindPike.cmake b/Modules/FindPike.cmake index dff55a4..ec71c94 100644 --- a/Modules/FindPike.cmake +++ b/Modules/FindPike.cmake @@ -16,15 +16,12 @@ # PIKE_INCLUDE_PATH = path to where program.h is found # PIKE_EXECUTABLE = full path to the pike binary -file(GLOB PIKE_POSSIBLE_INCLUDE_PATHS - /usr/include/pike/* - /usr/local/include/pike/*) - find_path(PIKE_INCLUDE_PATH program.h - ${PIKE_POSSIBLE_INCLUDE_PATHS}) + ${PIKE_POSSIBLE_INCLUDE_PATHS} + PATH_SUFFIXES include/pike8.0/pike include/pike7.8/pike include/pike7.4/pike) find_program(PIKE_EXECUTABLE - NAMES pike7.4 + NAMES pike8.0 pike 7.8 pike7.4 ) mark_as_advanced( diff --git a/Modules/FindPythonLibs.cmake b/Modules/FindPythonLibs.cmake index 63ec9a8..341d5d9 100644 --- a/Modules/FindPythonLibs.cmake +++ b/Modules/FindPythonLibs.cmake @@ -122,6 +122,7 @@ foreach(_CURRENT_VERSION ${_Python_VERSIONS}) if(WIN32) find_library(PYTHON_DEBUG_LIBRARY NAMES python${_CURRENT_VERSION_NO_DOTS}_d python + NAMES_PER_DIR HINTS ${_Python_LIBRARY_PATH_HINT} PATHS [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs/Debug @@ -145,20 +146,18 @@ foreach(_CURRENT_VERSION ${_Python_VERSIONS}) python${_CURRENT_VERSION}m python${_CURRENT_VERSION}u python${_CURRENT_VERSION} + NAMES_PER_DIR HINTS ${_Python_LIBRARY_PATH_HINT} PATHS ${PYTHON_FRAMEWORK_LIBRARIES} [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs - # Avoid finding the .dll in the PATH. We want the .lib. - NO_SYSTEM_ENVIRONMENT_PATH ) # Look for the static library in the Python config directory find_library(PYTHON_LIBRARY NAMES python${_CURRENT_VERSION_NO_DOTS} python${_CURRENT_VERSION} - # Avoid finding the .dll in the PATH. We want the .lib. - NO_SYSTEM_ENVIRONMENT_PATH + NAMES_PER_DIR # This is where the static library is usually located PATH_SUFFIXES python${_CURRENT_VERSION}/config ) diff --git a/Modules/FindQt.cmake b/Modules/FindQt.cmake index 4d8aea9..68dfa7d 100644 --- a/Modules/FindQt.cmake +++ b/Modules/FindQt.cmake @@ -105,13 +105,11 @@ find_file( QT4_QGLOBAL_H_FILE qglobal.h "[HKEY_CURRENT_USER\\Software\\Trolltech\\Versions\\4.0.0;InstallDir]/include/Qt" ${qt_headers}/Qt $ENV{QTDIR}/include/Qt - /usr/local/qt/include/Qt - /usr/local/include/Qt /usr/lib/qt/include/Qt - /usr/include/Qt /usr/share/qt4/include/Qt /usr/local/include/X11/qt4/Qt - C:/Progra~1/qt/include/Qt ) + C:/Progra~1/qt/include/Qt + PATH_SUFFIXES qt/include/Qt include/Qt) if(QT4_QGLOBAL_H_FILE) set(QT4_INSTALLED TRUE) @@ -125,14 +123,10 @@ find_file( QT3_QGLOBAL_H_FILE qglobal.h C:/Qt/3.3.3Educational/include $ENV{QTDIR}/include /usr/include/qt3/Qt - /usr/local/qt/include - /usr/local/include - /usr/lib/qt/include - /usr/include /usr/share/qt3/include /usr/local/include/X11/qt3 C:/Progra~1/qt/include - /usr/include/qt3 ) + PATH_SUFFIXES qt/include include/qt3) if(QT3_QGLOBAL_H_FILE) set(QT3_INSTALLED TRUE) diff --git a/Modules/FindQt3.cmake b/Modules/FindQt3.cmake index fa9f3a1..a034210 100644 --- a/Modules/FindQt3.cmake +++ b/Modules/FindQt3.cmake @@ -61,14 +61,10 @@ find_path(QT_INCLUDE_DIR qt.h "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.1.0;InstallDir]/include/Qt" $ENV{QTDIR}/include ${GLOB_PATHS} - /usr/local/qt/include - /usr/lib/qt/include - /usr/lib/qt3/include - /usr/include/qt /usr/share/qt3/include C:/Progra~1/qt/include - /usr/include/qt3 /usr/local/include/X11/qt3 + PATH_SUFFIXES lib/qt/include lib/qt3/include include/qt include/qt3 qt/include qt3/include ) # if qglobal.h is not in the qt_include_dir then set @@ -101,13 +97,10 @@ if (QT_MT_REQUIRED) "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.1.0;InstallDir]" ENV QTDIR ${GLOB_PATHS_LIB} - /usr/local/qt - /usr/lib/qt - /usr/lib/qt3 /usr/share/qt3 C:/Progra~1/qt PATH_SUFFIXES - lib + lib/qt lib/qt3 qt qt3 qt/lib qt3/lib ) else () @@ -122,13 +115,10 @@ else () "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.1.0;InstallDir]" ENV QTDIR ${GLOB_PATHS_LIB} - /usr/local/qt - /usr/lib/qt - /usr/lib/qt3 /usr/share/qt3 C:/Progra~1/qt/lib PATH_SUFFIXES - lib + lib/qt lib/qt3 qt qt3 qt/lib qt3/lib ) endif () @@ -141,12 +131,10 @@ find_library(QT_QASSISTANTCLIENT_LIBRARY "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.1.0;InstallDir]" ENV QTDIR ${GLOB_PATHS_LIB} - /usr/local/qt - /usr/lib/qt3 /usr/share/qt3 C:/Progra~1/qt PATH_SUFFIXES - lib + lib/qt lib/qt3 qt qt3 qt/lib qt3/lib ) # Qt 3 should prefer QTDIR over the PATH @@ -159,15 +147,10 @@ find_program(QT_MOC_EXECUTABLE "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.0;InstallDir]/include/Qt" "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.1.0;InstallDir]/include/Qt" ${GLOB_PATHS_BIN} - /usr/local/lib/qt3 - /usr/local/qt - /usr/lib/qt - /usr/lib/qt3 /usr/share/qt3 C:/Progra~1/qt - /usr/X11R6 PATH_SUFFIXES - bin + lib/qt lib/qt3 qt qt3 qt/lib qt3/lib ) if(QT_MOC_EXECUTABLE) @@ -184,14 +167,10 @@ find_program(QT_UIC_EXECUTABLE "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.0;InstallDir]/include/Qt" "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.1.0;InstallDir]/include/Qt" ${GLOB_PATHS_BIN} - /usr/local/qt - /usr/lib/qt - /usr/lib/qt3 /usr/share/qt3 C:/Progra~1/qt - /usr/X11R6 PATH_SUFFIXES - bin + lib/qt lib/qt3 qt qt3 qt/lib qt3/lib ) if(QT_UIC_EXECUTABLE) @@ -208,8 +187,6 @@ if (WIN32) PATHS "$ENV{ProgramFiles}/qt" "C:/Program Files/qt" - PATH_SUFFIXES - lib DOC "This Library is only needed by and included with Qt3 on MSWindows. It should be NOTFOUND, undefined or IGNORE otherwise." ) endif () diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake index c67d0be..714e4af 100644 --- a/Modules/FindQt4.cmake +++ b/Modules/FindQt4.cmake @@ -709,13 +709,19 @@ if (QT_QMAKE_EXECUTABLE AND if (QT_LIBRARY_DIR AND NOT QT_PLUGINS_DIR OR QT_QMAKE_CHANGED) _qt4_query_qmake(QT_INSTALL_PLUGINS qt_plugins_dir) set(QT_PLUGINS_DIR NOTFOUND) + set(qt_cross_paths) foreach(qt_cross_path ${CMAKE_FIND_ROOT_PATH}) set(qt_cross_paths ${qt_cross_paths} "${qt_cross_path}/plugins") endforeach() - find_path(QT_PLUGINS_DIR NAMES accessible imageformats sqldrivers codecs designer + find_path(QT_PLUGINS_DIR + NAMES accessible bearer codecs designer graphicssystems iconengines imageformats inputmethods qmltooling script sqldrivers HINTS ${qt_cross_paths} ${qt_plugins_dir} DOC "The location of the Qt plugins" NO_CMAKE_FIND_ROOT_PATH) + # If no plugins were installed, set QT_PLUGINS_DIR to ${qt_plugins_dir} + if(NOT QT_PLUGINS_DIR AND qt_plugins_dir) + set(QT_PLUGINS_DIR ${qt_plugins_dir} CACHE PATH "The location of the Qt plugins") + endif() endif () # ask qmake for the translations directory @@ -729,6 +735,7 @@ if (QT_QMAKE_EXECUTABLE AND _qt4_query_qmake(QT_INSTALL_IMPORTS qt_imports_dir) if(qt_imports_dir) set(QT_IMPORTS_DIR NOTFOUND) + set(qt_cross_paths) foreach(qt_cross_path ${CMAKE_FIND_ROOT_PATH}) set(qt_cross_paths ${qt_cross_paths} "${qt_cross_path}/imports") endforeach() @@ -738,6 +745,10 @@ if (QT_QMAKE_EXECUTABLE AND NO_CMAKE_FIND_ROOT_PATH NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH) + # If the imports folder is empty, set QT_IMPORTS_DIR to ${qt_imports_dir} + if(NOT QT_IMPORTS_DIR AND qt_imports_dir) + set(QT_IMPORTS_DIR ${qt_imports_dir} CACHE PATH "The location of the Qt imports") + endif() mark_as_advanced(QT_IMPORTS_DIR) endif() endif () diff --git a/Modules/FindRuby.cmake b/Modules/FindRuby.cmake index a9f8d35..bd9f835 100644 --- a/Modules/FindRuby.cmake +++ b/Modules/FindRuby.cmake @@ -59,6 +59,9 @@ else() endif() if(NOT Ruby_FIND_VERSION_EXACT) + list(APPEND _RUBY_POSSIBLE_EXECUTABLE_NAMES ruby2.4 ruby24) + list(APPEND _RUBY_POSSIBLE_EXECUTABLE_NAMES ruby2.3 ruby23) + list(APPEND _RUBY_POSSIBLE_EXECUTABLE_NAMES ruby2.2 ruby22) list(APPEND _RUBY_POSSIBLE_EXECUTABLE_NAMES ruby2.1 ruby21) list(APPEND _RUBY_POSSIBLE_EXECUTABLE_NAMES ruby2.0 ruby20) list(APPEND _RUBY_POSSIBLE_EXECUTABLE_NAMES ruby1.9 ruby19) @@ -156,20 +159,35 @@ if(RUBY_EXECUTABLE AND NOT RUBY_VERSION_MAJOR) set(RUBY_VERSION_MINOR 8) set(RUBY_VERSION_PATCH 0) # check whether we found 1.9.x - if(${RUBY_EXECUTABLE} MATCHES "ruby1.?9") + if(${RUBY_EXECUTABLE} MATCHES "ruby1\\.?9") set(RUBY_VERSION_MAJOR 1) set(RUBY_VERSION_MINOR 9) endif() # check whether we found 2.0.x - if(${RUBY_EXECUTABLE} MATCHES "ruby2.?0") + if(${RUBY_EXECUTABLE} MATCHES "ruby2\\.?0") set(RUBY_VERSION_MAJOR 2) set(RUBY_VERSION_MINOR 0) endif() # check whether we found 2.1.x - if(${RUBY_EXECUTABLE} MATCHES "ruby2.?1") + if(${RUBY_EXECUTABLE} MATCHES "ruby2\\.?1") set(RUBY_VERSION_MAJOR 2) set(RUBY_VERSION_MINOR 1) endif() + # check whether we found 2.2.x + if(${RUBY_EXECUTABLE} MATCHES "ruby2\\.?2") + set(RUBY_VERSION_MAJOR 2) + set(RUBY_VERSION_MINOR 2) + endif() + # check whether we found 2.3.x + if(${RUBY_EXECUTABLE} MATCHES "ruby2\\.?3") + set(RUBY_VERSION_MAJOR 2) + set(RUBY_VERSION_MINOR 3) + endif() + # check whether we found 2.4.x + if(${RUBY_EXECUTABLE} MATCHES "ruby2\\.?4") + set(RUBY_VERSION_MAJOR 2) + set(RUBY_VERSION_MINOR 4) + endif() endif() if(RUBY_VERSION_MAJOR) diff --git a/Modules/FindSelfPackers.cmake b/Modules/FindSelfPackers.cmake index 01d0641..ac2c7cf 100644 --- a/Modules/FindSelfPackers.cmake +++ b/Modules/FindSelfPackers.cmake @@ -20,19 +20,11 @@ include(${CMAKE_CURRENT_LIST_DIR}/FindCygwin.cmake) find_program(SELF_PACKER_FOR_EXECUTABLE upx ${CYGWIN_INSTALL_PATH}/bin - /bin - /usr/bin - /usr/local/bin - /sbin ) find_program(SELF_PACKER_FOR_SHARED_LIB upx ${CYGWIN_INSTALL_PATH}/bin - /bin - /usr/bin - /usr/local/bin - /sbin ) mark_as_advanced( diff --git a/Modules/FindSquish.cmake b/Modules/FindSquish.cmake index 09bdf1f..d1ce200 100644 --- a/Modules/FindSquish.cmake +++ b/Modules/FindSquish.cmake @@ -144,9 +144,6 @@ if(NOT SQUISH_INSTALL_DIR) # Look in places relative to the system executable search path. ${SQUISH_INSTALL_DIR_SEARCH} - # Look in standard UNIX install locations. - #/usr/local/squish - DOC "The ${SQUISH_INSTALL_DIR_STRING}" ) endif() diff --git a/Modules/FindTCL.cmake b/Modules/FindTCL.cmake index b6e24a3..80779b3 100644 --- a/Modules/FindTCL.cmake +++ b/Modules/FindTCL.cmake @@ -26,7 +26,7 @@ # # # In an effort to remove some clutter and clear up some issues for -# people who are not necessarily Tcl/Tk gurus/developpers, some +# people who are not necessarily Tcl/Tk gurus/developers, some # variables were moved or removed. Changes compared to CMake 2.4 are: # # :: @@ -82,11 +82,16 @@ set(TCLTK_POSSIBLE_LIB_PATHS "${TK_LIBRARY_PATH}" "${TCL_TCLSH_PATH_PARENT}/lib" "${TK_WISH_PATH_PARENT}/lib" - /usr/local/lib/tcl/tcl8.5 - /usr/local/lib/tcl/tk8.5 - /usr/local/lib/tcl/tcl8.4 - /usr/local/lib/tcl/tk8.4 - ) +) + +set(TCLTK_POSSIBLE_LIB_PATH_SUFFIXES + lib/tcl/tcl8.6 + lib/tcl/tk8.6 + lib/tcl/tcl8.5 + lib/tcl/tk8.5 + lib/tcl/tcl8.4 + lib/tcl/tk8.4 +) if(WIN32) get_filename_component( @@ -118,6 +123,7 @@ find_library(TCL_LIBRARY tcl82 tcl8.2 tcl80 tcl8.0 PATHS ${TCLTK_POSSIBLE_LIB_PATHS} + PATH_SUFFIXES ${TCLTK_POSSIBLE_LIB_PATH_SUFFIXES} ) find_library(TK_LIBRARY @@ -131,6 +137,7 @@ find_library(TK_LIBRARY tk82 tk8.2 tk80 tk8.0 PATHS ${TCLTK_POSSIBLE_LIB_PATHS} + PATH_SUFFIXES ${TCLTK_POSSIBLE_LIB_PATH_SUFFIXES} ) CMAKE_FIND_FRAMEWORKS(Tcl) @@ -164,20 +171,20 @@ set(TCLTK_POSSIBLE_INCLUDE_PATHS ${TK_FRAMEWORK_INCLUDES} "${TCL_TCLSH_PATH_PARENT}/include" "${TK_WISH_PATH_PARENT}/include" - /usr/include/tcl${TK_LIBRARY_VERSION} - /usr/include/tcl${TCL_LIBRARY_VERSION} - /usr/include/tcl8.6 - /usr/include/tcl8.5 - /usr/include/tcl8.4 - /usr/include/tcl8.3 - /usr/include/tcl8.2 - /usr/include/tcl8.0 - /usr/local/include/tcl8.6 - /usr/local/include/tk8.6 - /usr/local/include/tcl8.5 - /usr/local/include/tk8.5 - /usr/local/include/tcl8.4 - /usr/local/include/tk8.4 + ) + +set(TCLTK_POSSIBLE_INCLUDE_PATH_SUFFIXES + include/tcl${TK_LIBRARY_VERSION} + include/tcl${TCL_LIBRARY_VERSION} + include/tcl8.6 + include/tk8.6 + include/tcl8.5 + include/tk8.5 + include/tcl8.4 + include/tk8.4 + include/tcl8.3 + include/tcl8.2 + include/tcl8.0 ) if(WIN32) @@ -198,11 +205,13 @@ endif() find_path(TCL_INCLUDE_PATH NAMES tcl.h HINTS ${TCLTK_POSSIBLE_INCLUDE_PATHS} + PATH_SUFFIXES ${TCLTK_POSSIBLE_INCLUDE_PATH_SUFFIXES} ) find_path(TK_INCLUDE_PATH NAMES tk.h HINTS ${TCLTK_POSSIBLE_INCLUDE_PATHS} + PATH_SUFFIXES ${TCLTK_POSSIBLE_INCLUDE_PATH_SUFFIXES} ) include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) diff --git a/Modules/FindTclStub.cmake b/Modules/FindTclStub.cmake index 9711bd6..51fc029 100644 --- a/Modules/FindTclStub.cmake +++ b/Modules/FindTclStub.cmake @@ -32,7 +32,7 @@ # # # In an effort to remove some clutter and clear up some issues for -# people who are not necessarily Tcl/Tk gurus/developpers, some +# people who are not necessarily Tcl/Tk gurus/developers, some # variables were moved or removed. Changes compared to CMake 2.4 are: # # :: diff --git a/Modules/FindUnixCommands.cmake b/Modules/FindUnixCommands.cmake index d2b6a4d..45047a9 100644 --- a/Modules/FindUnixCommands.cmake +++ b/Modules/FindUnixCommands.cmake @@ -15,10 +15,6 @@ include(${CMAKE_CURRENT_LIST_DIR}/FindCygwin.cmake) find_program(BASH bash ${CYGWIN_INSTALL_PATH}/bin - /bin - /usr/bin - /usr/local/bin - /sbin ) mark_as_advanced( BASH @@ -27,10 +23,6 @@ mark_as_advanced( find_program(CP cp ${CYGWIN_INSTALL_PATH}/bin - /bin - /usr/bin - /usr/local/bin - /sbin ) mark_as_advanced( CP @@ -39,10 +31,6 @@ mark_as_advanced( find_program(GZIP gzip ${CYGWIN_INSTALL_PATH}/bin - /bin - /usr/bin - /usr/local/bin - /sbin ) mark_as_advanced( GZIP @@ -51,10 +39,6 @@ mark_as_advanced( find_program(MV mv ${CYGWIN_INSTALL_PATH}/bin - /bin - /usr/bin - /usr/local/bin - /sbin ) mark_as_advanced( MV @@ -63,10 +47,6 @@ mark_as_advanced( find_program(RM rm ${CYGWIN_INSTALL_PATH}/bin - /bin - /usr/bin - /usr/local/bin - /sbin ) mark_as_advanced( RM @@ -78,10 +58,6 @@ find_program(TAR gtar PATH ${CYGWIN_INSTALL_PATH}/bin - /bin - /usr/bin - /usr/local/bin - /sbin ) mark_as_advanced( TAR diff --git a/Modules/Findosg_functions.cmake b/Modules/Findosg_functions.cmake index c81c448..83d9844 100644 --- a/Modules/Findosg_functions.cmake +++ b/Modules/Findosg_functions.cmake @@ -28,13 +28,6 @@ function(OSG_FIND_PATH module header) ENV OSG_ROOT ${${module_uc}_DIR} ${OSG_DIR} - PATH_SUFFIXES include - PATHS - /sw # Fink - /opt/local # DarwinPorts - /opt/csw # Blastwave - /opt - /usr/freeware ) endfunction() @@ -54,13 +47,6 @@ function(OSG_FIND_LIBRARY module library) ENV OSG_ROOT ${${module_uc}_DIR} ${OSG_DIR} - PATH_SUFFIXES lib - PATHS - /sw # Fink - /opt/local # DarwinPorts - /opt/csw # Blastwave - /opt - /usr/freeware ) find_library(${module_uc}_LIBRARY_DEBUG @@ -72,13 +58,6 @@ function(OSG_FIND_LIBRARY module library) ENV OSG_ROOT ${${module_uc}_DIR} ${OSG_DIR} - PATH_SUFFIXES lib - PATHS - /sw # Fink - /opt/local # DarwinPorts - /opt/csw # Blastwave - /opt - /usr/freeware ) if(NOT ${module_uc}_LIBRARY_DEBUG) diff --git a/Modules/FindwxWidgets.cmake b/Modules/FindwxWidgets.cmake index be84999..e21ec38 100644 --- a/Modules/FindwxWidgets.cmake +++ b/Modules/FindwxWidgets.cmake @@ -751,7 +751,7 @@ else() #----------------------------------------------------------------- # Support cross-compiling, only search in the target platform. find_program(wxWidgets_CONFIG_EXECUTABLE - NAMES wx-config wx-config-3.1 wx-config-3.0 wx-config-2.9 wx-config-2.8 + NAMES $ENV{WX_CONFIG} wx-config wx-config-3.1 wx-config-3.0 wx-config-2.9 wx-config-2.8 DOC "Location of wxWidgets library configuration provider binary (wx-config)." ONLY_CMAKE_FIND_ROOT_PATH ) @@ -915,7 +915,7 @@ if (_wx_lib_missing) endif() unset(_wx_lib_missing) -# Check if a specfic version was requested by find_package(). +# Check if a specific version was requested by find_package(). if(wxWidgets_FOUND) find_file(_filename wx/version.h PATHS ${wxWidgets_INCLUDE_DIRS} NO_DEFAULT_PATH) dbg_msg("_filename: ${_filename}") @@ -964,8 +964,9 @@ find_package_handle_standard_args(wxWidgets #===================================================================== # Resource file compiler. -find_program(wxWidgets_wxrc_EXECUTABLE wxrc - ${wxWidgets_ROOT_DIR}/utils/wxrc/vc_msw +find_program(wxWidgets_wxrc_EXECUTABLE + NAMES $ENV{WXRC_CMD} wxrc + PATHS ${wxWidgets_ROOT_DIR}/utils/wxrc/vc_msw DOC "Location of wxWidgets resource file compiler binary (wxrc)" ) diff --git a/Modules/FindwxWindows.cmake b/Modules/FindwxWindows.cmake index 76eb6be..115cdc6 100644 --- a/Modules/FindwxWindows.cmake +++ b/Modules/FindwxWindows.cmake @@ -390,7 +390,7 @@ if(WIN32_STYLE_FIND) if (NOT WXWINDOWS_USE_SHARED_LIBS) set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES} - ## these ones dont seem required, in particular ctl3d32 is not neccesary (Jan Woetzel 07/2003) + ## these ones don't seem required, in particular ctl3d32 is not necessary (Jan Woetzel 07/2003) # ctl3d32 debug ${WXWINDOWS_STATIC_DEBUG_LIBRARY_ZLIB} optimized ${WXWINDOWS_STATIC_LIBRARY_ZLIB} debug ${WXWINDOWS_STATIC_DEBUG_LIBRARY_REGEX} optimized ${WXWINDOWS_STATIC_LIBRARY_REGEX} @@ -546,7 +546,7 @@ if(WIN32_STYLE_FIND) endif() - ## not neccessary in wxWindows 2.4.1 and 2.6.2 + ## not necessary in wxWindows 2.4.1 and 2.6.2 ## but it may fix a previous bug, see ## http://lists.wxwindows.org/cgi-bin/ezmlm-cgi?8:mss:37574:200305:mpdioeneabobmgjenoap option(WXWINDOWS_SET_DEFINITIONS "Set additional defines for wxWindows" OFF) @@ -617,7 +617,8 @@ else() # wx-config should be in your path anyhow, usually no need to set WXWIN or # search in ../wx or ../../wx - find_program(CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE wx-config + find_program(CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE + NAMES $ENV{WX_CONFIG} wx-config HINTS ENV WXWIN $ENV{WXWIN}/bin diff --git a/Modules/GNUInstallDirs.cmake b/Modules/GNUInstallDirs.cmake index 91361d2..9dd464c 100644 --- a/Modules/GNUInstallDirs.cmake +++ b/Modules/GNUInstallDirs.cmake @@ -205,7 +205,7 @@ if(NOT DEFINED CMAKE_INSTALL_LIBDIR OR (_libdir_set # - we are on Linux system but NOT cross-compiling # - we are NOT on debian # - we are on a 64 bits system - # reason is: amd64 ABI: http://www.x86-64.org/documentation/abi.pdf + # reason is: amd64 ABI: https://github.com/hjl-tools/x86-psABI/wiki/X86-psABI # For Debian with multiarch, use 'lib/${CMAKE_LIBRARY_ARCHITECTURE}' if # CMAKE_LIBRARY_ARCHITECTURE is set (which contains e.g. "i386-linux-gnu" # and CMAKE_INSTALL_PREFIX is "/usr" diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake index b81dd76..d397791 100644 --- a/Modules/GetPrerequisites.cmake +++ b/Modules/GetPrerequisites.cmake @@ -687,8 +687,6 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa "$ENV{VS71COMNTOOLS}/../../VC7/bin" "C:/Program Files/Microsoft Visual Studio .NET 2003/VC7/BIN" "C:/Program Files (x86)/Microsoft Visual Studio .NET 2003/VC7/BIN" - "/usr/local/bin" - "/usr/bin" ) # <setup-gp_tool-vars> diff --git a/Modules/GoogleTest.cmake b/Modules/GoogleTest.cmake index 41bd1dc..c525101 100644 --- a/Modules/GoogleTest.cmake +++ b/Modules/GoogleTest.cmake @@ -217,6 +217,14 @@ same as the Google Test name (i.e. ``suite.testcase``); see also executable is being used in multiple calls to ``gtest_discover_tests()``. Note that this variable is only available in CTest. + ``TIMEOUT num`` + Specifies how long (in seconds) CMake will wait for the test to enumerate + available tests. If the test takes longer than this, discovery (and your + build) will fail. Most test executables will enumerate their tests very + quickly, but under some exceptional circumstances, a test may require a + longer timeout. The default is 5. See also the ``TIMEOUT`` option of + :command:`execute_process`. + #]=======================================================================] #------------------------------------------------------------------------------ @@ -349,7 +357,7 @@ function(gtest_discover_tests TARGET) cmake_parse_arguments( "" "NO_PRETTY_TYPES;NO_PRETTY_VALUES" - "TEST_PREFIX;TEST_SUFFIX;WORKING_DIRECTORY;TEST_LIST" + "TEST_PREFIX;TEST_SUFFIX;WORKING_DIRECTORY;TEST_LIST;TIMEOUT" "EXTRA_ARGS;PROPERTIES" ${ARGN} ) @@ -360,10 +368,36 @@ function(gtest_discover_tests TARGET) if(NOT _TEST_LIST) set(_TEST_LIST ${TARGET}_TESTS) endif() + if(NOT _TIMEOUT) + set(_TIMEOUT 5) + endif() + + get_property( + has_counter + TARGET ${TARGET} + PROPERTY CTEST_DISCOVERED_TEST_COUNTER + SET + ) + if(has_counter) + get_property( + counter + TARGET ${TARGET} + PROPERTY CTEST_DISCOVERED_TEST_COUNTER + ) + math(EXPR counter "${counter} + 1") + else() + set(counter 1) + endif() + set_property( + TARGET ${TARGET} + PROPERTY CTEST_DISCOVERED_TEST_COUNTER + ${counter} + ) # Define rule to generate test list for aforementioned test executable - set(ctest_include_file "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_include.cmake") - set(ctest_tests_file "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_tests.cmake") + set(ctest_file_base "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}[${counter}]") + set(ctest_include_file "${ctest_file_base}_include.cmake") + set(ctest_tests_file "${ctest_file_base}_tests.cmake") get_property(crosscompiling_emulator TARGET ${TARGET} PROPERTY CROSSCOMPILING_EMULATOR @@ -384,6 +418,7 @@ function(gtest_discover_tests TARGET) -D "NO_PRETTY_VALUES=${_NO_PRETTY_VALUES}" -D "TEST_LIST=${_TEST_LIST}" -D "CTEST_FILE=${ctest_tests_file}" + -D "TEST_DISCOVERY_TIMEOUT=${_TIMEOUT}" -P "${_GOOGLETEST_DISCOVER_TESTS_SCRIPT}" VERBATIM ) diff --git a/Modules/GoogleTestAddTests.cmake b/Modules/GoogleTestAddTests.cmake index 7d0d909..5a4bdca 100644 --- a/Modules/GoogleTestAddTests.cmake +++ b/Modules/GoogleTestAddTests.cmake @@ -24,19 +24,24 @@ endfunction() # Run test executable to get list of available tests if(NOT EXISTS "${TEST_EXECUTABLE}") message(FATAL_ERROR - "Specified test executable '${TEST_EXECUTABLE}' does not exist" + "Specified test executable does not exist.\n" + " Path: '${TEST_EXECUTABLE}'" ) endif() execute_process( COMMAND ${TEST_EXECUTOR} "${TEST_EXECUTABLE}" --gtest_list_tests + TIMEOUT ${TEST_DISCOVERY_TIMEOUT} OUTPUT_VARIABLE output RESULT_VARIABLE result ) if(NOT ${result} EQUAL 0) + string(REPLACE "\n" "\n " output "${output}") message(FATAL_ERROR - "Error running test executable '${TEST_EXECUTABLE}':\n" + "Error running test executable.\n" + " Path: '${TEST_EXECUTABLE}'\n" " Result: ${result}\n" - " Output: ${output}\n" + " Output:\n" + " ${output}\n" ) endif() diff --git a/Modules/ITKCompatibility.cmake b/Modules/ITKCompatibility.cmake index fef0653..7d211b6 100644 --- a/Modules/ITKCompatibility.cmake +++ b/Modules/ITKCompatibility.cmake @@ -2,6 +2,6 @@ # file Copyright.txt or https://cmake.org/licensing for details. -# work around an old bug in ITK prior to verison 3.0 +# work around an old bug in ITK prior to version 3.0 set(TIFF_RIGHT_VERSION 1) diff --git a/Modules/InstallRequiredSystemLibraries.cmake b/Modules/InstallRequiredSystemLibraries.cmake index 1ba4877..38e0861 100644 --- a/Modules/InstallRequiredSystemLibraries.cmake +++ b/Modules/InstallRequiredSystemLibraries.cmake @@ -594,8 +594,11 @@ if(_IRSL_HAVE_Intel) endif() if(WIN32) set(__install_dirs "${_Intel_redistdir}/1033") + if(EXISTS "${_Intel_redistdir}/1041") + list(APPEND __install_dirs "${_Intel_redistdir}/1041") + endif() if(_Intel_compiler_ver VERSION_LESS 18) - list(APPEND __install_dirs "${_Intel_redistdir}/irml" "${_Intel_redistdir}/irml_c" "${_Intel_redistdir}/1041") + list(APPEND __install_dirs "${_Intel_redistdir}/irml" "${_Intel_redistdir}/irml_c") endif() foreach(__Intel_lib IN ITEMS cilkrts20.dll libchkp.dll libgfxoffload.dll libioffload_host.dll libirngmd.dll libmmd.dll libmmdd.dll libmpx.dll liboffload.dll svml_dispmd.dll) diff --git a/Modules/Platform/Darwin-NVIDIA-CUDA.cmake b/Modules/Platform/Darwin-NVIDIA-CUDA.cmake new file mode 100644 index 0000000..bec3948 --- /dev/null +++ b/Modules/Platform/Darwin-NVIDIA-CUDA.cmake @@ -0,0 +1,19 @@ +include(Platform/Darwin) + +set(__IMPLICT_LINKS ) +foreach(dir ${CMAKE_CUDA_HOST_IMPLICIT_LINK_DIRECTORIES}) + string(APPEND __IMPLICT_LINKS " -L\"${dir}\"") +endforeach() +foreach(lib ${CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES}) + if(${lib} MATCHES "/") + string(APPEND __IMPLICT_LINKS " \"${lib}\"") + else() + string(APPEND __IMPLICT_LINKS " -l${lib}") + endif() +endforeach() + +set(CMAKE_SHARED_LIBRARY_CREATE_CUDA_FLAGS "-shared -Wl,-headerpad_max_install_names") +set(CMAKE_SHARED_MODULE_CREATE_CUDA_FLAGS "-shared -Wl,-headerpad_max_install_names") + +set(CMAKE_CUDA_CREATE_SHARED_LIBRARY "<CMAKE_CUDA_HOST_LINK_LAUNCHER> <CMAKE_SHARED_LIBRARY_CUDA_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CUDA_FLAGS> -o <TARGET> <SONAME_FLAG> <TARGET_INSTALLNAME_DIR><TARGET_SONAME> <OBJECTS> <LINK_LIBRARIES>${__IMPLICT_LINKS}") +set(CMAKE_CUDA_CREATE_SHARED_MODULE "<CMAKE_CUDA_HOST_LINK_LAUNCHER> <CMAKE_SHARED_LIBRARY_CUDA_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CUDA_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>${__IMPLICT_LINKS}") diff --git a/Modules/Platform/UnixPaths.cmake b/Modules/Platform/UnixPaths.cmake index 5687653..328d3c6 100644 --- a/Modules/Platform/UnixPaths.cmake +++ b/Modules/Platform/UnixPaths.cmake @@ -69,6 +69,9 @@ list(APPEND CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES list(APPEND CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES /usr/include ) +list(APPEND CMAKE_CUDA_IMPLICIT_INCLUDE_DIRECTORIES + /usr/include + ) # Enable use of lib32 and lib64 search path variants by default. set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB32_PATHS TRUE) diff --git a/Modules/Platform/Windows-Flang-Fortran.cmake b/Modules/Platform/Windows-Flang-Fortran.cmake new file mode 100644 index 0000000..a4b1cf1 --- /dev/null +++ b/Modules/Platform/Windows-Flang-Fortran.cmake @@ -0,0 +1,3 @@ +include(Platform/Windows-MSVC) +__windows_compiler_msvc(Fortran) +set(CMAKE_Fortran_COMPILE_OBJECT "<CMAKE_Fortran_COMPILER> ${_COMPILE_Fortran} <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>") diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake index 4719563..0737c12 100644 --- a/Modules/Platform/Windows-MSVC.cmake +++ b/Modules/Platform/Windows-MSVC.cmake @@ -48,7 +48,11 @@ else() endif() if(NOT MSVC_VERSION) - if(CMAKE_C_SIMULATE_VERSION) + if("x${CMAKE_C_COMPILER_ID}" STREQUAL "xMSVC") + set(_compiler_version ${CMAKE_C_COMPILER_VERSION}) + elseif("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC") + set(_compiler_version ${CMAKE_CXX_COMPILER_VERSION}) + elseif(CMAKE_C_SIMULATE_VERSION) set(_compiler_version ${CMAKE_C_SIMULATE_VERSION}) elseif(CMAKE_CXX_SIMULATE_VERSION) set(_compiler_version ${CMAKE_CXX_SIMULATE_VERSION}) diff --git a/Modules/Qt4Macros.cmake b/Modules/Qt4Macros.cmake index 0478918..aee4028 100644 --- a/Modules/Qt4Macros.cmake +++ b/Modules/Qt4Macros.cmake @@ -151,7 +151,7 @@ macro (QT4_GENERATE_MOC infile outfile ) set(moc_target ${ARGV3}) endif() QT4_CREATE_MOC_COMMAND(${abs_infile} ${_outfile} "${moc_flags}" "" "${moc_target}") - set_source_files_properties(${outfile} PROPERTIES SKIP_AUTOMOC TRUE) # dont run automoc on this file + set_source_files_properties(${outfile} PROPERTIES SKIP_AUTOMOC TRUE) # don't run automoc on this file endmacro () diff --git a/Modules/SquishTestScript.cmake b/Modules/SquishTestScript.cmake index cfdfaec..c0e1bea 100644 --- a/Modules/SquishTestScript.cmake +++ b/Modules/SquishTestScript.cmake @@ -34,7 +34,7 @@ message(STATUS "squish_settingsgroup='${squish_settingsgroup}'") message(STATUS "squish_pre_command='${squish_pre_command}'") message(STATUS "squish_post_command='${squish_post_command}'") -# parse enviornment variables +# parse environment variables foreach(i ${squish_env_vars}) message(STATUS "parsing env var key/value pair ${i}") string(REGEX MATCH "([^=]*)=(.*)" squish_env_name ${i}) diff --git a/Modules/UseEcos.cmake b/Modules/UseEcos.cmake index 942bc38..700bfe6 100644 --- a/Modules/UseEcos.cmake +++ b/Modules/UseEcos.cmake @@ -181,7 +181,7 @@ macro(ECOS_ADD_EXECUTABLE _exe_NAME ) #the executable depends on ecos target.ld ECOS_ADD_TARGET_LIB(${ARGN}) -# when using nmake makefiles, the custom buildtype supresses the default cl.exe flags +# when using nmake makefiles, the custom buildtype suppresses the default cl.exe flags # and the rules for creating objects are adjusted for gcc set(CMAKE_BUILD_TYPE CUSTOM_ECOS_BUILD) set(CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>") diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake index 1182875..b5fc236 100644 --- a/Modules/UseJava.cmake +++ b/Modules/UseJava.cmake @@ -286,7 +286,7 @@ # # Example: # create_javadoc(my_example_doc -# PACKAGES com.exmaple.foo com.example.bar +# PACKAGES com.example.foo com.example.bar # SOURCEPATH "${CMAKE_CURRENT_SOURCE_DIR}" # CLASSPATH ${CMAKE_JAVA_INCLUDE_PATH} # WINDOWTITLE "My example" @@ -481,6 +481,8 @@ function(add_jar _TARGET_NAME) else() get_filename_component(_add_jar_OUTPUT_DIR ${_add_jar_OUTPUT_DIR} ABSOLUTE) endif() + # ensure output directory exists + file (MAKE_DIRECTORY "${_add_jar_OUTPUT_DIR}") if (_add_jar_ENTRY_POINT) set(_ENTRY_POINT_OPTION e) @@ -515,7 +517,7 @@ function(add_jar _TARGET_NAME) string(APPEND CMAKE_JAVA_INCLUDE_PATH_FINAL "${CMAKE_JAVA_INCLUDE_FLAG_SEP}${JAVA_INCLUDE_DIR}") endforeach() - set(CMAKE_JAVA_CLASS_OUTPUT_PATH "${_add_jar_OUTPUT_DIR}${CMAKE_FILES_DIRECTORY}/${_TARGET_NAME}.dir") + set(CMAKE_JAVA_CLASS_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${_TARGET_NAME}.dir") set(_JAVA_TARGET_OUTPUT_NAME "${_TARGET_NAME}.jar") if (_add_jar_OUTPUT_NAME AND _add_jar_VERSION) @@ -546,7 +548,7 @@ function(add_jar _TARGET_NAME) list(APPEND _JAVA_COMPILE_FILELISTS ${_JAVA_FULL}) elseif (_JAVA_EXT MATCHES ".java") - file(RELATIVE_PATH _JAVA_REL_BINARY_PATH ${_add_jar_OUTPUT_DIR} ${_JAVA_FULL}) + file(RELATIVE_PATH _JAVA_REL_BINARY_PATH ${CMAKE_CURRENT_BINARY_DIR} ${_JAVA_FULL}) file(RELATIVE_PATH _JAVA_REL_SOURCE_PATH ${CMAKE_CURRENT_SOURCE_DIR} ${_JAVA_FULL}) string(LENGTH ${_JAVA_REL_BINARY_PATH} _BIN_LEN) string(LENGTH ${_JAVA_REL_SOURCE_PATH} _SRC_LEN) diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake index c8b1cd7..b8bcd92 100644 --- a/Modules/UseSWIG.cmake +++ b/Modules/UseSWIG.cmake @@ -201,10 +201,32 @@ macro(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile) if(SWIG_MODULE_${name}_EXTRA_FLAGS) set(swig_extra_flags ${swig_extra_flags} ${SWIG_MODULE_${name}_EXTRA_FLAGS}) endif() + # IMPLICIT_DEPENDS below can not handle situations where a dependent file is + # removed. We need an extra step with timestamp and custom target, see #16830 + # As this is needed only for Makefile generator do it conditionally + if(CMAKE_GENERATOR MATCHES "Make") + get_filename_component(swig_generated_timestamp + "${swig_generated_file_fullname}" NAME_WE) + set(swig_gen_target gen_${swig_generated_timestamp}) + set(swig_generated_timestamp + "${swig_outdir}/${swig_generated_timestamp}.stamp") + set(swig_custom_output ${swig_generated_timestamp}) + set(swig_custom_products + BYPRODUCTS "${swig_generated_file_fullname}" ${swig_extra_generated_files}) + set(swig_timestamp_command + COMMAND ${CMAKE_COMMAND} -E touch ${swig_generated_timestamp}) + else() + set(swig_custom_output + "${swig_generated_file_fullname}" ${swig_extra_generated_files}) + set(swig_custom_products) + set(swig_timestamp_command) + endif() add_custom_command( - OUTPUT "${swig_generated_file_fullname}" ${swig_extra_generated_files} + OUTPUT ${swig_custom_output} + ${swig_custom_products} # Let's create the ${swig_outdir} at execution time, in case dir contains $(OutDir) COMMAND ${CMAKE_COMMAND} -E make_directory ${swig_outdir} + ${swig_timestamp_command} COMMAND "${SWIG_EXECUTABLE}" ARGS "-${SWIG_MODULE_${name}_SWIG_LANGUAGE_FLAG}" ${swig_source_file_flags} @@ -219,6 +241,13 @@ macro(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile) DEPENDS ${SWIG_MODULE_${name}_EXTRA_DEPS} IMPLICIT_DEPENDS CXX "${swig_source_file_fullname}" COMMENT "Swig source") + if(CMAKE_GENERATOR MATCHES "Make") + add_custom_target(${swig_gen_target} DEPENDS ${swig_generated_timestamp}) + endif() + unset(swig_generated_timestamp) + unset(swig_custom_output) + unset(swig_custom_products) + unset(swig_timestamp_command) set_source_files_properties("${swig_generated_file_fullname}" ${swig_extra_generated_files} PROPERTIES GENERATED 1) set(${outfiles} "${swig_generated_file_fullname}" ${swig_extra_generated_files}) @@ -281,6 +310,10 @@ macro(SWIG_ADD_LIBRARY name) ${_SAM_TYPE} ${swig_generated_sources} ${swig_other_sources}) + if(CMAKE_GENERATOR MATCHES "Make") + # see IMPLICIT_DEPENDS above + add_dependencies(${SWIG_MODULE_${name}_REAL_NAME} ${swig_gen_target}) + endif() if("${_SAM_TYPE}" STREQUAL "MODULE") set_target_properties(${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES NO_SONAME ON) endif() diff --git a/Modules/WriteBasicConfigVersionFile.cmake b/Modules/WriteBasicConfigVersionFile.cmake index 7c9467a..2f7c80a 100644 --- a/Modules/WriteBasicConfigVersionFile.cmake +++ b/Modules/WriteBasicConfigVersionFile.cmake @@ -11,7 +11,7 @@ # # WRITE_BASIC_CONFIG_VERSION_FILE( filename # [VERSION major.minor.patch] -# COMPATIBILITY (AnyNewerVersion|SameMajorVersion) +# COMPATIBILITY (AnyNewerVersion|SameMajorVersion|SameMinorVersion|ExactVersion) # ) # # |