diff options
Diffstat (limited to 'Modules')
214 files changed, 3228 insertions, 1528 deletions
diff --git a/Modules/CMakeASMCompiler.cmake.in b/Modules/CMakeASMCompiler.cmake.in index 3953b30..1efd9f5 100644 --- a/Modules/CMakeASMCompiler.cmake.in +++ b/Modules/CMakeASMCompiler.cmake.in @@ -6,6 +6,7 @@ set(CMAKE_RANLIB "@CMAKE_RANLIB@") set(CMAKE_ASM@ASM_DIALECT@_COMPILER_RANLIB "@_CMAKE_ASM_COMPILER_RANLIB@") set(CMAKE_LINKER "@CMAKE_LINKER@") set(CMAKE_MT "@CMAKE_MT@") +set(CMAKE_TAPI "@CMAKE_TAPI@") set(CMAKE_ASM@ASM_DIALECT@_COMPILER_LOADED 1) set(CMAKE_ASM@ASM_DIALECT@_COMPILER_ID "@_CMAKE_ASM_COMPILER_ID@") set(CMAKE_ASM@ASM_DIALECT@_COMPILER_VERSION "@_CMAKE_ASM_COMPILER_VERSION@") @@ -16,5 +17,6 @@ set(CMAKE_ASM@ASM_DIALECT@_COMPILER_ENV_VAR "@_CMAKE_ASM_COMPILER_ENV_VAR@") set(CMAKE_ASM@ASM_DIALECT@_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC) set(CMAKE_ASM@ASM_DIALECT@_LINKER_PREFERENCE 0) +set(CMAKE_ASM@ASM_DIALECT@_LINKER_DEPFILE_SUPPORTED @CMAKE_ASM_LINKER_DEPFILE_SUPPORTED@) @CMAKE_ASM_COMPILER_CUSTOM_CODE@ diff --git a/Modules/CMakeCCompiler.cmake.in b/Modules/CMakeCCompiler.cmake.in index 2b24ff2..2f0b774 100644 --- a/Modules/CMakeCCompiler.cmake.in +++ b/Modules/CMakeCCompiler.cmake.in @@ -27,6 +27,7 @@ set(CMAKE_RANLIB "@CMAKE_RANLIB@") set(CMAKE_C_COMPILER_RANLIB "@CMAKE_C_COMPILER_RANLIB@") set(CMAKE_LINKER "@CMAKE_LINKER@") set(CMAKE_MT "@CMAKE_MT@") +set(CMAKE_TAPI "@CMAKE_TAPI@") set(CMAKE_COMPILER_IS_GNUCC @CMAKE_COMPILER_IS_GNUCC@) set(CMAKE_C_COMPILER_LOADED 1) set(CMAKE_C_COMPILER_WORKS @CMAKE_C_COMPILER_WORKS@) @@ -38,6 +39,7 @@ set(CMAKE_C_COMPILER_ID_RUN 1) set(CMAKE_C_SOURCE_FILE_EXTENSIONS c;m) set(CMAKE_C_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC) set(CMAKE_C_LINKER_PREFERENCE 10) +set(CMAKE_C_LINKER_DEPFILE_SUPPORTED @CMAKE_C_LINKER_DEPFILE_SUPPORTED@) # Save compiler ABI information. set(CMAKE_C_SIZEOF_DATA_PTR "@CMAKE_C_SIZEOF_DATA_PTR@") diff --git a/Modules/CMakeCUDACompiler.cmake.in b/Modules/CMakeCUDACompiler.cmake.in index 57d595a..3c28c28 100644 --- a/Modules/CMakeCUDACompiler.cmake.in +++ b/Modules/CMakeCUDACompiler.cmake.in @@ -30,6 +30,7 @@ set(CMAKE_CUDA_COMPILER_ID_RUN 1) set(CMAKE_CUDA_SOURCE_FILE_EXTENSIONS cu) set(CMAKE_CUDA_LINKER_PREFERENCE 15) set(CMAKE_CUDA_LINKER_PREFERENCE_PROPAGATES 1) +set(CMAKE_CUDA_LINKER_DEPFILE_SUPPORTED @CMAKE_CUDA_LINKER_DEPFILE_SUPPORTED@) set(CMAKE_CUDA_SIZEOF_DATA_PTR "@CMAKE_CUDA_SIZEOF_DATA_PTR@") set(CMAKE_CUDA_COMPILER_ABI "@CMAKE_CUDA_COMPILER_ABI@") diff --git a/Modules/CMakeCUDAInformation.cmake b/Modules/CMakeCUDAInformation.cmake index dea721e..e774088 100644 --- a/Modules/CMakeCUDAInformation.cmake +++ b/Modules/CMakeCUDAInformation.cmake @@ -134,7 +134,6 @@ include(CMakeCommonLanguageInclude) # CMAKE_CUDA_CREATE_SHARED_LIBRARY # CMAKE_CUDA_CREATE_SHARED_MODULE # CMAKE_CUDA_COMPILE_WHOLE_COMPILATION -# CMAKE_CUDA_COMPILE_PTX_COMPILATION # CMAKE_CUDA_COMPILE_SEPARABLE_COMPILATION # CMAKE_CUDA_LINK_EXECUTABLE diff --git a/Modules/CMakeCXXCompiler.cmake.in b/Modules/CMakeCXXCompiler.cmake.in index 534e960..8b6f82b 100644 --- a/Modules/CMakeCXXCompiler.cmake.in +++ b/Modules/CMakeCXXCompiler.cmake.in @@ -28,6 +28,7 @@ set(CMAKE_RANLIB "@CMAKE_RANLIB@") set(CMAKE_CXX_COMPILER_RANLIB "@CMAKE_CXX_COMPILER_RANLIB@") set(CMAKE_LINKER "@CMAKE_LINKER@") set(CMAKE_MT "@CMAKE_MT@") +set(CMAKE_TAPI "@CMAKE_TAPI@") set(CMAKE_COMPILER_IS_GNUCXX @CMAKE_COMPILER_IS_GNUCXX@) set(CMAKE_CXX_COMPILER_LOADED 1) set(CMAKE_CXX_COMPILER_WORKS @CMAKE_CXX_COMPILER_WORKS@) @@ -36,7 +37,7 @@ set(CMAKE_CXX_ABI_COMPILED @CMAKE_CXX_ABI_COMPILED@) set(CMAKE_CXX_COMPILER_ENV_VAR "CXX") set(CMAKE_CXX_COMPILER_ID_RUN 1) -set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;m;mm;mpp;CPP;ixx;cppm) +set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;m;mm;mpp;CPP;ixx;cppm;ccm;cxxm;c++m) set(CMAKE_CXX_IGNORE_EXTENSIONS inl;h;hpp;HPP;H;o;O;obj;OBJ;def;DEF;rc;RC) foreach (lang C OBJC OBJCXX) @@ -49,6 +50,7 @@ endforeach() set(CMAKE_CXX_LINKER_PREFERENCE 30) set(CMAKE_CXX_LINKER_PREFERENCE_PROPAGATES 1) +set(CMAKE_CXX_LINKER_DEPFILE_SUPPORTED @CMAKE_CXX_LINKER_DEPFILE_SUPPORTED@) # Save compiler ABI information. set(CMAKE_CXX_SIZEOF_DATA_PTR "@CMAKE_CXX_SIZEOF_DATA_PTR@") diff --git a/Modules/CMakeDetermineASMCompiler.cmake b/Modules/CMakeDetermineASMCompiler.cmake index 5ec2972..8ec6c66 100644 --- a/Modules/CMakeDetermineASMCompiler.cmake +++ b/Modules/CMakeDetermineASMCompiler.cmake @@ -58,14 +58,14 @@ if(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER_ID) set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_GNU "--version") set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_GNU "(GNU assembler)|(GCC)|(Free Software Foundation)") + list(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS AppleClang ) + set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_AppleClang "--version") + set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_AppleClang "(Apple (clang|LLVM) version)") + list(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS Clang ) set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_Clang "--version") set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_Clang "(clang version)") - list(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS AppleClang ) - set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_AppleClang "--version") - set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_AppleClang "(Apple LLVM version)") - list(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS ARMClang ) set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_ARMClang "--version") set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_ARMClang "armclang") diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake index f5298df..8beebc5 100644 --- a/Modules/CMakeDetermineCCompiler.cmake +++ b/Modules/CMakeDetermineCCompiler.cmake @@ -162,7 +162,7 @@ if (NOT _CMAKE_TOOLCHAIN_PREFIX) if(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang|QCC|LCC") get_filename_component(COMPILER_BASENAME "${CMAKE_C_COMPILER}" NAME) - if (COMPILER_BASENAME MATCHES "^(.+-)?(clang|g?cc)(-cl)?(-[0-9]+(\\.[0-9]+)*)?(-[^.]+)?(\\.exe)?$") + if (COMPILER_BASENAME MATCHES "^(.+-)?(clang|g?cc)(-cl)?(-?[0-9]+(\\.[0-9]+)*)?(-[^.]+)?(\\.exe)?$") set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1}) set(_CMAKE_TOOLCHAIN_SUFFIX ${CMAKE_MATCH_4}) set(_CMAKE_COMPILER_SUFFIX ${CMAKE_MATCH_6}) diff --git a/Modules/CMakeDetermineCSharpCompiler.cmake b/Modules/CMakeDetermineCSharpCompiler.cmake index fe98469..652eb63 100644 --- a/Modules/CMakeDetermineCSharpCompiler.cmake +++ b/Modules/CMakeDetermineCSharpCompiler.cmake @@ -3,7 +3,7 @@ if(NOT ${CMAKE_GENERATOR} MATCHES "Visual Studio ([^9]|[9][0-9])") message(FATAL_ERROR - "C# is currently only supported for Microsoft Visual Studio 11 2012 and later.") + "C# is currently only supported for Microsoft Visual Studio 12 2013 and later.") endif() include(${CMAKE_ROOT}/Modules/CMakeDetermineCompiler.cmake) diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake index c4ddf75..40934ec 100644 --- a/Modules/CMakeDetermineCXXCompiler.cmake +++ b/Modules/CMakeDetermineCXXCompiler.cmake @@ -165,13 +165,13 @@ endif () if (NOT _CMAKE_TOOLCHAIN_PREFIX) - if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU|Clang|QCC|LCC") + if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|QCC|LCC") get_filename_component(COMPILER_BASENAME "${CMAKE_CXX_COMPILER}" NAME) - if (COMPILER_BASENAME MATCHES "^(.+-)?(clang\\+\\+|[gc]\\+\\+|clang-cl)(-[0-9]+(\\.[0-9]+)*)?(-[^.]+)?(\\.exe)?$") + if (COMPILER_BASENAME MATCHES "^(.+-)?(clang\\+\\+|[gc]\\+\\+|clang-cl)(-?[0-9]+(\\.[0-9]+)*)?(-[^.]+)?(\\.exe)?$") set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1}) set(_CMAKE_TOOLCHAIN_SUFFIX ${CMAKE_MATCH_3}) set(_CMAKE_COMPILER_SUFFIX ${CMAKE_MATCH_5}) - elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") + elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang") if(CMAKE_CXX_COMPILER_TARGET) set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_CXX_COMPILER_TARGET}-) endif() @@ -186,7 +186,7 @@ if (NOT _CMAKE_TOOLCHAIN_PREFIX) if ("${_CMAKE_TOOLCHAIN_PREFIX}" MATCHES "(.+-)?llvm-$") set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1}) endif () - elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "TI") + elseif(CMAKE_CXX_COMPILER_ID MATCHES "TI") # TI compilers are named e.g. cl6x, cl470 or armcl.exe get_filename_component(COMPILER_BASENAME "${CMAKE_CXX_COMPILER}" NAME) if (COMPILER_BASENAME MATCHES "^(.+)?cl([^.]+)?(\\.exe)?$") diff --git a/Modules/CMakeDetermineCompilerABI.cmake b/Modules/CMakeDetermineCompilerABI.cmake index df17796..13bfeec 100644 --- a/Modules/CMakeDetermineCompilerABI.cmake +++ b/Modules/CMakeDetermineCompilerABI.cmake @@ -181,6 +181,10 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src) endif() endif() + if(DEFINED ENV{CMAKE_${lang}_IMPLICIT_LINK_DIRECTORIES_EXCLUDE}) + list(REMOVE_ITEM implicit_dirs $ENV{CMAKE_${lang}_IMPLICIT_LINK_DIRECTORIES_EXCLUDE}) + endif() + set(CMAKE_${lang}_IMPLICIT_LINK_LIBRARIES "${implicit_libs}" PARENT_SCOPE) set(CMAKE_${lang}_IMPLICIT_LINK_DIRECTORIES "${implicit_dirs}" PARENT_SCOPE) set(CMAKE_${lang}_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "${implicit_fwks}" PARENT_SCOPE) diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 2250d63..4db9aa8 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -35,7 +35,7 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src) else(CMAKE_${lang}_FLAGS_INIT) set(CMAKE_${lang}_COMPILER_ID_FLAGS ${CMAKE_${lang}_FLAGS_INIT}) endif() - string(REPLACE " " ";" CMAKE_${lang}_COMPILER_ID_FLAGS_LIST "${CMAKE_${lang}_COMPILER_ID_FLAGS}") + separate_arguments(CMAKE_${lang}_COMPILER_ID_FLAGS_LIST NATIVE_COMMAND "${CMAKE_${lang}_COMPILER_ID_FLAGS}") # Compute the directory in which to run the test. set(CMAKE_${lang}_COMPILER_ID_DIR ${CMAKE_PLATFORM_INFO_DIR}/CompilerId${lang}) @@ -345,6 +345,7 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS} set(id_platform ${CMAKE_VS_PLATFORM_NAME}) set(id_lang "${lang}") set(id_PostBuildEvent_Command "") + set(id_api_level "") if(CMAKE_VS_PLATFORM_TOOLSET MATCHES "^[Ll][Ll][Vv][Mm](_v[0-9]+(_xp)?)?$") set(id_cl_var "ClangClExecutable") elseif(CMAKE_VS_PLATFORM_TOOLSET MATCHES "^[Cc][Ll][Aa][Nn][Gg]([Cc][Ll]$|_[0-9])") @@ -401,6 +402,9 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS} endif() endif() set(id_toolset_version_props "<Import Project=\"${CMAKE_GENERATOR_INSTANCE}\\VC\\Auxiliary\\Build${id_sep}${CMAKE_VS_PLATFORM_TOOLSET_VERSION}\\Microsoft.VCToolsVersion.${CMAKE_VS_PLATFORM_TOOLSET_VERSION}.props\" />") + if(lang STREQUAL CXX OR lang STREQUAL C) + set(id_toolset_version_props "<Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />${id_toolset_version_props}") + endif() unset(id_sep) endif() endif() @@ -427,9 +431,10 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS} set(id_system "") endif() if(id_keyword STREQUAL "Android") + set(id_api_level "<AndroidAPILevel>android-${CMAKE_SYSTEM_VERSION}</AndroidAPILevel>") if(CMAKE_GENERATOR MATCHES "Visual Studio 14") set(id_system_version "<ApplicationTypeRevision>2.0</ApplicationTypeRevision>") - elseif(CMAKE_GENERATOR MATCHES "Visual Studio 1[56]") + elseif(CMAKE_GENERATOR MATCHES "Visual Studio 1[567]") set(id_system_version "<ApplicationTypeRevision>3.0</ApplicationTypeRevision>") else() set(id_system_version "") @@ -603,6 +608,7 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS} if(CMAKE_OSX_SYSROOT) set(id_sdkroot "SDKROOT = \"${CMAKE_OSX_SYSROOT}\";") if(CMAKE_OSX_SYSROOT MATCHES "(^|/)[Ii][Pp][Hh][Oo][Nn][Ee]" OR + CMAKE_OSX_SYSROOT MATCHES "(^|/)[Xx][Rr]" OR CMAKE_OSX_SYSROOT MATCHES "(^|/)[Aa][Pp][Pp][Ll][Ee][Tt][Vv]") set(id_product_type "com.apple.product-type.bundle.unit-test") elseif(CMAKE_OSX_SYSROOT MATCHES "(^|/)[Ww][Aa][Tt][Cc][Hh]") diff --git a/Modules/CMakeDetermineHIPCompiler.cmake b/Modules/CMakeDetermineHIPCompiler.cmake index 6294d04..9a40e82 100644 --- a/Modules/CMakeDetermineHIPCompiler.cmake +++ b/Modules/CMakeDetermineHIPCompiler.cmake @@ -3,6 +3,7 @@ include(${CMAKE_ROOT}/Modules/CMakeDetermineCompiler.cmake) include(${CMAKE_ROOT}/Modules/CMakeParseImplicitLinkInfo.cmake) +include(${CMAKE_ROOT}/Modules/CMakeParseLibraryArchitecture.cmake) if( NOT ( ("${CMAKE_GENERATOR}" MATCHES "Make") OR ("${CMAKE_GENERATOR}" MATCHES "Ninja") ) ) @@ -102,13 +103,57 @@ endif() if(NOT CMAKE_HIP_COMPILER_ROCM_ROOT) message(FATAL_ERROR "Failed to find ROCm root directory.") endif() -if(NOT EXISTS "${CMAKE_HIP_COMPILER_ROCM_ROOT}/lib/cmake/hip-lang/hip-lang-config.cmake") - message(FATAL_ERROR - "The ROCm root directory:\n" - " ${CMAKE_HIP_COMPILER_ROCM_ROOT}\n" - "does not contain the HIP runtime CMake package, expected at:\n" - " ${CMAKE_HIP_COMPILER_ROCM_ROOT}/lib/cmake/hip-lang/hip-lang-config.cmake\n" + +# Normally implicit link information is not detected until +cmake_parse_implicit_link_info("${CMAKE_HIP_COMPILER_PRODUCED_OUTPUT}" + _CMAKE_HIP_COMPILER_ID_IMPLICIT_LIBS + _CMAKE_HIP_COMPILER_ID_IMPLICIT_DIRS + _CMAKE_HIP_COMPILER_ID_IMPLICIT_FWKS + _CMAKE_HIP_COMPILER_ID_IMPLICIT_LOG + "" LANGUAGE HIP) +message(CONFIGURE_LOG + "Parsed HIP implicit link information from compiler id output:\n${_CMAKE_HIP_COMPILER_ID_IMPLICIT_LOG}\n\n") +cmake_parse_library_architecture(HIP "${_CMAKE_HIP_COMPILER_ID_IMPLICIT_DIRS}" "" CMAKE_HIP_LIBRARY_ARCHITECTURE) +if(CMAKE_HIP_LIBRARY_ARCHITECTURE) + message(CONFIGURE_LOG + "Parsed HIP library architecture from compiler id output: ${CMAKE_HIP_LIBRARY_ARCHITECTURE}\n") +endif() +unset(_CMAKE_HIP_COMPILER_ID_IMPLICIT_LIBS) +unset(_CMAKE_HIP_COMPILER_ID_IMPLICIT_DIRS) +unset(_CMAKE_HIP_COMPILER_ID_IMPLICIT_FWKS) +unset(_CMAKE_HIP_COMPILER_ID_IMPLICIT_LOG) + +if(NOT CMAKE_HIP_COMPILER_ROCM_LIB) + set(_CMAKE_HIP_COMPILER_ROCM_LIB_DIRS + "${CMAKE_HIP_COMPILER_ROCM_ROOT}/lib" + "${CMAKE_HIP_COMPILER_ROCM_ROOT}/lib64" ) + if(CMAKE_HIP_LIBRARY_ARCHITECTURE) + list(APPEND _CMAKE_HIP_COMPILER_ROCM_LIB_DIRS "${CMAKE_HIP_COMPILER_ROCM_ROOT}/lib/${CMAKE_HIP_LIBRARY_ARCHITECTURE}") + endif() + foreach(dir IN LISTS _CMAKE_HIP_COMPILER_ROCM_LIB_DIRS) + if(EXISTS "${dir}/cmake/hip-lang/hip-lang-config.cmake") + set(CMAKE_HIP_COMPILER_ROCM_LIB "${dir}") + break() + endif() + endforeach() + if(NOT CMAKE_HIP_COMPILER_ROCM_LIB) + list(TRANSFORM _CMAKE_HIP_COMPILER_ROCM_LIB_DIRS APPEND "/cmake/hip-lang/hip-lang-config.cmake") + string(REPLACE ";" "\n " _CMAKE_HIP_COMPILER_ROCM_LIB_DIRS "${_CMAKE_HIP_COMPILER_ROCM_LIB_DIRS}") + message(FATAL_ERROR + "The ROCm root directory:\n" + " ${CMAKE_HIP_COMPILER_ROCM_ROOT}\n" + "does not contain the HIP runtime CMake package, expected at one of:\n" + " ${_CMAKE_HIP_COMPILER_ROCM_LIB_DIRS}\n" + ) + endif() + unset(_CMAKE_HIP_COMPILER_ROCM_LIB_DIRS) +endif() +if(CMAKE_HIP_COMPILER_ROCM_LIB MATCHES "/lib64$" AND NOT DEFINED CMAKE_SIZEOF_VOID_P) + # We have not yet determined the target ABI but we need 'find_package' to + # search lib64 directories to find hip-lang CMake package dependencies. + # This will be replaced by ABI detection later. + set(CMAKE_HIP_SIZEOF_DATA_PTR 8) endif() if (NOT _CMAKE_TOOLCHAIN_LOCATION) diff --git a/Modules/CMakeDetermineSystem.cmake b/Modules/CMakeDetermineSystem.cmake index d4dcc62..fff4e9d 100644 --- a/Modules/CMakeDetermineSystem.cmake +++ b/Modules/CMakeDetermineSystem.cmake @@ -47,6 +47,28 @@ if(CMAKE_HOST_UNIX) set(CMAKE_HOST_SYSTEM_VERSION "${_CMAKE_HOST_SYSTEM_MAJOR_VERSION}.${_CMAKE_HOST_SYSTEM_MINOR_VERSION}") unset(_CMAKE_HOST_SYSTEM_MAJOR_VERSION) unset(_CMAKE_HOST_SYSTEM_MINOR_VERSION) + elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Android") + execute_process(COMMAND getprop ro.build.version.sdk + OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_VERSION + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET) + + if(NOT DEFINED CMAKE_SYSTEM_VERSION) + set(_ANDROID_API_LEVEL_H $ENV{PREFIX}/include/android/api-level.h) + set(_ANDROID_API_REGEX "#define __ANDROID_API__ ([0-9]+)") + file(READ ${_ANDROID_API_LEVEL_H} _ANDROID_API_LEVEL_H_CONTENT) + string(REGEX MATCH ${_ANDROID_API_REGEX} _ANDROID_API_LINE "${_ANDROID_API_LEVEL_H_CONTENT}") + string(REGEX REPLACE ${_ANDROID_API_REGEX} "\\1" _ANDROID_API "${_ANDROID_API_LINE}") + if(_ANDROID_API) + set(CMAKE_SYSTEM_VERSION "${_ANDROID_API}") + endif() + + unset(_ANDROID_API_LEVEL_H) + unset(_ANDROID_API_LEVEL_H_CONTENT) + unset(_ANDROID_API_REGEX) + unset(_ANDROID_API_LINE) + unset(_ANDROID_API) + endif() else() execute_process(COMMAND ${CMAKE_UNAME} -r OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_VERSION @@ -176,6 +198,13 @@ else() set(CMAKE_SYSTEM_VERSION "${CMAKE_HOST_SYSTEM_VERSION}") endif() set(CMAKE_SYSTEM_PROCESSOR "${CMAKE_HOST_SYSTEM_PROCESSOR}") + if(CMAKE_CROSSCOMPILING) + message(AUTHOR_WARNING + "CMAKE_CROSSCOMPILING has been set by the project, toolchain file, or user. " + "CMake is resetting it to false because CMAKE_SYSTEM_NAME was not set. " + "To indicate cross compilation, only CMAKE_SYSTEM_NAME needs to be set." + ) + endif() set(CMAKE_CROSSCOMPILING FALSE) set(PRESET_CMAKE_SYSTEM_NAME FALSE) endif() diff --git a/Modules/CMakeFindBinUtils.cmake b/Modules/CMakeFindBinUtils.cmake index 2ac8879..327ef0b 100644 --- a/Modules/CMakeFindBinUtils.cmake +++ b/Modules/CMakeFindBinUtils.cmake @@ -121,9 +121,9 @@ elseif("x${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ID}" MATCHES "^xIAR$") set(_CMAKE_IAR_ITOOLS "ARM" "RX" "RH850" "RL78" "RISCV" "RISC-V" "STM8") set(_CMAKE_IAR_XTOOLS "AVR" "MSP430" "V850" "8051") - if("${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}" IN_LIST _CMAKE_IAR_ITOOLS) - string(TOLOWER "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}" _CMAKE_IAR_LOWER_ARCHITECTURE_ID) + string(TOLOWER "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}" _CMAKE_IAR_LOWER_ARCHITECTURE_ID) + if("${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}" IN_LIST _CMAKE_IAR_ITOOLS) __append_IAR_tool(AR "iarchive") __append_IAR_tool(LINKER "ilink${_CMAKE_IAR_LOWER_ARCHITECTURE_ID}") @@ -132,16 +132,21 @@ elseif("x${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ID}" MATCHES "^xIAR$") __append_IAR_tool(IAR_OBJMANIP "iobjmanip") __append_IAR_tool(IAR_SYMEXPORT "isymexport") - unset(_CMAKE_IAR_LOWER_ARCHITECTURE_ID) - elseif("${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}" IN_LIST _CMAKE_IAR_XTOOLS) __append_IAR_tool(AR "xar") - __append_IAR_tool(LINKER "xlink") + if("${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}" STREQUAL "AVR" AND + (CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_VERSION VERSION_GREATER_EQUAL 8)) + # IAR UBROF Linker V8.10+ for Microchip AVR is `xlinkavr` + __append_IAR_tool(LINKER "xlink${_CMAKE_IAR_LOWER_ARCHITECTURE_ID}") + else() + __append_IAR_tool(LINKER "xlink") + endif() else() message(FATAL_ERROR "Failed to find linker and librarian for ${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ID} on ${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}.") endif() + unset(_CMAKE_IAR_LOWER_ARCHITECTURE_ID) unset(_CMAKE_IAR_ITOOLS) unset(_CMAKE_IAR_XTOOLS) @@ -165,6 +170,7 @@ else() set(_CMAKE_READELF_NAMES "readelf") set(_CMAKE_DLLTOOL_NAMES "dlltool") set(_CMAKE_ADDR2LINE_NAMES "addr2line") + set(_CMAKE_TAPI_NAMES "tapi") # Prepend toolchain-specific names. if("${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ID}" STREQUAL Clang) @@ -173,19 +179,17 @@ else() elseif(NOT APPLE) list(PREPEND _CMAKE_LINKER_NAMES "ld.lld") endif() - if(APPLE) - # llvm-ar does not generate a symbol table that the Apple ld64 linker accepts. - # FIXME(#23333): We still need to consider 'llvm-ar' as a fallback because - # the 'APPLE' definition may be based on the host in this context, and a - # cross-compiling toolchain may not have 'ar'. - list(APPEND _CMAKE_AR_NAMES "llvm-ar") - else() + # llvm-ar does not generate a symbol table that the Apple ld64 linker accepts. + if(NOT APPLE) list(PREPEND _CMAKE_AR_NAMES "llvm-ar") endif() list(PREPEND _CMAKE_RANLIB_NAMES "llvm-ranlib") + # llvm-strip versions prior to 11 require additional flags we do not yet add. if("${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_VERSION}" VERSION_GREATER_EQUAL 11) - # llvm-strip versions prior to 11 require additional flags we do not yet add. - list(PREPEND _CMAKE_STRIP_NAMES "llvm-strip") + # llvm-strip does not seem to support chained fixup format on macOS correctly. + if(NOT APPLE) + list(PREPEND _CMAKE_STRIP_NAMES "llvm-strip") + endif() endif() list(PREPEND _CMAKE_NM_NAMES "llvm-nm") if("${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_VERSION}" VERSION_GREATER_EQUAL 9) @@ -201,7 +205,7 @@ else() list(PREPEND _CMAKE_LINKER_NAMES "armlink") endif() - list(APPEND _CMAKE_TOOL_VARS AR RANLIB STRIP LINKER NM OBJDUMP OBJCOPY READELF DLLTOOL ADDR2LINE) + list(APPEND _CMAKE_TOOL_VARS AR RANLIB STRIP LINKER NM OBJDUMP OBJCOPY READELF DLLTOOL ADDR2LINE TAPI) endif() foreach(_CMAKE_TOOL IN LISTS _CMAKE_TOOL_VARS) @@ -225,6 +229,20 @@ if(NOT CMAKE_RANLIB) set(CMAKE_RANLIB : CACHE INTERNAL "noop for ranlib") endif() +if(NOT CMAKE_TAPI) + # try to pick-up from Apple toolchain + execute_process(COMMAND xcrun --find tapi + OUTPUT_VARIABLE _xcrun_out + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET + RESULT_VARIABLE _xcrun_failed) + if(NOT _xcrun_failed AND EXISTS "${_xcrun_out}") + set_property(CACHE CMAKE_TAPI PROPERTY VALUE "${_xcrun_out}") + endif() + unset(_xcrun_out) + unset(_xcrun_failed) +endif() + if(CMAKE_PLATFORM_HAS_INSTALLNAME) find_program(CMAKE_INSTALL_NAME_TOOL NAMES ${_CMAKE_TOOLCHAIN_PREFIX}install_name_tool HINTS ${_CMAKE_TOOLCHAIN_LOCATION} NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH) diff --git a/Modules/CMakeFindKate.cmake b/Modules/CMakeFindKate.cmake index 9aaf6e5..521bc5c 100644 --- a/Modules/CMakeFindKate.cmake +++ b/Modules/CMakeFindKate.cmake @@ -3,7 +3,7 @@ # This file is included in CMakeSystemSpecificInformation.cmake if -# the Eclipse CDT4 extra generator has been selected. +# the Kate extra generator has been selected. # Try to find out how many CPUs we have and set the -j argument for make accordingly @@ -17,5 +17,9 @@ if("${_CMAKE_KATE_PROCESSOR_COUNT}" GREATER 1 AND CMAKE_HOST_UNIX AND "${CMA set(_CMAKE_KATE_INITIAL_MAKE_ARGS "-j${_CMAKE_KATE_PROCESSOR_COUNT}") endif() -# This variable is used by the Eclipse generator and appended to the make invocation commands. +# This variable is used by the Kate generator and appended to the make invocation commands. set(CMAKE_KATE_MAKE_ARGUMENTS "${_CMAKE_KATE_INITIAL_MAKE_ARGS}" CACHE STRING "Additional command line arguments when Kate invokes make. Enter e.g. -j<some_number> to get parallel builds") + + +set(CMAKE_KATE_FILES_MODE "AUTO" CACHE STRING "Option to override the version control detection and force a mode for the Kate project.") +set_property(CACHE CMAKE_KATE_FILES_MODE PROPERTY STRINGS "AUTO;SVN;GIT;LIST") diff --git a/Modules/CMakeFortranCompiler.cmake.in b/Modules/CMakeFortranCompiler.cmake.in index f52ad02..6a2be28 100644 --- a/Modules/CMakeFortranCompiler.cmake.in +++ b/Modules/CMakeFortranCompiler.cmake.in @@ -14,6 +14,7 @@ set(CMAKE_Fortran_SIMULATE_VERSION "@CMAKE_Fortran_SIMULATE_VERSION@") set(CMAKE_AR "@CMAKE_AR@") set(CMAKE_Fortran_COMPILER_AR "@CMAKE_Fortran_COMPILER_AR@") set(CMAKE_RANLIB "@CMAKE_RANLIB@") +set(CMAKE_TAPI "@CMAKE_TAPI@") set(CMAKE_Fortran_COMPILER_RANLIB "@CMAKE_Fortran_COMPILER_RANLIB@") set(CMAKE_COMPILER_IS_GNUG77 @CMAKE_COMPILER_IS_GNUG77@) set(CMAKE_Fortran_COMPILER_LOADED 1) @@ -25,9 +26,10 @@ set(CMAKE_Fortran_COMPILER_ENV_VAR "FC") set(CMAKE_Fortran_COMPILER_SUPPORTS_F90 @CMAKE_Fortran_COMPILER_SUPPORTS_F90@) set(CMAKE_Fortran_COMPILER_ID_RUN 1) -set(CMAKE_Fortran_SOURCE_FILE_EXTENSIONS f;F;fpp;FPP;f77;F77;f90;F90;for;For;FOR;f95;F95@CMAKE_Fortran_VENDOR_SOURCE_FILE_EXTENSIONS@) +set(CMAKE_Fortran_SOURCE_FILE_EXTENSIONS f;F;fpp;FPP;f77;F77;f90;F90;for;For;FOR;f95;F95;f03;F03;f08;F08@CMAKE_Fortran_VENDOR_SOURCE_FILE_EXTENSIONS@) set(CMAKE_Fortran_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC) set(CMAKE_Fortran_LINKER_PREFERENCE 20) +set(CMAKE_Fortran_LINKER_DEPFILE_SUPPORTED @CMAKE_Fortran_LINKER_DEPFILE_SUPPORTED@) if(UNIX) set(CMAKE_Fortran_OUTPUT_EXTENSION .o) else() diff --git a/Modules/CMakeHIPCompiler.cmake.in b/Modules/CMakeHIPCompiler.cmake.in index ce4e2cf..0fa5bf0 100644 --- a/Modules/CMakeHIPCompiler.cmake.in +++ b/Modules/CMakeHIPCompiler.cmake.in @@ -18,6 +18,7 @@ set(CMAKE_HIP_SIMULATE_VERSION "@CMAKE_HIP_SIMULATE_VERSION@") @SET_MSVC_HIP_ARCHITECTURE_ID@ @_SET_CMAKE_HIP_COMPILER_SYSROOT@ set(CMAKE_HIP_COMPILER_ROCM_ROOT "@CMAKE_HIP_COMPILER_ROCM_ROOT@") +set(CMAKE_HIP_COMPILER_ROCM_LIB "@CMAKE_HIP_COMPILER_ROCM_LIB@") set(CMAKE_HIP_COMPILER_ENV_VAR "HIPCXX") @@ -26,6 +27,7 @@ set(CMAKE_HIP_COMPILER_ID_RUN 1) set(CMAKE_HIP_SOURCE_FILE_EXTENSIONS hip) set(CMAKE_HIP_LINKER_PREFERENCE 90) set(CMAKE_HIP_LINKER_PREFERENCE_PROPAGATES 1) +set(CMAKE_HIP_LINKER_DEPFILE_SUPPORTED @CMAKE_HIP_LINKER_DEPFILE_SUPPORTED@) set(CMAKE_HIP_SIZEOF_DATA_PTR "@CMAKE_HIP_SIZEOF_DATA_PTR@") set(CMAKE_HIP_COMPILER_ABI "@CMAKE_HIP_COMPILER_ABI@") @@ -58,3 +60,4 @@ set(CMAKE_RANLIB "@CMAKE_RANLIB@") set(CMAKE_HIP_COMPILER_RANLIB "@CMAKE_HIP_COMPILER_RANLIB@") set(CMAKE_LINKER "@CMAKE_LINKER@") set(CMAKE_MT "@CMAKE_MT@") +set(CMAKE_TAPI "@CMAKE_TAPI@") diff --git a/Modules/CMakeHIPInformation.cmake b/Modules/CMakeHIPInformation.cmake index 33f8697..41a98db 100644 --- a/Modules/CMakeHIPInformation.cmake +++ b/Modules/CMakeHIPInformation.cmake @@ -142,7 +142,7 @@ set(CMAKE_HIP_INFORMATION_LOADED 1) # Load the file and find the relevant HIP runtime. if(NOT DEFINED _CMAKE_HIP_DEVICE_RUNTIME_TARGET) - set(hip-lang_DIR "${CMAKE_HIP_COMPILER_ROCM_ROOT}/lib/cmake/hip-lang") + set(hip-lang_DIR "${CMAKE_HIP_COMPILER_ROCM_LIB}/cmake/hip-lang") find_package(hip-lang CONFIG QUIET NO_DEFAULT_PATH REQUIRED) endif() if(DEFINED _CMAKE_HIP_DEVICE_RUNTIME_TARGET) diff --git a/Modules/CMakeOBJCCompiler.cmake.in b/Modules/CMakeOBJCCompiler.cmake.in index 36f6ec1..de73645 100644 --- a/Modules/CMakeOBJCCompiler.cmake.in +++ b/Modules/CMakeOBJCCompiler.cmake.in @@ -25,6 +25,7 @@ set(CMAKE_RANLIB "@CMAKE_RANLIB@") set(CMAKE_OBJC_COMPILER_RANLIB "@CMAKE_OBJC_COMPILER_RANLIB@") set(CMAKE_LINKER "@CMAKE_LINKER@") set(CMAKE_MT "@CMAKE_MT@") +set(CMAKE_TAPI "@CMAKE_TAPI@") set(CMAKE_COMPILER_IS_GNUOBJC @CMAKE_COMPILER_IS_GNUOBJC@) set(CMAKE_OBJC_COMPILER_LOADED 1) set(CMAKE_OBJC_COMPILER_WORKS @CMAKE_OBJC_COMPILER_WORKS@) @@ -36,6 +37,7 @@ set(CMAKE_OBJC_COMPILER_ID_RUN 1) set(CMAKE_OBJC_SOURCE_FILE_EXTENSIONS m) set(CMAKE_OBJC_IGNORE_EXTENSIONS h;H;o;O) set(CMAKE_OBJC_LINKER_PREFERENCE 5) +set(CMAKE_OBJC_LINKER_DEPFILE_SUPPORTED @CMAKE_OBJC_LINKER_DEPFILE_SUPPORTED@) foreach (lang C CXX OBJCXX) foreach(extension IN LISTS CMAKE_OBJC_SOURCE_FILE_EXTENSIONS) diff --git a/Modules/CMakeOBJCXXCompiler.cmake.in b/Modules/CMakeOBJCXXCompiler.cmake.in index 4f27100..94d24ff 100644 --- a/Modules/CMakeOBJCXXCompiler.cmake.in +++ b/Modules/CMakeOBJCXXCompiler.cmake.in @@ -26,6 +26,7 @@ set(CMAKE_RANLIB "@CMAKE_RANLIB@") set(CMAKE_OBJCXX_COMPILER_RANLIB "@CMAKE_OBJCXX_COMPILER_RANLIB@") set(CMAKE_LINKER "@CMAKE_LINKER@") set(CMAKE_MT "@CMAKE_MT@") +set(CMAKE_TAPI "@CMAKE_TAPI@") set(CMAKE_COMPILER_IS_GNUOBJCXX @CMAKE_COMPILER_IS_GNUOBJCXX@) set(CMAKE_OBJCXX_COMPILER_LOADED 1) set(CMAKE_OBJCXX_COMPILER_WORKS @CMAKE_OBJCXX_COMPILER_WORKS@) @@ -53,6 +54,7 @@ endforeach() set(CMAKE_OBJCXX_LINKER_PREFERENCE 25) set(CMAKE_OBJCXX_LINKER_PREFERENCE_PROPAGATES 1) +set(CMAKE_OBJCXX_LINKER_DEPFILE_SUPPORTED @CMAKE_OBJCXX_LINKER_DEPFILE_SUPPORTED@) # Save compiler ABI information. set(CMAKE_OBJCXX_SIZEOF_DATA_PTR "@CMAKE_OBJCXX_SIZEOF_DATA_PTR@") diff --git a/Modules/CMakePackageConfigHelpers.cmake b/Modules/CMakePackageConfigHelpers.cmake index 1dc850a..581e65c 100644 --- a/Modules/CMakePackageConfigHelpers.cmake +++ b/Modules/CMakePackageConfigHelpers.cmake @@ -188,7 +188,7 @@ 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. +point to create more sophisticated custom ``ConfigVersion.cmake`` files. Example Generating Package Files ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/Modules/CMakeSwiftInformation.cmake b/Modules/CMakeSwiftInformation.cmake index f524955..1c6f0df 100644 --- a/Modules/CMakeSwiftInformation.cmake +++ b/Modules/CMakeSwiftInformation.cmake @@ -21,7 +21,8 @@ set(CMAKE_INCLUDE_FLAG_Swift "-I ") # FIXME: Move compiler- and platform-specific flags to the above-included modules. if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" OR CMAKE_SYSTEM_NAME STREQUAL "iOS" - OR CMAKE_SYSTEM_NAME STREQUAL "tvOS" OR CMAKE_SYSTEM_NAME STREQUAL "watchOS") + OR CMAKE_SYSTEM_NAME STREQUAL "tvOS" OR CMAKE_SYSTEM_NAME STREQUAL "visionOS" + OR CMAKE_SYSTEM_NAME STREQUAL "watchOS") set(CMAKE_SHARED_LIBRARY_SONAME_Swift_FLAG "-Xlinker -install_name -Xlinker ") elseif(NOT CMAKE_SYSTEM_NAME STREQUAL Windows) set(CMAKE_SHARED_LIBRARY_SONAME_Swift_FLAG "-Xlinker -soname -Xlinker ") @@ -30,7 +31,8 @@ if(NOT CMAKE_SYSTEM_NAME STREQUAL Windows) set(CMAKE_EXECUTABLE_RUNTIME_Swift_FLAG "-Xlinker -rpath -Xlinker ") set(CMAKE_SHARED_LIBRARY_RUNTIME_Swift_FLAG "-Xlinker -rpath -Xlinker ") if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" OR CMAKE_SYSTEM_NAME STREQUAL "iOS" - OR CMAKE_SYSTEM_NAME STREQUAL "tvOS" OR CMAKE_SYSTEM_NAME STREQUAL "watchOS") + OR CMAKE_SYSTEM_NAME STREQUAL "tvOS" OR CMAKE_SYSTEM_NAME STREQUAL "visionOS" + OR CMAKE_SYSTEM_NAME STREQUAL "watchOS") set(CMAKE_EXECUTABLE_RUNTIME_Swift_FLAG_SEP "") set(CMAKE_SHARED_LIBRARY_RUNTIME_Swift_FLAG_SEP "") else() @@ -72,9 +74,9 @@ if(CMAKE_GENERATOR STREQUAL "Xcode") # these options here will have no effect when compiling with the built-in driver, # and will explode violently, leaving build products in the source directory, when # using the old swift driver. - set(CMAKE_Swift_FLAGS_DEBUG_INIT "-Onone -g") + set(CMAKE_Swift_FLAGS_DEBUG_INIT "-Onone -g ${CMAKE_Swift_FLAGS_DEBUG_LINKER_FLAGS}") set(CMAKE_Swift_FLAGS_RELEASE_INIT "-O") - set(CMAKE_Swift_FLAGS_RELWITHDEBINFO_INIT "-O -g") + set(CMAKE_Swift_FLAGS_RELWITHDEBINFO_INIT "-O -g ${CMAKE_Swift_FLAGS_RELWITHDEBINFO_LINKER_FLAGS}") set(CMAKE_Swift_FLAGS_MINSIZEREL_INIT "-Osize") else() set(CMAKE_Swift_FLAGS_DEBUG_INIT "-Onone -g -incremental") diff --git a/Modules/CMakeSystemSpecificInformation.cmake b/Modules/CMakeSystemSpecificInformation.cmake index b5dc8d3..70bcf5c 100644 --- a/Modules/CMakeSystemSpecificInformation.cmake +++ b/Modules/CMakeSystemSpecificInformation.cmake @@ -6,19 +6,6 @@ # It is included after the compiler has been determined, so # we know things like the compiler name and if the compiler is gnu. -# before cmake 2.6 these variables were set in cmMakefile.cxx. This is still -# done to keep scripts and custom language and compiler modules working. -# But they are reset here and set again in the platform files for the target -# platform, so they can be used for testing the target platform instead -# of testing the host platform. -set(APPLE ) -set(UNIX ) -set(CYGWIN ) -set(MSYS ) -set(WIN32 ) -set(BSD ) -set(LINUX ) - function(_cmake_record_install_prefix ) set(_CMAKE_SYSTEM_PREFIX_PATH_INSTALL_PREFIX_VALUE "${CMAKE_INSTALL_PREFIX}" PARENT_SCOPE) set(_CMAKE_SYSTEM_PREFIX_PATH_STAGING_PREFIX_VALUE "${CMAKE_STAGING_PREFIX}" PARENT_SCOPE) diff --git a/Modules/CMakeSystemSpecificInitialize.cmake b/Modules/CMakeSystemSpecificInitialize.cmake index 21bcd40..ee8cb86 100644 --- a/Modules/CMakeSystemSpecificInitialize.cmake +++ b/Modules/CMakeSystemSpecificInitialize.cmake @@ -5,6 +5,19 @@ # This file is included by cmGlobalGenerator::EnableLanguage. # It is included before the compiler has been determined. +# before cmake 2.6 these variables were set in cmMakefile.cxx. This is still +# done to keep scripts and custom language and compiler modules working. +# But they are reset here and set again in the platform files for the target +# platform, so they can be used for testing the target platform instead +# of testing the host platform. +unset(APPLE) +unset(UNIX) +unset(CYGWIN) +unset(MSYS) +unset(WIN32) +unset(BSD) +unset(LINUX) + # The CMAKE_EFFECTIVE_SYSTEM_NAME is used to load compiler and compiler # wrapper configuration files. By default it equals to CMAKE_SYSTEM_NAME # but could be overridden in the ${CMAKE_SYSTEM_NAME}-Initialize files. @@ -12,7 +25,7 @@ # It is useful to share the same aforementioned configuration files and # avoids duplicating them in case of tightly related platforms. # -# An example are the platforms supported by Xcode (macOS, iOS, tvOS, +# An example are the platforms supported by Xcode (macOS, iOS, tvOS, visionOS # and watchOS). For all of those the CMAKE_EFFECTIVE_SYSTEM_NAME is # set to Apple which results in using # Platform/Apple-AppleClang-CXX.cmake for the Apple C++ compiler. diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake index f9cf33f..ff1cb7e 100644 --- a/Modules/CPack.cmake +++ b/Modules/CPack.cmake @@ -262,8 +262,8 @@ installers. The most commonly-used variables are: Lists each of the executables and associated text label to be used to create Start Menu shortcuts. For example, setting this to the list ``ccmake;CMake`` will create a shortcut named "CMake" that will execute the - installed executable :program:`ccmake`. Not all CPack generators use it (at least - NSIS, and WIX do). + installed executable :program:`ccmake`. Not all CPack generators use it (at least + NSIS, Inno Setup and WIX do). .. variable:: CPACK_STRIP_FILES @@ -738,14 +738,16 @@ if(NOT CPACK_GENERATOR) ) endif() else() - option(CPACK_BINARY_7Z "Enable to build 7-Zip packages" OFF) - option(CPACK_BINARY_NSIS "Enable to build NSIS packages" ON) - option(CPACK_BINARY_NUGET "Enable to build NuGet packages" OFF) - option(CPACK_BINARY_WIX "Enable to build WiX packages" OFF) - option(CPACK_BINARY_ZIP "Enable to build ZIP packages" OFF) + option(CPACK_BINARY_7Z "Enable to build 7-Zip packages" OFF) + option(CPACK_BINARY_NSIS "Enable to build NSIS packages" ON) + option(CPACK_BINARY_INNOSETUP "Enable to build Inno Setup packages" OFF) + option(CPACK_BINARY_NUGET "Enable to build NuGet packages" OFF) + option(CPACK_BINARY_WIX "Enable to build WiX packages" OFF) + option(CPACK_BINARY_ZIP "Enable to build ZIP packages" OFF) mark_as_advanced( CPACK_BINARY_7Z CPACK_BINARY_NSIS + CPACK_BINARY_INNOSETUP CPACK_BINARY_NUGET CPACK_BINARY_WIX CPACK_BINARY_ZIP @@ -762,6 +764,7 @@ if(NOT CPACK_GENERATOR) cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_FREEBSD FREEBSD) cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_IFW IFW) cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_NSIS NSIS) + cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_INNOSETUP INNOSETUP) cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_NUGET NuGet) cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_PRODUCTBUILD productbuild) cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_RPM RPM) @@ -869,6 +872,13 @@ if(NOT DEFINED CPACK_DMG_SLA_USE_RESOURCE_FILE_LICENSE unset(_CPack_CMP0133) endif() +# Inno Setup specific variables +if(CMAKE_SIZEOF_VOID_P EQUAL 4) + _cpack_set_default(CPACK_INNOSETUP_ARCHITECTURE "x86") +elseif(CMAKE_SIZEOF_VOID_P EQUAL 8) + _cpack_set_default(CPACK_INNOSETUP_ARCHITECTURE "x64") +endif() + # WiX specific variables _cpack_set_default(CPACK_WIX_SIZEOF_VOID_P "${CMAKE_SIZEOF_VOID_P}") diff --git a/Modules/CPackComponent.cmake b/Modules/CPackComponent.cmake index 529f4e7..3b23b9f 100644 --- a/Modules/CPackComponent.cmake +++ b/Modules/CPackComponent.cmake @@ -149,7 +149,7 @@ installed or not. REQUIRED indicates that this component is required, and therefore will always be installed. It will be visible in the graphical installer, but it cannot be unselected. (Typically, required components are -shown greyed out). +shown grayed out). DISABLED indicates that this component should be disabled (unselected) by default. The user is free to select this component for diff --git a/Modules/CPackIFW.cmake b/Modules/CPackIFW.cmake index d4e02f1..2338b79 100644 --- a/Modules/CPackIFW.cmake +++ b/Modules/CPackIFW.cmake @@ -8,7 +8,7 @@ CPackIFW .. versionadded:: 3.1 This module looks for the location of the command-line utilities supplied with the -`Qt Installer Framework <http://doc.qt.io/qtinstallerframework/index.html>`_ +`Qt Installer Framework <https://doc.qt.io/qtinstallerframework/index.html>`_ (QtIFW). The module also defines several commands to control the behavior of the diff --git a/Modules/CTestTargets.cmake b/Modules/CTestTargets.cmake index b91b48e..99ef8e5 100644 --- a/Modules/CTestTargets.cmake +++ b/Modules/CTestTargets.cmake @@ -41,7 +41,7 @@ set(__conf_types "") get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) if(_isMultiConfig) # We need to pass the configuration type on the test command line. - set(__conf_types -C "${CMAKE_CFG_INTDIR}") + set(__conf_types -C "$<CONFIG>") endif() # Add convenience targets. Do this at most once in case of nested diff --git a/Modules/CheckCCompilerFlag.cmake b/Modules/CheckCCompilerFlag.cmake index 335b437..12b0976 100644 --- a/Modules/CheckCCompilerFlag.cmake +++ b/Modules/CheckCCompilerFlag.cmake @@ -11,31 +11,46 @@ Check whether the C compiler supports a given flag. .. code-block:: cmake - check_c_compiler_flag(<flag> <var>) + check_c_compiler_flag(<flag> <resultVar>) Check that the ``<flag>`` is accepted by the compiler without a diagnostic. Stores the result in an internal cache entry - named ``<var>``. - -This command temporarily sets the ``CMAKE_REQUIRED_DEFINITIONS`` variable -and calls the ``check_c_source_compiles`` macro from the -:module:`CheckCSourceCompiles` module. See documentation of that -module for a listing of variables that can otherwise modify the build. + named ``<resultVar>``. A positive result from this check indicates only that the compiler did not issue a diagnostic message when given the flag. Whether the flag has any effect or even a specific one is beyond the scope of this module. -.. note:: - Since the :command:`try_compile` command forwards flags from variables - like :variable:`CMAKE_C_FLAGS <CMAKE_<LANG>_FLAGS>`, unknown flags - in such variables may cause a false negative for this check. +The check is only performed once, with the result cached in the variable named +by ``<resultVar>``. Every subsequent CMake run will re-use this cached value +rather than performing the check again, even if the ``<code>`` changes. In +order to force the check to be re-evaluated, the variable named by +``<resultVar>`` must be manually removed from the cache. + +The compile and link commands can be influenced by setting any of the +following variables prior to calling ``check_c_compiler_flag()`` + +.. include:: /module/CMAKE_REQUIRED_FLAGS.txt + +.. include:: /module/CMAKE_REQUIRED_DEFINITIONS.txt + +.. include:: /module/CMAKE_REQUIRED_INCLUDES.txt + +.. include:: /module/CMAKE_REQUIRED_LINK_OPTIONS.txt + +.. include:: /module/CMAKE_REQUIRED_LIBRARIES.txt + +.. include:: /module/CMAKE_REQUIRED_QUIET.txt + #]=======================================================================] include_guard(GLOBAL) -include(CheckCSourceCompiles) include(Internal/CheckCompilerFlag) macro (CHECK_C_COMPILER_FLAG _FLAG _RESULT) cmake_check_compiler_flag(C "${_FLAG}" ${_RESULT}) endmacro () + +# FIXME(#24994): The following module is included only for compatibility +# with projects that accidentally relied on it with CMake 3.26 and below. +include(CheckCSourceCompiles) diff --git a/Modules/CheckCSourceCompiles.cmake b/Modules/CheckCSourceCompiles.cmake index b24da49..ce4719a 100644 --- a/Modules/CheckCSourceCompiles.cmake +++ b/Modules/CheckCSourceCompiles.cmake @@ -22,51 +22,27 @@ Check if given C source compiles and links into an executable. checking if anything in the output matches any of the specified regular expressions. - The underlying check is performed by the :command:`try_compile` command. The - compile and link commands can be influenced by setting any of the following - variables prior to calling ``check_c_source_compiles()``: - - ``CMAKE_REQUIRED_FLAGS`` - Additional flags to pass to the compiler. Note that the contents of - :variable:`CMAKE_C_FLAGS <CMAKE_<LANG>_FLAGS>` and its associated - configuration-specific variable are automatically added to the compiler - command before the contents of ``CMAKE_REQUIRED_FLAGS``. - - ``CMAKE_REQUIRED_DEFINITIONS`` - A :ref:`;-list <CMake Language Lists>` of compiler definitions of the form - ``-DFOO`` or ``-DFOO=bar``. A definition for the name specified by - ``<resultVar>`` will also be added automatically. - - ``CMAKE_REQUIRED_INCLUDES`` - A :ref:`;-list <CMake Language Lists>` of header search paths to pass to - the compiler. These will be the only header search paths used by - ``try_compile()``, i.e. the contents of the :prop_dir:`INCLUDE_DIRECTORIES` - directory property will be ignored. - - ``CMAKE_REQUIRED_LINK_OPTIONS`` - .. versionadded:: 3.14 - - A :ref:`;-list <CMake Language Lists>` of options to add to the link - command (see :command:`try_compile` for further details). - - ``CMAKE_REQUIRED_LIBRARIES`` - A :ref:`;-list <CMake Language Lists>` of libraries to add to the link - command. These can be the name of system libraries or they can be - :ref:`Imported Targets <Imported Targets>` (see :command:`try_compile` for - further details). - - ``CMAKE_REQUIRED_QUIET`` - .. versionadded:: 3.1 - - If this variable evaluates to a boolean true value, all status messages - associated with the check will be suppressed. - - The check is only performed once, with the result cached in the variable - named by ``<resultVar>``. Every subsequent CMake run will re-use this cached - value rather than performing the check again, even if the ``<code>`` changes. - In order to force the check to be re-evaluated, the variable named by + The check is only performed once, with the result cached in the variable named + by ``<resultVar>``. Every subsequent CMake run will re-use this cached value + rather than performing the check again, even if the ``<code>`` changes. In + order to force the check to be re-evaluated, the variable named by ``<resultVar>`` must be manually removed from the cache. + The compile and link commands can be influenced by setting any of the + following variables prior to calling ``check_c_source_compiles()``: + +.. include:: /module/CMAKE_REQUIRED_FLAGS.txt + +.. include:: /module/CMAKE_REQUIRED_DEFINITIONS.txt + +.. include:: /module/CMAKE_REQUIRED_INCLUDES.txt + +.. include:: /module/CMAKE_REQUIRED_LINK_OPTIONS.txt + +.. include:: /module/CMAKE_REQUIRED_LIBRARIES.txt + +.. include:: /module/CMAKE_REQUIRED_QUIET.txt + #]=======================================================================] include_guard(GLOBAL) diff --git a/Modules/CheckCSourceRuns.cmake b/Modules/CheckCSourceRuns.cmake index a6081ff..d5a8fda 100644 --- a/Modules/CheckCSourceRuns.cmake +++ b/Modules/CheckCSourceRuns.cmake @@ -21,51 +21,27 @@ subsequently be run. be set to 1, otherwise it will be set to an value that evaluates to boolean false (e.g. an empty string or an error message). - The underlying check is performed by the :command:`try_run` command. The - compile and link commands can be influenced by setting any of the following - variables prior to calling ``check_c_source_runs()``: - - ``CMAKE_REQUIRED_FLAGS`` - Additional flags to pass to the compiler. Note that the contents of - :variable:`CMAKE_C_FLAGS <CMAKE_<LANG>_FLAGS>` and its associated - configuration-specific variable are automatically added to the compiler - command before the contents of ``CMAKE_REQUIRED_FLAGS``. - - ``CMAKE_REQUIRED_DEFINITIONS`` - A :ref:`;-list <CMake Language Lists>` of compiler definitions of the form - ``-DFOO`` or ``-DFOO=bar``. A definition for the name specified by - ``<resultVar>`` will also be added automatically. - - ``CMAKE_REQUIRED_INCLUDES`` - A :ref:`;-list <CMake Language Lists>` of header search paths to pass to - the compiler. These will be the only header search paths used by - ``try_run()``, i.e. the contents of the :prop_dir:`INCLUDE_DIRECTORIES` - directory property will be ignored. - - ``CMAKE_REQUIRED_LINK_OPTIONS`` - .. versionadded:: 3.14 - - A :ref:`;-list <CMake Language Lists>` of options to add to the link - command (see :command:`try_run` for further details). - - ``CMAKE_REQUIRED_LIBRARIES`` - A :ref:`;-list <CMake Language Lists>` of libraries to add to the link - command. These can be the name of system libraries or they can be - :ref:`Imported Targets <Imported Targets>` (see :command:`try_run` for - further details). - - ``CMAKE_REQUIRED_QUIET`` - .. versionadded:: 3.1 - - If this variable evaluates to a boolean true value, all status messages - associated with the check will be suppressed. - - The check is only performed once, with the result cached in the variable - named by ``<resultVar>``. Every subsequent CMake run will re-use this cached - value rather than performing the check again, even if the ``<code>`` changes. - In order to force the check to be re-evaluated, the variable named by + The check is only performed once, with the result cached in the variable named + by ``<resultVar>``. Every subsequent CMake run will re-use this cached value + rather than performing the check again, even if the ``<code>`` changes. In + order to force the check to be re-evaluated, the variable named by ``<resultVar>`` must be manually removed from the cache. + The compile and link commands can be influenced by setting any of the + following variables prior to calling ``check_c_source_runs()``: + +.. include:: /module/CMAKE_REQUIRED_FLAGS.txt + +.. include:: /module/CMAKE_REQUIRED_DEFINITIONS.txt + +.. include:: /module/CMAKE_REQUIRED_INCLUDES.txt + +.. include:: /module/CMAKE_REQUIRED_LINK_OPTIONS.txt + +.. include:: /module/CMAKE_REQUIRED_LIBRARIES.txt + +.. include:: /module/CMAKE_REQUIRED_QUIET.txt + #]=======================================================================] include_guard(GLOBAL) diff --git a/Modules/CheckCXXCompilerFlag.cmake b/Modules/CheckCXXCompilerFlag.cmake index 3bc3463..61ed640 100644 --- a/Modules/CheckCXXCompilerFlag.cmake +++ b/Modules/CheckCXXCompilerFlag.cmake @@ -17,11 +17,6 @@ Check whether the CXX compiler supports a given flag. a diagnostic. Stores the result in an internal cache entry named ``<var>``. -This command temporarily sets the ``CMAKE_REQUIRED_DEFINITIONS`` variable -and calls the ``check_cxx_source_compiles`` macro from the -:module:`CheckCXXSourceCompiles` module. See documentation of that -module for a listing of variables that can otherwise modify the build. - A positive result from this check indicates only that the compiler did not issue a diagnostic message when given the flag. Whether the flag has any effect or even a specific one is beyond the scope of this module. @@ -33,9 +28,12 @@ effect or even a specific one is beyond the scope of this module. #]=======================================================================] include_guard(GLOBAL) -include(CheckCXXSourceCompiles) include(Internal/CheckCompilerFlag) macro (CHECK_CXX_COMPILER_FLAG _FLAG _RESULT) cmake_check_compiler_flag(CXX "${_FLAG}" ${_RESULT}) endmacro () + +# FIXME(#24994): The following module is included only for compatibility +# with projects that accidentally relied on it with CMake 3.26 and below. +include(CheckCXXSourceCompiles) diff --git a/Modules/CheckCXXSourceCompiles.cmake b/Modules/CheckCXXSourceCompiles.cmake index 502bfa7..4b33aa8 100644 --- a/Modules/CheckCXXSourceCompiles.cmake +++ b/Modules/CheckCXXSourceCompiles.cmake @@ -22,51 +22,27 @@ Check if given C++ source compiles and links into an executable. checking if anything in the output matches any of the specified regular expressions. - The underlying check is performed by the :command:`try_compile` command. The - compile and link commands can be influenced by setting any of the following - variables prior to calling ``check_cxx_source_compiles()``: - - ``CMAKE_REQUIRED_FLAGS`` - Additional flags to pass to the compiler. Note that the contents of - :variable:`CMAKE_CXX_FLAGS <CMAKE_<LANG>_FLAGS>` and its associated - configuration-specific variable are automatically added to the compiler - command before the contents of ``CMAKE_REQUIRED_FLAGS``. - - ``CMAKE_REQUIRED_DEFINITIONS`` - A :ref:`;-list <CMake Language Lists>` of compiler definitions of the form - ``-DFOO`` or ``-DFOO=bar``. A definition for the name specified by - ``<resultVar>`` will also be added automatically. - - ``CMAKE_REQUIRED_INCLUDES`` - A :ref:`;-list <CMake Language Lists>` of header search paths to pass to - the compiler. These will be the only header search paths used by - ``try_compile()``, i.e. the contents of the :prop_dir:`INCLUDE_DIRECTORIES` - directory property will be ignored. - - ``CMAKE_REQUIRED_LINK_OPTIONS`` - .. versionadded:: 3.14 - - A :ref:`;-list <CMake Language Lists>` of options to add to the link - command (see :command:`try_compile` for further details). - - ``CMAKE_REQUIRED_LIBRARIES`` - A :ref:`;-list <CMake Language Lists>` of libraries to add to the link - command. These can be the name of system libraries or they can be - :ref:`Imported Targets <Imported Targets>` (see :command:`try_compile` for - further details). - - ``CMAKE_REQUIRED_QUIET`` - .. versionadded:: 3.1 - - If this variable evaluates to a boolean true value, all status messages - associated with the check will be suppressed. - - The check is only performed once, with the result cached in the variable - named by ``<resultVar>``. Every subsequent CMake run will re-use this cached - value rather than performing the check again, even if the ``<code>`` changes. - In order to force the check to be re-evaluated, the variable named by + The check is only performed once, with the result cached in the variable named + by ``<resultVar>``. Every subsequent CMake run will re-use this cached value + rather than performing the check again, even if the ``<code>`` changes. In + order to force the check to be re-evaluated, the variable named by ``<resultVar>`` must be manually removed from the cache. + The compile and link commands can be influenced by setting any of the + following variables prior to calling ``check_cxx_source_compiles()``: + +.. include:: /module/CMAKE_REQUIRED_FLAGS.txt + +.. include:: /module/CMAKE_REQUIRED_DEFINITIONS.txt + +.. include:: /module/CMAKE_REQUIRED_INCLUDES.txt + +.. include:: /module/CMAKE_REQUIRED_LINK_OPTIONS.txt + +.. include:: /module/CMAKE_REQUIRED_LIBRARIES.txt + +.. include:: /module/CMAKE_REQUIRED_QUIET.txt + #]=======================================================================] include_guard(GLOBAL) diff --git a/Modules/CheckCXXSourceRuns.cmake b/Modules/CheckCXXSourceRuns.cmake index af03453..3402715 100644 --- a/Modules/CheckCXXSourceRuns.cmake +++ b/Modules/CheckCXXSourceRuns.cmake @@ -21,51 +21,27 @@ subsequently be run. be set to 1, otherwise it will be set to an value that evaluates to boolean false (e.g. an empty string or an error message). - The underlying check is performed by the :command:`try_run` command. The - compile and link commands can be influenced by setting any of the following - variables prior to calling ``check_cxx_source_runs()``: - - ``CMAKE_REQUIRED_FLAGS`` - Additional flags to pass to the compiler. Note that the contents of - :variable:`CMAKE_CXX_FLAGS <CMAKE_<LANG>_FLAGS>` and its associated - configuration-specific variable are automatically added to the compiler - command before the contents of ``CMAKE_REQUIRED_FLAGS``. - - ``CMAKE_REQUIRED_DEFINITIONS`` - A :ref:`;-list <CMake Language Lists>` of compiler definitions of the form - ``-DFOO`` or ``-DFOO=bar``. A definition for the name specified by - ``<resultVar>`` will also be added automatically. - - ``CMAKE_REQUIRED_INCLUDES`` - A :ref:`;-list <CMake Language Lists>` of header search paths to pass to - the compiler. These will be the only header search paths used by - ``try_run()``, i.e. the contents of the :prop_dir:`INCLUDE_DIRECTORIES` - directory property will be ignored. - - ``CMAKE_REQUIRED_LINK_OPTIONS`` - .. versionadded:: 3.14 - - A :ref:`;-list <CMake Language Lists>` of options to add to the link - command (see :command:`try_run` for further details). - - ``CMAKE_REQUIRED_LIBRARIES`` - A :ref:`;-list <CMake Language Lists>` of libraries to add to the link - command. These can be the name of system libraries or they can be - :ref:`Imported Targets <Imported Targets>` (see :command:`try_run` for - further details). - - ``CMAKE_REQUIRED_QUIET`` - .. versionadded:: 3.1 - - If this variable evaluates to a boolean true value, all status messages - associated with the check will be suppressed. - - The check is only performed once, with the result cached in the variable - named by ``<resultVar>``. Every subsequent CMake run will re-use this cached - value rather than performing the check again, even if the ``<code>`` changes. - In order to force the check to be re-evaluated, the variable named by + The check is only performed once, with the result cached in the variable named + by ``<resultVar>``. Every subsequent CMake run will re-use this cached value + rather than performing the check again, even if the ``<code>`` changes. In + order to force the check to be re-evaluated, the variable named by ``<resultVar>`` must be manually removed from the cache. + The compile and link commands can be influenced by setting any of the + following variables prior to calling ``check_cxx_source_runs()``: + +.. include:: /module/CMAKE_REQUIRED_FLAGS.txt + +.. include:: /module/CMAKE_REQUIRED_DEFINITIONS.txt + +.. include:: /module/CMAKE_REQUIRED_INCLUDES.txt + +.. include:: /module/CMAKE_REQUIRED_LINK_OPTIONS.txt + +.. include:: /module/CMAKE_REQUIRED_LIBRARIES.txt + +.. include:: /module/CMAKE_REQUIRED_QUIET.txt + #]=======================================================================] include_guard(GLOBAL) diff --git a/Modules/CheckCXXSymbolExists.cmake b/Modules/CheckCXXSymbolExists.cmake index 1fa0898..569dafd 100644 --- a/Modules/CheckCXXSymbolExists.cmake +++ b/Modules/CheckCXXSymbolExists.cmake @@ -41,22 +41,17 @@ Check if a symbol exists as a function, variable, or macro in ``C++``. The following variables may be set before calling this macro to modify the way the check is run: -``CMAKE_REQUIRED_FLAGS`` - string of compile command line flags. -``CMAKE_REQUIRED_DEFINITIONS`` - a :ref:`;-list <CMake Language Lists>` of macros to define (-DFOO=bar). -``CMAKE_REQUIRED_INCLUDES`` - a :ref:`;-list <CMake Language Lists>` of header search paths to pass to - the compiler. -``CMAKE_REQUIRED_LINK_OPTIONS`` - .. versionadded:: 3.14 - a :ref:`;-list <CMake Language Lists>` of options to add to the link command. -``CMAKE_REQUIRED_LIBRARIES`` - a :ref:`;-list <CMake Language Lists>` of libraries to add to the link - command. See policy :policy:`CMP0075`. -``CMAKE_REQUIRED_QUIET`` - .. versionadded:: 3.1 - execute quietly without messages. +.. include:: /module/CMAKE_REQUIRED_FLAGS.txt + +.. include:: /module/CMAKE_REQUIRED_DEFINITIONS.txt + +.. include:: /module/CMAKE_REQUIRED_INCLUDES.txt + +.. include:: /module/CMAKE_REQUIRED_LINK_OPTIONS.txt + +.. include:: /module/CMAKE_REQUIRED_LIBRARIES.txt + +.. include:: /module/CMAKE_REQUIRED_QUIET.txt For example: diff --git a/Modules/CheckCompilerFlag.cmake b/Modules/CheckCompilerFlag.cmake index 77c07b9..a18435b 100644 --- a/Modules/CheckCompilerFlag.cmake +++ b/Modules/CheckCompilerFlag.cmake @@ -13,24 +13,36 @@ Check whether the compiler supports a given flag. .. code-block:: cmake - check_compiler_flag(<lang> <flag> <var>) + check_compiler_flag(<lang> <flag> <resultVar>) Check that the ``<flag>`` is accepted by the compiler without a diagnostic. -Stores the result in an internal cache entry named ``<var>``. - -This command temporarily sets the ``CMAKE_REQUIRED_DEFINITIONS`` variable -and calls the ``check_source_compiles(<LANG>)`` function from the -:module:`CheckSourceCompiles` module. See documentation of that -module for a listing of variables that can otherwise modify the build. +Stores the result in an internal cache entry named ``<resultVar>``. A positive result from this check indicates only that the compiler did not issue a diagnostic message when given the flag. Whether the flag has any effect or even a specific one is beyond the scope of this module. -.. note:: - Since the :command:`try_compile` command forwards flags from variables - like :variable:`CMAKE_<LANG>_FLAGS <CMAKE_<LANG>_FLAGS>`, unknown flags - in such variables may cause a false negative for this check. +The check is only performed once, with the result cached in the variable named +by ``<resultVar>``. Every subsequent CMake run will re-use this cached value +rather than performing the check again, even if the ``<code>`` changes. In +order to force the check to be re-evaluated, the variable named by +``<resultVar>`` must be manually removed from the cache. + +The compile and link commands can be influenced by setting any of the +following variables prior to calling ``check_compiler_flag()`` + +.. include:: /module/CMAKE_REQUIRED_FLAGS.txt + +.. include:: /module/CMAKE_REQUIRED_DEFINITIONS.txt + +.. include:: /module/CMAKE_REQUIRED_INCLUDES.txt + +.. include:: /module/CMAKE_REQUIRED_LINK_OPTIONS.txt + +.. include:: /module/CMAKE_REQUIRED_LIBRARIES.txt + +.. include:: /module/CMAKE_REQUIRED_QUIET.txt + #]=======================================================================] include_guard(GLOBAL) diff --git a/Modules/CheckFortranCompilerFlag.cmake b/Modules/CheckFortranCompilerFlag.cmake index 5b1cd02..9164565 100644 --- a/Modules/CheckFortranCompilerFlag.cmake +++ b/Modules/CheckFortranCompilerFlag.cmake @@ -13,31 +13,46 @@ Check whether the Fortran compiler supports a given flag. .. code-block:: cmake - check_fortran_compiler_flag(<flag> <var>) + check_fortran_compiler_flag(<flag> <resultVar>) Check that the ``<flag>`` is accepted by the compiler without a diagnostic. Stores the result in an internal cache entry - named ``<var>``. - -This command temporarily sets the ``CMAKE_REQUIRED_DEFINITIONS`` variable -and calls the ``check_fortran_source_compiles`` macro from the -:module:`CheckFortranSourceCompiles` module. See documentation of that -module for a listing of variables that can otherwise modify the build. + named ``<resultVar>``. A positive result from this check indicates only that the compiler did not issue a diagnostic message when given the flag. Whether the flag has any effect or even a specific one is beyond the scope of this module. -.. note:: - Since the :command:`try_compile` command forwards flags from variables - like :variable:`CMAKE_Fortran_FLAGS <CMAKE_<LANG>_FLAGS>`, unknown flags - in such variables may cause a false negative for this check. +The check is only performed once, with the result cached in the variable named +by ``<resultVar>``. Every subsequent CMake run will re-use this cached value +rather than performing the check again, even if the ``<code>`` changes. In +order to force the check to be re-evaluated, the variable named by +``<resultVar>`` must be manually removed from the cache. + +The compile and link commands can be influenced by setting any of the +following variables prior to calling ``check_fortran_compiler_flag()`` + +.. include:: /module/CMAKE_REQUIRED_FLAGS.txt + +.. include:: /module/CMAKE_REQUIRED_DEFINITIONS.txt + +.. include:: /module/CMAKE_REQUIRED_INCLUDES.txt + +.. include:: /module/CMAKE_REQUIRED_LINK_OPTIONS.txt + +.. include:: /module/CMAKE_REQUIRED_LIBRARIES.txt + +.. include:: /module/CMAKE_REQUIRED_QUIET.txt + #]=======================================================================] include_guard(GLOBAL) -include(CheckFortranSourceCompiles) include(Internal/CheckCompilerFlag) macro (CHECK_FORTRAN_COMPILER_FLAG _FLAG _RESULT) cmake_check_compiler_flag(Fortran "${_FLAG}" ${_RESULT}) endmacro () + +# FIXME(#24994): The following module is included only for compatibility +# with projects that accidentally relied on it with CMake 3.26 and below. +include(CheckFortranSourceCompiles) diff --git a/Modules/CheckFortranSourceCompiles.cmake b/Modules/CheckFortranSourceCompiles.cmake index 8dcc1d5..5158b7e 100644 --- a/Modules/CheckFortranSourceCompiles.cmake +++ b/Modules/CheckFortranSourceCompiles.cmake @@ -47,49 +47,27 @@ Check if given Fortran source compiles and links into an executable. ``SRC_EXT`` option can be used to override this with ``.<extension>`` instead-- ``.F90`` is a typical choice. - The underlying check is performed by the :command:`try_compile` command. The - compile and link commands can be influenced by setting any of the following - variables prior to calling ``check_fortran_source_compiles()``: - - ``CMAKE_REQUIRED_FLAGS`` - Additional flags to pass to the compiler. Note that the contents of - :variable:`CMAKE_Fortran_FLAGS <CMAKE_<LANG>_FLAGS>` and its associated - configuration-specific variable are automatically added to the compiler - command before the contents of ``CMAKE_REQUIRED_FLAGS``. - - ``CMAKE_REQUIRED_DEFINITIONS`` - A :ref:`;-list <CMake Language Lists>` of compiler definitions of the form - ``-DFOO`` or ``-DFOO=bar``. A definition for the name specified by - ``<resultVar>`` will also be added automatically. - - ``CMAKE_REQUIRED_INCLUDES`` - A :ref:`;-list <CMake Language Lists>` of header search paths to pass to - the compiler. These will be the only header search paths used by - ``try_compile()``, i.e. the contents of the :prop_dir:`INCLUDE_DIRECTORIES` - directory property will be ignored. - - ``CMAKE_REQUIRED_LINK_OPTIONS`` - .. versionadded:: 3.14 - - A :ref:`;-list <CMake Language Lists>` of options to add to the link - command (see :command:`try_compile` for further details). - - ``CMAKE_REQUIRED_LIBRARIES`` - A :ref:`;-list <CMake Language Lists>` of libraries to add to the link - command. These can be the name of system libraries or they can be - :ref:`Imported Targets <Imported Targets>` (see :command:`try_compile` for - further details). - - ``CMAKE_REQUIRED_QUIET`` - If this variable evaluates to a boolean true value, all status messages - associated with the check will be suppressed. - - The check is only performed once, with the result cached in the variable - named by ``<resultVar>``. Every subsequent CMake run will re-use this cached - value rather than performing the check again, even if the ``<code>`` changes. - In order to force the check to be re-evaluated, the variable named by + The check is only performed once, with the result cached in the variable named + by ``<resultVar>``. Every subsequent CMake run will re-use this cached value + rather than performing the check again, even if the ``<code>`` changes. In + order to force the check to be re-evaluated, the variable named by ``<resultVar>`` must be manually removed from the cache. + The compile and link commands can be influenced by setting any of the + following variables prior to calling ``check_fortran_source_compiles()``: + +.. include:: /module/CMAKE_REQUIRED_FLAGS.txt + +.. include:: /module/CMAKE_REQUIRED_DEFINITIONS.txt + +.. include:: /module/CMAKE_REQUIRED_INCLUDES.txt + +.. include:: /module/CMAKE_REQUIRED_LINK_OPTIONS.txt + +.. include:: /module/CMAKE_REQUIRED_LIBRARIES.txt + +.. include:: /module/CMAKE_REQUIRED_QUIET.txt + #]=======================================================================] include_guard(GLOBAL) diff --git a/Modules/CheckFortranSourceRuns.cmake b/Modules/CheckFortranSourceRuns.cmake index 985c765..f996749 100644 --- a/Modules/CheckFortranSourceRuns.cmake +++ b/Modules/CheckFortranSourceRuns.cmake @@ -43,47 +43,27 @@ subsequently be run. By default, the test source file will be given a ``.F90`` file extension. The ``SRC_EXT`` option can be used to override this with ``.<extension>`` instead. - The underlying check is performed by the :command:`try_run` command. The - compile and link commands can be influenced by setting any of the following - variables prior to calling ``check_fortran_source_runs()``: - - ``CMAKE_REQUIRED_FLAGS`` - Additional flags to pass to the compiler. Note that the contents of - :variable:`CMAKE_Fortran_FLAGS <CMAKE_<LANG>_FLAGS>` and its associated - configuration-specific variable are automatically added to the compiler - command before the contents of ``CMAKE_REQUIRED_FLAGS``. - - ``CMAKE_REQUIRED_DEFINITIONS`` - A :ref:`;-list <CMake Language Lists>` of compiler definitions of the form - ``-DFOO`` or ``-DFOO=bar``. A definition for the name specified by - ``<resultVar>`` will also be added automatically. - - ``CMAKE_REQUIRED_INCLUDES`` - A :ref:`;-list <CMake Language Lists>` of header search paths to pass to - the compiler. These will be the only header search paths used by - ``try_run()``, i.e. the contents of the :prop_dir:`INCLUDE_DIRECTORIES` - directory property will be ignored. - - ``CMAKE_REQUIRED_LINK_OPTIONS`` - A :ref:`;-list <CMake Language Lists>` of options to add to the link - command (see :command:`try_run` for further details). - - ``CMAKE_REQUIRED_LIBRARIES`` - A :ref:`;-list <CMake Language Lists>` of libraries to add to the link - command. These can be the name of system libraries or they can be - :ref:`Imported Targets <Imported Targets>` (see :command:`try_run` for - further details). - - ``CMAKE_REQUIRED_QUIET`` - If this variable evaluates to a boolean true value, all status messages - associated with the check will be suppressed. - - The check is only performed once, with the result cached in the variable - named by ``<resultVar>``. Every subsequent CMake run will re-use this cached - value rather than performing the check again, even if the ``<code>`` changes. - In order to force the check to be re-evaluated, the variable named by + The check is only performed once, with the result cached in the variable named + by ``<resultVar>``. Every subsequent CMake run will re-use this cached value + rather than performing the check again, even if the ``<code>`` changes. In + order to force the check to be re-evaluated, the variable named by ``<resultVar>`` must be manually removed from the cache. + The compile and link commands can be influenced by setting any of the + following variables prior to calling ``check_fortran_source_runs()``: + +.. include:: /module/CMAKE_REQUIRED_FLAGS.txt + +.. include:: /module/CMAKE_REQUIRED_DEFINITIONS.txt + +.. include:: /module/CMAKE_REQUIRED_INCLUDES.txt + +.. include:: /module/CMAKE_REQUIRED_LINK_OPTIONS.txt + +.. include:: /module/CMAKE_REQUIRED_LIBRARIES.txt + +.. include:: /module/CMAKE_REQUIRED_QUIET.txt + #]=======================================================================] include_guard(GLOBAL) diff --git a/Modules/CheckFunctionExists.cmake b/Modules/CheckFunctionExists.cmake index e2939ed..e7c47a4 100644 --- a/Modules/CheckFunctionExists.cmake +++ b/Modules/CheckFunctionExists.cmake @@ -20,22 +20,17 @@ Check if a C function can be linked The following variables may be set before calling this macro to modify the way the check is run: -``CMAKE_REQUIRED_FLAGS`` - string of compile command line flags. -``CMAKE_REQUIRED_DEFINITIONS`` - a :ref:`;-list <CMake Language Lists>` of macros to define (-DFOO=bar). -``CMAKE_REQUIRED_INCLUDES`` - a :ref:`;-list <CMake Language Lists>` of header search paths to pass to - the compiler. -``CMAKE_REQUIRED_LINK_OPTIONS`` - .. versionadded:: 3.14 - a :ref:`;-list <CMake Language Lists>` of options to add to the link command. -``CMAKE_REQUIRED_LIBRARIES`` - a :ref:`;-list <CMake Language Lists>` of libraries to add to the link - command. See policy :policy:`CMP0075`. -``CMAKE_REQUIRED_QUIET`` - .. versionadded:: 3.1 - execute quietly without messages. +.. include:: /module/CMAKE_REQUIRED_FLAGS.txt + +.. include:: /module/CMAKE_REQUIRED_DEFINITIONS.txt + +.. include:: /module/CMAKE_REQUIRED_INCLUDES.txt + +.. include:: /module/CMAKE_REQUIRED_LINK_OPTIONS.txt + +.. include:: /module/CMAKE_REQUIRED_LIBRARIES.txt + +.. include:: /module/CMAKE_REQUIRED_QUIET.txt .. note:: diff --git a/Modules/CheckIncludeFile.cmake b/Modules/CheckIncludeFile.cmake index 5771307..1d8c9f7 100644 --- a/Modules/CheckIncludeFile.cmake +++ b/Modules/CheckIncludeFile.cmake @@ -21,22 +21,17 @@ Provides a macro to check if a header file can be included in ``C``. The following variables may be set before calling this macro to modify the way the check is run: -``CMAKE_REQUIRED_FLAGS`` - string of compile command line flags. -``CMAKE_REQUIRED_DEFINITIONS`` - a :ref:`;-list <CMake Language Lists>` of macros to define (-DFOO=bar). -``CMAKE_REQUIRED_INCLUDES`` - a :ref:`;-list <CMake Language Lists>` of header search paths to pass to - the compiler. -``CMAKE_REQUIRED_LINK_OPTIONS`` - .. versionadded:: 3.14 - a :ref:`;-list <CMake Language Lists>` of options to add to the link command. -``CMAKE_REQUIRED_LIBRARIES`` - a :ref:`;-list <CMake Language Lists>` of libraries to add to the link - command. See policy :policy:`CMP0075`. -``CMAKE_REQUIRED_QUIET`` - .. versionadded:: 3.1 - execute quietly without messages. +.. include:: /module/CMAKE_REQUIRED_FLAGS.txt + +.. include:: /module/CMAKE_REQUIRED_DEFINITIONS.txt + +.. include:: /module/CMAKE_REQUIRED_INCLUDES.txt + +.. include:: /module/CMAKE_REQUIRED_LINK_OPTIONS.txt + +.. include:: /module/CMAKE_REQUIRED_LIBRARIES.txt + +.. include:: /module/CMAKE_REQUIRED_QUIET.txt See the :module:`CheckIncludeFiles` module to check for multiple headers at once. See the :module:`CheckIncludeFileCXX` module to check for headers diff --git a/Modules/CheckIncludeFileCXX.cmake b/Modules/CheckIncludeFileCXX.cmake index d27b485..53d9a45 100644 --- a/Modules/CheckIncludeFileCXX.cmake +++ b/Modules/CheckIncludeFileCXX.cmake @@ -21,22 +21,17 @@ Provides a macro to check if a header file can be included in ``CXX``. The following variables may be set before calling this macro to modify the way the check is run: -``CMAKE_REQUIRED_FLAGS`` - string of compile command line flags. -``CMAKE_REQUIRED_DEFINITIONS`` - a :ref:`;-list <CMake Language Lists>` of macros to define (-DFOO=bar). -``CMAKE_REQUIRED_INCLUDES`` - a :ref:`;-list <CMake Language Lists>` of header search paths to pass to - the compiler. -``CMAKE_REQUIRED_LINK_OPTIONS`` - .. versionadded:: 3.14 - a :ref:`;-list <CMake Language Lists>` of options to add to the link command. -``CMAKE_REQUIRED_LIBRARIES`` - a :ref:`;-list <CMake Language Lists>` of libraries to add to the link - command. See policy :policy:`CMP0075`. -``CMAKE_REQUIRED_QUIET`` - .. versionadded:: 3.1 - execute quietly without messages. +.. include:: /module/CMAKE_REQUIRED_FLAGS.txt + +.. include:: /module/CMAKE_REQUIRED_DEFINITIONS.txt + +.. include:: /module/CMAKE_REQUIRED_INCLUDES.txt + +.. include:: /module/CMAKE_REQUIRED_LINK_OPTIONS.txt + +.. include:: /module/CMAKE_REQUIRED_LIBRARIES.txt + +.. include:: /module/CMAKE_REQUIRED_QUIET.txt See modules :module:`CheckIncludeFile` and :module:`CheckIncludeFiles` to check for one or more ``C`` headers. diff --git a/Modules/CheckIncludeFiles.cmake b/Modules/CheckIncludeFiles.cmake index 2f50c61..071df0c 100644 --- a/Modules/CheckIncludeFiles.cmake +++ b/Modules/CheckIncludeFiles.cmake @@ -27,22 +27,17 @@ be included together. The following variables may be set before calling this macro to modify the way the check is run: -``CMAKE_REQUIRED_FLAGS`` - string of compile command line flags. -``CMAKE_REQUIRED_DEFINITIONS`` - a :ref:`;-list <CMake Language Lists>` of macros to define (-DFOO=bar). -``CMAKE_REQUIRED_INCLUDES`` - a :ref:`;-list <CMake Language Lists>` of header search paths to pass to - the compiler. -``CMAKE_REQUIRED_LINK_OPTIONS`` - .. versionadded:: 3.14 - a :ref:`;-list <CMake Language Lists>` of options to add to the link command. -``CMAKE_REQUIRED_LIBRARIES`` - a :ref:`;-list <CMake Language Lists>` of libraries to add to the link - command. See policy :policy:`CMP0075`. -``CMAKE_REQUIRED_QUIET`` - .. versionadded:: 3.1 - execute quietly without messages. +.. include:: /module/CMAKE_REQUIRED_FLAGS.txt + +.. include:: /module/CMAKE_REQUIRED_DEFINITIONS.txt + +.. include:: /module/CMAKE_REQUIRED_INCLUDES.txt + +.. include:: /module/CMAKE_REQUIRED_LINK_OPTIONS.txt + +.. include:: /module/CMAKE_REQUIRED_LIBRARIES.txt + +.. include:: /module/CMAKE_REQUIRED_QUIET.txt See modules :module:`CheckIncludeFile` and :module:`CheckIncludeFileCXX` to check for a single header file in ``C`` or ``CXX`` languages. diff --git a/Modules/CheckLanguage.cmake b/Modules/CheckLanguage.cmake index 2e56a19..69913a3 100644 --- a/Modules/CheckLanguage.cmake +++ b/Modules/CheckLanguage.cmake @@ -36,7 +36,7 @@ Example: include_guard(GLOBAL) -cmake_policy(PUSH) +block(SCOPE_FOR POLICIES) cmake_policy(SET CMP0126 NEW) macro(check_language lang) @@ -114,4 +114,4 @@ file(WRITE \"\${CMAKE_CURRENT_BINARY_DIR}/result.cmake\" endif() endmacro() -cmake_policy(POP) +endblock() diff --git a/Modules/CheckLibraryExists.cmake b/Modules/CheckLibraryExists.cmake index 5f1a914..8340500 100644 --- a/Modules/CheckLibraryExists.cmake +++ b/Modules/CheckLibraryExists.cmake @@ -26,18 +26,16 @@ Check if the function exists. The following variables may be set before calling this macro to modify the way the check is run: -``CMAKE_REQUIRED_FLAGS`` - string of compile command line flags. -``CMAKE_REQUIRED_DEFINITIONS`` - list of macros to define (-DFOO=bar). -``CMAKE_REQUIRED_LINK_OPTIONS`` - .. versionadded:: 3.14 - list of options to pass to link command. -``CMAKE_REQUIRED_LIBRARIES`` - list of libraries to link. -``CMAKE_REQUIRED_QUIET`` - .. versionadded:: 3.1 - execute quietly without messages. +.. include:: /module/CMAKE_REQUIRED_FLAGS.txt + +.. include:: /module/CMAKE_REQUIRED_DEFINITIONS.txt + +.. include:: /module/CMAKE_REQUIRED_LINK_OPTIONS.txt + +.. include:: /module/CMAKE_REQUIRED_LIBRARIES.txt + +.. include:: /module/CMAKE_REQUIRED_QUIET.txt + #]=======================================================================] include_guard(GLOBAL) diff --git a/Modules/CheckOBJCCompilerFlag.cmake b/Modules/CheckOBJCCompilerFlag.cmake index d8d8741..24bf0db 100644 --- a/Modules/CheckOBJCCompilerFlag.cmake +++ b/Modules/CheckOBJCCompilerFlag.cmake @@ -13,31 +13,46 @@ Check whether the Objective-C compiler supports a given flag. .. code-block:: cmake - check_objc_compiler_flag(<flag> <var>) + check_objc_compiler_flag(<flag> <resultVar>) Check that the ``<flag>`` is accepted by the compiler without a diagnostic. Stores the result in an internal cache entry - named ``<var>``. - -This command temporarily sets the ``CMAKE_REQUIRED_DEFINITIONS`` variable -and calls the ``check_objc_source_compiles`` macro from the -:module:`CheckOBJCSourceCompiles` module. See documentation of that -module for a listing of variables that can otherwise modify the build. + named ``<resultVar>``. A positive result from this check indicates only that the compiler did not issue a diagnostic message when given the flag. Whether the flag has any effect or even a specific one is beyond the scope of this module. -.. note:: - Since the :command:`try_compile` command forwards flags from variables - like :variable:`CMAKE_OBJC_FLAGS <CMAKE_<LANG>_FLAGS>`, unknown flags - in such variables may cause a false negative for this check. +The check is only performed once, with the result cached in the variable named +by ``<resultVar>``. Every subsequent CMake run will re-use this cached value +rather than performing the check again, even if the ``<code>`` changes. In +order to force the check to be re-evaluated, the variable named by +``<resultVar>`` must be manually removed from the cache. + +The compile and link commands can be influenced by setting any of the +following variables prior to calling ``check_objc_compiler_flag()`` + +.. include:: /module/CMAKE_REQUIRED_FLAGS.txt + +.. include:: /module/CMAKE_REQUIRED_DEFINITIONS.txt + +.. include:: /module/CMAKE_REQUIRED_INCLUDES.txt + +.. include:: /module/CMAKE_REQUIRED_LINK_OPTIONS.txt + +.. include:: /module/CMAKE_REQUIRED_LIBRARIES.txt + +.. include:: /module/CMAKE_REQUIRED_QUIET.txt + #]=======================================================================] include_guard(GLOBAL) -include(CheckOBJCSourceCompiles) include(Internal/CheckCompilerFlag) macro (CHECK_OBJC_COMPILER_FLAG _FLAG _RESULT) cmake_check_compiler_flag(OBJC "${_FLAG}" ${_RESULT}) endmacro () + +# FIXME(#24994): The following module is included only for compatibility +# with projects that accidentally relied on it with CMake 3.26 and below. +include(CheckOBJCSourceCompiles) diff --git a/Modules/CheckOBJCSourceCompiles.cmake b/Modules/CheckOBJCSourceCompiles.cmake index c268ef9..7663054 100644 --- a/Modules/CheckOBJCSourceCompiles.cmake +++ b/Modules/CheckOBJCSourceCompiles.cmake @@ -24,47 +24,27 @@ Check if given Objective-C source compiles and links into an executable. checking if anything in the output matches any of the specified regular expressions. - The underlying check is performed by the :command:`try_compile` command. The - compile and link commands can be influenced by setting any of the following - variables prior to calling ``check_objc_source_compiles()``: - - ``CMAKE_REQUIRED_FLAGS`` - Additional flags to pass to the compiler. Note that the contents of - :variable:`CMAKE_OBJC_FLAGS <CMAKE_<LANG>_FLAGS>` and its associated - configuration-specific variable are automatically added to the compiler - command before the contents of ``CMAKE_REQUIRED_FLAGS``. - - ``CMAKE_REQUIRED_DEFINITIONS`` - A :ref:`;-list <CMake Language Lists>` of compiler definitions of the form - ``-DFOO`` or ``-DFOO=bar``. A definition for the name specified by - ``<resultVar>`` will also be added automatically. - - ``CMAKE_REQUIRED_INCLUDES`` - A :ref:`;-list <CMake Language Lists>` of header search paths to pass to - the compiler. These will be the only header search paths used by - ``try_compile()``, i.e. the contents of the :prop_dir:`INCLUDE_DIRECTORIES` - directory property will be ignored. - - ``CMAKE_REQUIRED_LINK_OPTIONS`` - A :ref:`;-list <CMake Language Lists>` of options to add to the link - command (see :command:`try_compile` for further details). - - ``CMAKE_REQUIRED_LIBRARIES`` - A :ref:`;-list <CMake Language Lists>` of libraries to add to the link - command. These can be the name of system libraries or they can be - :ref:`Imported Targets <Imported Targets>` (see :command:`try_compile` for - further details). - - ``CMAKE_REQUIRED_QUIET`` - If this variable evaluates to a boolean true value, all status messages - associated with the check will be suppressed. - - The check is only performed once, with the result cached in the variable - named by ``<resultVar>``. Every subsequent CMake run will re-use this cached - value rather than performing the check again, even if the ``<code>`` changes. - In order to force the check to be re-evaluated, the variable named by + The check is only performed once, with the result cached in the variable named + by ``<resultVar>``. Every subsequent CMake run will re-use this cached value + rather than performing the check again, even if the ``<code>`` changes. In + order to force the check to be re-evaluated, the variable named by ``<resultVar>`` must be manually removed from the cache. + The compile and link commands can be influenced by setting any of the + following variables prior to calling ``check_objc_source_compiles()`` + +.. include:: /module/CMAKE_REQUIRED_FLAGS.txt + +.. include:: /module/CMAKE_REQUIRED_DEFINITIONS.txt + +.. include:: /module/CMAKE_REQUIRED_INCLUDES.txt + +.. include:: /module/CMAKE_REQUIRED_LINK_OPTIONS.txt + +.. include:: /module/CMAKE_REQUIRED_LIBRARIES.txt + +.. include:: /module/CMAKE_REQUIRED_QUIET.txt + #]=======================================================================] include_guard(GLOBAL) diff --git a/Modules/CheckOBJCSourceRuns.cmake b/Modules/CheckOBJCSourceRuns.cmake index dd03309..a23a0c7 100644 --- a/Modules/CheckOBJCSourceRuns.cmake +++ b/Modules/CheckOBJCSourceRuns.cmake @@ -23,47 +23,27 @@ subsequently be run. be set to 1, otherwise it will be set to an value that evaluates to boolean false (e.g. an empty string or an error message). - The underlying check is performed by the :command:`try_run` command. The - compile and link commands can be influenced by setting any of the following - variables prior to calling ``check_objc_source_runs()``: - - ``CMAKE_REQUIRED_FLAGS`` - Additional flags to pass to the compiler. Note that the contents of - :variable:`CMAKE_OBJC_FLAGS <CMAKE_<LANG>_FLAGS>` and its associated - configuration-specific variable are automatically added to the compiler - command before the contents of ``CMAKE_REQUIRED_FLAGS``. - - ``CMAKE_REQUIRED_DEFINITIONS`` - A :ref:`;-list <CMake Language Lists>` of compiler definitions of the form - ``-DFOO`` or ``-DFOO=bar``. A definition for the name specified by - ``<resultVar>`` will also be added automatically. - - ``CMAKE_REQUIRED_INCLUDES`` - A :ref:`;-list <CMake Language Lists>` of header search paths to pass to - the compiler. These will be the only header search paths used by - ``try_run()``, i.e. the contents of the :prop_dir:`INCLUDE_DIRECTORIES` - directory property will be ignored. - - ``CMAKE_REQUIRED_LINK_OPTIONS`` - A :ref:`;-list <CMake Language Lists>` of options to add to the link - command (see :command:`try_run` for further details). - - ``CMAKE_REQUIRED_LIBRARIES`` - A :ref:`;-list <CMake Language Lists>` of libraries to add to the link - command. These can be the name of system libraries or they can be - :ref:`Imported Targets <Imported Targets>` (see :command:`try_run` for - further details). - - ``CMAKE_REQUIRED_QUIET`` - If this variable evaluates to a boolean true value, all status messages - associated with the check will be suppressed. - - The check is only performed once, with the result cached in the variable - named by ``<resultVar>``. Every subsequent CMake run will re-use this cached - value rather than performing the check again, even if the ``<code>`` changes. - In order to force the check to be re-evaluated, the variable named by + The check is only performed once, with the result cached in the variable named + by ``<resultVar>``. Every subsequent CMake run will re-use this cached value + rather than performing the check again, even if the ``<code>`` changes. In + order to force the check to be re-evaluated, the variable named by ``<resultVar>`` must be manually removed from the cache. + The compile and link commands can be influenced by setting any of the + following variables prior to calling ``check_objc_source_runs()`` + +.. include:: /module/CMAKE_REQUIRED_FLAGS.txt + +.. include:: /module/CMAKE_REQUIRED_DEFINITIONS.txt + +.. include:: /module/CMAKE_REQUIRED_INCLUDES.txt + +.. include:: /module/CMAKE_REQUIRED_LINK_OPTIONS.txt + +.. include:: /module/CMAKE_REQUIRED_LIBRARIES.txt + +.. include:: /module/CMAKE_REQUIRED_QUIET.txt + #]=======================================================================] include_guard(GLOBAL) diff --git a/Modules/CheckOBJCXXCompilerFlag.cmake b/Modules/CheckOBJCXXCompilerFlag.cmake index 3f3f8fe..ae2d907 100644 --- a/Modules/CheckOBJCXXCompilerFlag.cmake +++ b/Modules/CheckOBJCXXCompilerFlag.cmake @@ -13,31 +13,46 @@ Check whether the Objective-C++ compiler supports a given flag. .. code-block:: cmake - check_objcxx_compiler_flag(<flag> <var>) + check_objcxx_compiler_flag(<flag> <resultVar>) Check that the ``<flag>`` is accepted by the compiler without a diagnostic. Stores the result in an internal cache entry - named ``<var>``. - -This command temporarily sets the ``CMAKE_REQUIRED_DEFINITIONS`` variable -and calls the ``check_objcxx_source_compiles`` macro from the -:module:`CheckOBJCXXSourceCompiles` module. See documentation of that -module for a listing of variables that can otherwise modify the build. + named ``<resultVar>``. A positive result from this check indicates only that the compiler did not issue a diagnostic message when given the flag. Whether the flag has any effect or even a specific one is beyond the scope of this module. -.. note:: - Since the :command:`try_compile` command forwards flags from variables - like :variable:`CMAKE_OBJCXX_FLAGS <CMAKE_<LANG>_FLAGS>`, unknown flags - in such variables may cause a false negative for this check. +The check is only performed once, with the result cached in the variable named +by ``<resultVar>``. Every subsequent CMake run will re-use this cached value +rather than performing the check again, even if the ``<code>`` changes. In +order to force the check to be re-evaluated, the variable named by +``<resultVar>`` must be manually removed from the cache. + +The compile and link commands can be influenced by setting any of the +following variables prior to calling ``check_objcxx_compiler_flag()`` + +.. include:: /module/CMAKE_REQUIRED_FLAGS.txt + +.. include:: /module/CMAKE_REQUIRED_DEFINITIONS.txt + +.. include:: /module/CMAKE_REQUIRED_INCLUDES.txt + +.. include:: /module/CMAKE_REQUIRED_LINK_OPTIONS.txt + +.. include:: /module/CMAKE_REQUIRED_LIBRARIES.txt + +.. include:: /module/CMAKE_REQUIRED_QUIET.txt + #]=======================================================================] include_guard(GLOBAL) -include(CheckOBJCXXSourceCompiles) include(Internal/CheckCompilerFlag) macro (CHECK_OBJCXX_COMPILER_FLAG _FLAG _RESULT) cmake_check_compiler_flag(OBJCXX "${_FLAG}" ${_RESULT}) endmacro () + +# FIXME(#24994): The following module is included only for compatibility +# with projects that accidentally relied on it with CMake 3.26 and below. +include(CheckOBJCXXSourceCompiles) diff --git a/Modules/CheckOBJCXXSourceCompiles.cmake b/Modules/CheckOBJCXXSourceCompiles.cmake index 1186934..cfbda3a 100644 --- a/Modules/CheckOBJCXXSourceCompiles.cmake +++ b/Modules/CheckOBJCXXSourceCompiles.cmake @@ -24,47 +24,27 @@ Check if given Objective-C++ source compiles and links into an executable. checking if anything in the output matches any of the specified regular expressions. - The underlying check is performed by the :command:`try_compile` command. The - compile and link commands can be influenced by setting any of the following - variables prior to calling ``check_objcxx_source_compiles()``: - - ``CMAKE_REQUIRED_FLAGS`` - Additional flags to pass to the compiler. Note that the contents of - :variable:`CMAKE_OBJCXX_FLAGS <CMAKE_<LANG>_FLAGS>` and its associated - configuration-specific variable are automatically added to the compiler - command before the contents of ``CMAKE_REQUIRED_FLAGS``. - - ``CMAKE_REQUIRED_DEFINITIONS`` - A :ref:`;-list <CMake Language Lists>` of compiler definitions of the form - ``-DFOO`` or ``-DFOO=bar``. A definition for the name specified by - ``<resultVar>`` will also be added automatically. - - ``CMAKE_REQUIRED_INCLUDES`` - A :ref:`;-list <CMake Language Lists>` of header search paths to pass to - the compiler. These will be the only header search paths used by - ``try_compile()``, i.e. the contents of the :prop_dir:`INCLUDE_DIRECTORIES` - directory property will be ignored. - - ``CMAKE_REQUIRED_LINK_OPTIONS`` - A :ref:`;-list <CMake Language Lists>` of options to add to the link - command (see :command:`try_compile` for further details). - - ``CMAKE_REQUIRED_LIBRARIES`` - A :ref:`;-list <CMake Language Lists>` of libraries to add to the link - command. These can be the name of system libraries or they can be - :ref:`Imported Targets <Imported Targets>` (see :command:`try_compile` for - further details). - - ``CMAKE_REQUIRED_QUIET`` - If this variable evaluates to a boolean true value, all status messages - associated with the check will be suppressed. - - The check is only performed once, with the result cached in the variable - named by ``<resultVar>``. Every subsequent CMake run will re-use this cached - value rather than performing the check again, even if the ``<code>`` changes. - In order to force the check to be re-evaluated, the variable named by + The check is only performed once, with the result cached in the variable named + by ``<resultVar>``. Every subsequent CMake run will re-use this cached value + rather than performing the check again, even if the ``<code>`` changes. In + order to force the check to be re-evaluated, the variable named by ``<resultVar>`` must be manually removed from the cache. + The compile and link commands can be influenced by setting any of the + following variables prior to calling ``check_objcxx_source_compiles()`` + +.. include:: /module/CMAKE_REQUIRED_FLAGS.txt + +.. include:: /module/CMAKE_REQUIRED_DEFINITIONS.txt + +.. include:: /module/CMAKE_REQUIRED_INCLUDES.txt + +.. include:: /module/CMAKE_REQUIRED_LINK_OPTIONS.txt + +.. include:: /module/CMAKE_REQUIRED_LIBRARIES.txt + +.. include:: /module/CMAKE_REQUIRED_QUIET.txt + #]=======================================================================] include_guard(GLOBAL) diff --git a/Modules/CheckOBJCXXSourceRuns.cmake b/Modules/CheckOBJCXXSourceRuns.cmake index 05a5e4c..b2831b6 100644 --- a/Modules/CheckOBJCXXSourceRuns.cmake +++ b/Modules/CheckOBJCXXSourceRuns.cmake @@ -23,47 +23,27 @@ subsequently be run. be set to 1, otherwise it will be set to an value that evaluates to boolean false (e.g. an empty string or an error message). - The underlying check is performed by the :command:`try_run` command. The - compile and link commands can be influenced by setting any of the following - variables prior to calling ``check_objcxx_source_runs()``: - - ``CMAKE_REQUIRED_FLAGS`` - Additional flags to pass to the compiler. Note that the contents of - :variable:`CMAKE_OBJCXX_FLAGS <CMAKE_<LANG>_FLAGS>` and its associated - configuration-specific variable are automatically added to the compiler - command before the contents of ``CMAKE_REQUIRED_FLAGS``. - - ``CMAKE_REQUIRED_DEFINITIONS`` - A :ref:`;-list <CMake Language Lists>` of compiler definitions of the form - ``-DFOO`` or ``-DFOO=bar``. A definition for the name specified by - ``<resultVar>`` will also be added automatically. - - ``CMAKE_REQUIRED_INCLUDES`` - A :ref:`;-list <CMake Language Lists>` of header search paths to pass to - the compiler. These will be the only header search paths used by - ``try_run()``, i.e. the contents of the :prop_dir:`INCLUDE_DIRECTORIES` - directory property will be ignored. - - ``CMAKE_REQUIRED_LINK_OPTIONS`` - A :ref:`;-list <CMake Language Lists>` of options to add to the link - command (see :command:`try_run` for further details). - - ``CMAKE_REQUIRED_LIBRARIES`` - A :ref:`;-list <CMake Language Lists>` of libraries to add to the link - command. These can be the name of system libraries or they can be - :ref:`Imported Targets <Imported Targets>` (see :command:`try_run` for - further details). - - ``CMAKE_REQUIRED_QUIET`` - If this variable evaluates to a boolean true value, all status messages - associated with the check will be suppressed. - - The check is only performed once, with the result cached in the variable - named by ``<resultVar>``. Every subsequent CMake run will re-use this cached - value rather than performing the check again, even if the ``<code>`` changes. - In order to force the check to be re-evaluated, the variable named by + The check is only performed once, with the result cached in the variable named + by ``<resultVar>``. Every subsequent CMake run will re-use this cached value + rather than performing the check again, even if the ``<code>`` changes. In + order to force the check to be re-evaluated, the variable named by ``<resultVar>`` must be manually removed from the cache. + The compile and link commands can be influenced by setting any of the + following variables prior to calling ``check_objcxx_source_runs()`` + +.. include:: /module/CMAKE_REQUIRED_FLAGS.txt + +.. include:: /module/CMAKE_REQUIRED_DEFINITIONS.txt + +.. include:: /module/CMAKE_REQUIRED_INCLUDES.txt + +.. include:: /module/CMAKE_REQUIRED_LINK_OPTIONS.txt + +.. include:: /module/CMAKE_REQUIRED_LIBRARIES.txt + +.. include:: /module/CMAKE_REQUIRED_QUIET.txt + #]=======================================================================] include_guard(GLOBAL) diff --git a/Modules/CheckPrototypeDefinition.cmake b/Modules/CheckPrototypeDefinition.cmake index 3d53b93..c1a7a1c 100644 --- a/Modules/CheckPrototypeDefinition.cmake +++ b/Modules/CheckPrototypeDefinition.cmake @@ -35,20 +35,18 @@ Check if the prototype we expect is correct. The following variables may be set before calling this function to modify the way the check is run: -``CMAKE_REQUIRED_FLAGS`` - string of compile command line flags. -``CMAKE_REQUIRED_DEFINITIONS`` - list of macros to define (-DFOO=bar). -``CMAKE_REQUIRED_INCLUDES`` - list of include directories. -``CMAKE_REQUIRED_LINK_OPTIONS`` - .. versionadded:: 3.14 - list of options to pass to link command. -``CMAKE_REQUIRED_LIBRARIES`` - list of libraries to link. -``CMAKE_REQUIRED_QUIET`` - .. versionadded:: 3.1 - execute quietly without messages. +.. include:: /module/CMAKE_REQUIRED_FLAGS.txt + +.. include:: /module/CMAKE_REQUIRED_DEFINITIONS.txt + +.. include:: /module/CMAKE_REQUIRED_INCLUDES.txt + +.. include:: /module/CMAKE_REQUIRED_LINK_OPTIONS.txt + +.. include:: /module/CMAKE_REQUIRED_LIBRARIES.txt + +.. include:: /module/CMAKE_REQUIRED_QUIET.txt + #]=======================================================================] # diff --git a/Modules/CheckSourceCompiles.cmake b/Modules/CheckSourceCompiles.cmake index 9788798..041b59c 100644 --- a/Modules/CheckSourceCompiles.cmake +++ b/Modules/CheckSourceCompiles.cmake @@ -47,47 +47,27 @@ Check if given source compiles and links into an executable. end program" HAVE_ERROR_STOP) - The underlying check is performed by the :command:`try_compile` command. The - compile and link commands can be influenced by setting any of the following - variables prior to calling ``check_source_compiles()``: - - ``CMAKE_REQUIRED_FLAGS`` - Additional flags to pass to the compiler. Note that the contents of - :variable:`CMAKE_<LANG>_FLAGS <CMAKE_<LANG>_FLAGS>` and its associated - configuration-specific variable are automatically added to the compiler - command before the contents of ``CMAKE_REQUIRED_FLAGS``. - - ``CMAKE_REQUIRED_DEFINITIONS`` - A :ref:`;-list <CMake Language Lists>` of compiler definitions of the form - ``-DFOO`` or ``-DFOO=bar``. A definition for the name specified by - ``<resultVar>`` will also be added automatically. - - ``CMAKE_REQUIRED_INCLUDES`` - A :ref:`;-list <CMake Language Lists>` of header search paths to pass to - the compiler. These will be the only header search paths used by - ``try_compile()``, i.e. the contents of the :prop_dir:`INCLUDE_DIRECTORIES` - directory property will be ignored. - - ``CMAKE_REQUIRED_LINK_OPTIONS`` - A :ref:`;-list <CMake Language Lists>` of options to add to the link - command (see :command:`try_compile` for further details). - - ``CMAKE_REQUIRED_LIBRARIES`` - A :ref:`;-list <CMake Language Lists>` of libraries to add to the link - command. These can be the name of system libraries or they can be - :ref:`Imported Targets <Imported Targets>` (see :command:`try_compile` for - further details). - - ``CMAKE_REQUIRED_QUIET`` - If this variable evaluates to a boolean true value, all status messages - associated with the check will be suppressed. - The check is only performed once, with the result cached in the variable named by ``<resultVar>``. Every subsequent CMake run will re-use this cached value rather than performing the check again, even if the ``<code>`` changes. In order to force the check to be re-evaluated, the variable named by ``<resultVar>`` must be manually removed from the cache. + The compile and link commands can be influenced by setting any of the + following variables prior to calling ``check_source_compiles()``: + +.. include:: /module/CMAKE_REQUIRED_FLAGS.txt + +.. include:: /module/CMAKE_REQUIRED_DEFINITIONS.txt + +.. include:: /module/CMAKE_REQUIRED_INCLUDES.txt + +.. include:: /module/CMAKE_REQUIRED_LINK_OPTIONS.txt + +.. include:: /module/CMAKE_REQUIRED_LIBRARIES.txt + +.. include:: /module/CMAKE_REQUIRED_QUIET.txt + #]=======================================================================] include_guard(GLOBAL) diff --git a/Modules/CheckSourceRuns.cmake b/Modules/CheckSourceRuns.cmake index e2fa579..822ee07 100644 --- a/Modules/CheckSourceRuns.cmake +++ b/Modules/CheckSourceRuns.cmake @@ -47,47 +47,27 @@ subsequently be run. end program" HAVE_COARRAY) - The underlying check is performed by the :command:`try_run` command. The - compile and link commands can be influenced by setting any of the following - variables prior to calling ``check_source_runs()``: - - ``CMAKE_REQUIRED_FLAGS`` - Additional flags to pass to the compiler. Note that the contents of - :variable:`CMAKE_<LANG>_FLAGS <CMAKE_<LANG>_FLAGS>` and its associated - configuration-specific variable are automatically added to the compiler - command before the contents of ``CMAKE_REQUIRED_FLAGS``. - - ``CMAKE_REQUIRED_DEFINITIONS`` - A :ref:`;-list <CMake Language Lists>` of compiler definitions of the form - ``-DFOO`` or ``-DFOO=bar``. A definition for the name specified by - ``<resultVar>`` will also be added automatically. - - ``CMAKE_REQUIRED_INCLUDES`` - A :ref:`;-list <CMake Language Lists>` of header search paths to pass to - the compiler. These will be the only header search paths used by - ``try_run()``, i.e. the contents of the :prop_dir:`INCLUDE_DIRECTORIES` - directory property will be ignored. - - ``CMAKE_REQUIRED_LINK_OPTIONS`` - A :ref:`;-list <CMake Language Lists>` of options to add to the link - command (see :command:`try_run` for further details). - - ``CMAKE_REQUIRED_LIBRARIES`` - A :ref:`;-list <CMake Language Lists>` of libraries to add to the link - command. These can be the name of system libraries or they can be - :ref:`Imported Targets <Imported Targets>` (see :command:`try_run` for - further details). - - ``CMAKE_REQUIRED_QUIET`` - If this variable evaluates to a boolean true value, all status messages - associated with the check will be suppressed. - - The check is only performed once, with the result cached in the variable - named by ``<resultVar>``. Every subsequent CMake run will re-use this cached - value rather than performing the check again, even if the ``<code>`` changes. - In order to force the check to be re-evaluated, the variable named by + The check is only performed once, with the result cached in the variable named + by ``<resultVar>``. Every subsequent CMake run will re-use this cached value + rather than performing the check again, even if the ``<code>`` changes. In + order to force the check to be re-evaluated, the variable named by ``<resultVar>`` must be manually removed from the cache. + The compile and link commands can be influenced by setting any of the + following variables prior to calling ``check_source_runs()`` + +.. include:: /module/CMAKE_REQUIRED_FLAGS.txt + +.. include:: /module/CMAKE_REQUIRED_DEFINITIONS.txt + +.. include:: /module/CMAKE_REQUIRED_INCLUDES.txt + +.. include:: /module/CMAKE_REQUIRED_LINK_OPTIONS.txt + +.. include:: /module/CMAKE_REQUIRED_LIBRARIES.txt + +.. include:: /module/CMAKE_REQUIRED_QUIET.txt + #]=======================================================================] include_guard(GLOBAL) diff --git a/Modules/CheckStructHasMember.cmake b/Modules/CheckStructHasMember.cmake index 8217c84..72fd093 100644 --- a/Modules/CheckStructHasMember.cmake +++ b/Modules/CheckStructHasMember.cmake @@ -26,20 +26,17 @@ Check if the given struct or class has the specified member variable The following variables may be set before calling this macro to modify the way the check is run: -``CMAKE_REQUIRED_FLAGS`` - string of compile command line flags. -``CMAKE_REQUIRED_DEFINITIONS`` - list of macros to define (-DFOO=bar). -``CMAKE_REQUIRED_INCLUDES`` - list of include directories. -``CMAKE_REQUIRED_LINK_OPTIONS`` - .. versionadded:: 3.14 - list of options to pass to link command. -``CMAKE_REQUIRED_LIBRARIES`` - list of libraries to link. -``CMAKE_REQUIRED_QUIET`` - .. versionadded:: 3.1 - execute quietly without messages. +.. include:: /module/CMAKE_REQUIRED_FLAGS.txt + +.. include:: /module/CMAKE_REQUIRED_DEFINITIONS.txt + +.. include:: /module/CMAKE_REQUIRED_INCLUDES.txt + +.. include:: /module/CMAKE_REQUIRED_LINK_OPTIONS.txt + +.. include:: /module/CMAKE_REQUIRED_LIBRARIES.txt + +.. include:: /module/CMAKE_REQUIRED_QUIET.txt Example: @@ -51,8 +48,7 @@ Example: #]=======================================================================] include_guard(GLOBAL) -include(CheckCSourceCompiles) -include(CheckCXXSourceCompiles) +include(CheckSourceCompiles) macro (CHECK_STRUCT_HAS_MEMBER _STRUCT _MEMBER _HEADER _RESULT) set(_INCLUDE_FILES) @@ -78,10 +74,15 @@ int main() ") if("${_lang}" STREQUAL "C") - CHECK_C_SOURCE_COMPILES("${_CHECK_STRUCT_MEMBER_SOURCE_CODE}" ${_RESULT}) + CHECK_SOURCE_COMPILES(C "${_CHECK_STRUCT_MEMBER_SOURCE_CODE}" ${_RESULT}) elseif("${_lang}" STREQUAL "CXX") - CHECK_CXX_SOURCE_COMPILES("${_CHECK_STRUCT_MEMBER_SOURCE_CODE}" ${_RESULT}) + CHECK_SOURCE_COMPILES(CXX "${_CHECK_STRUCT_MEMBER_SOURCE_CODE}" ${_RESULT}) else() message(FATAL_ERROR "Unknown language:\n ${_lang}\nSupported languages: C, CXX.\n") endif() endmacro () + +# FIXME(#24994): The following modules are included only for compatibility +# with projects that accidentally relied on them with CMake 3.26 and below. +include(CheckCSourceCompiles) +include(CheckCXXSourceCompiles) diff --git a/Modules/CheckSymbolExists.cmake b/Modules/CheckSymbolExists.cmake index c4a1574..931ed4a 100644 --- a/Modules/CheckSymbolExists.cmake +++ b/Modules/CheckSymbolExists.cmake @@ -31,22 +31,17 @@ If the check needs to be done in C++, consider using The following variables may be set before calling this macro to modify the way the check is run: -``CMAKE_REQUIRED_FLAGS`` - string of compile command line flags. -``CMAKE_REQUIRED_DEFINITIONS`` - a :ref:`;-list <CMake Language Lists>` of macros to define (-DFOO=bar). -``CMAKE_REQUIRED_INCLUDES`` - a :ref:`;-list <CMake Language Lists>` of header search paths to pass to - the compiler. -``CMAKE_REQUIRED_LINK_OPTIONS`` - .. versionadded:: 3.14 - a :ref:`;-list <CMake Language Lists>` of options to add to the link command. -``CMAKE_REQUIRED_LIBRARIES`` - a :ref:`;-list <CMake Language Lists>` of libraries to add to the link - command. See policy :policy:`CMP0075`. -``CMAKE_REQUIRED_QUIET`` - .. versionadded:: 3.1 - execute quietly without messages. +.. include:: /module/CMAKE_REQUIRED_FLAGS.txt + +.. include:: /module/CMAKE_REQUIRED_DEFINITIONS.txt + +.. include:: /module/CMAKE_REQUIRED_INCLUDES.txt + +.. include:: /module/CMAKE_REQUIRED_LINK_OPTIONS.txt + +.. include:: /module/CMAKE_REQUIRED_LIBRARIES.txt + +.. include:: /module/CMAKE_REQUIRED_QUIET.txt For example: @@ -62,7 +57,7 @@ For example: include_guard(GLOBAL) -cmake_policy(PUSH) +block(SCOPE_FOR POLICIES) cmake_policy(SET CMP0054 NEW) # if() quoted variables not dereferenced macro(CHECK_SYMBOL_EXISTS SYMBOL FILES VARIABLE) @@ -166,4 +161,4 @@ int main(int argc, char** argv) endif() endmacro() -cmake_policy(POP) +endblock() diff --git a/Modules/CheckTypeSize.cmake b/Modules/CheckTypeSize.cmake index 579d189..01ce1d2 100644 --- a/Modules/CheckTypeSize.cmake +++ b/Modules/CheckTypeSize.cmake @@ -67,20 +67,18 @@ member you can do something like this: The following variables may be set before calling this macro to modify the way the check is run: -``CMAKE_REQUIRED_FLAGS`` - string of compile command line flags. -``CMAKE_REQUIRED_DEFINITIONS`` - list of macros to define (-DFOO=bar). -``CMAKE_REQUIRED_INCLUDES`` - list of include directories. -``CMAKE_REQUIRED_LINK_OPTIONS`` - .. versionadded:: 3.14 - list of options to pass to link command. -``CMAKE_REQUIRED_LIBRARIES`` - list of libraries to link. -``CMAKE_REQUIRED_QUIET`` - .. versionadded:: 3.1 - execute quietly without messages. +.. include:: /module/CMAKE_REQUIRED_FLAGS.txt + +.. include:: /module/CMAKE_REQUIRED_DEFINITIONS.txt + +.. include:: /module/CMAKE_REQUIRED_INCLUDES.txt + +.. include:: /module/CMAKE_REQUIRED_LINK_OPTIONS.txt + +.. include:: /module/CMAKE_REQUIRED_LIBRARIES.txt + +.. include:: /module/CMAKE_REQUIRED_QUIET.txt + ``CMAKE_EXTRA_INCLUDE_FILES`` list of extra headers to include. #]=======================================================================] @@ -92,7 +90,7 @@ get_filename_component(__check_type_size_dir "${CMAKE_CURRENT_LIST_FILE}" PATH) include_guard(GLOBAL) -cmake_policy(PUSH) +block(SCOPE_FOR POLICIES) cmake_policy(SET CMP0054 NEW) #----------------------------------------------------------------------------- @@ -294,4 +292,4 @@ macro(CHECK_TYPE_SIZE TYPE VARIABLE) endmacro() #----------------------------------------------------------------------------- -cmake_policy(POP) +endblock() diff --git a/Modules/CheckVariableExists.cmake b/Modules/CheckVariableExists.cmake index 3a7a431..9e5d710 100644 --- a/Modules/CheckVariableExists.cmake +++ b/Modules/CheckVariableExists.cmake @@ -26,18 +26,16 @@ Check if the variable exists. The following variables may be set before calling this macro to modify the way the check is run: -``CMAKE_REQUIRED_FLAGS`` - string of compile command line flags. -``CMAKE_REQUIRED_DEFINITIONS`` - list of macros to define (-DFOO=bar). -``CMAKE_REQUIRED_LINK_OPTIONS`` - .. versionadded:: 3.14 - list of options to pass to link command. -``CMAKE_REQUIRED_LIBRARIES`` - list of libraries to link. -``CMAKE_REQUIRED_QUIET`` - .. versionadded:: 3.1 - execute quietly without messages. +.. include:: /module/CMAKE_REQUIRED_FLAGS.txt + +.. include:: /module/CMAKE_REQUIRED_DEFINITIONS.txt + +.. include:: /module/CMAKE_REQUIRED_LINK_OPTIONS.txt + +.. include:: /module/CMAKE_REQUIRED_LIBRARIES.txt + +.. include:: /module/CMAKE_REQUIRED_QUIET.txt + #]=======================================================================] include_guard(GLOBAL) diff --git a/Modules/Compiler/Clang-FindBinUtils.cmake b/Modules/Compiler/Clang-FindBinUtils.cmake index daf0371..f4f35e6 100644 --- a/Modules/Compiler/Clang-FindBinUtils.cmake +++ b/Modules/Compiler/Clang-FindBinUtils.cmake @@ -26,6 +26,7 @@ set(__clang_hints ${__clang_hint_1} ${__clang_hint_2}) find_program(CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_AR NAMES "${_CMAKE_TOOLCHAIN_PREFIX}llvm-ar-${__version_x_y}" "${_CMAKE_TOOLCHAIN_PREFIX}llvm-ar-${__version_x}" + "${_CMAKE_TOOLCHAIN_PREFIX}llvm-ar${__version_x}" "${_CMAKE_TOOLCHAIN_PREFIX}llvm-ar" HINTS ${__clang_hints} NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH @@ -37,6 +38,7 @@ mark_as_advanced(CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_AR) find_program(CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_RANLIB NAMES "${_CMAKE_TOOLCHAIN_PREFIX}llvm-ranlib-${__version_x_y}" "${_CMAKE_TOOLCHAIN_PREFIX}llvm-ranlib-${__version_x}" + "${_CMAKE_TOOLCHAIN_PREFIX}llvm-ranlib${__version_x}" "${_CMAKE_TOOLCHAIN_PREFIX}llvm-ranlib" HINTS ${__clang_hints} NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH @@ -48,6 +50,7 @@ mark_as_advanced(CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_RANLIB) find_program(CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_CLANG_SCAN_DEPS NAMES "${_CMAKE_TOOLCHAIN_PREFIX}clang-scan-deps-${__version_x_y}" "${_CMAKE_TOOLCHAIN_PREFIX}clang-scan-deps-${__version_x}" + "${_CMAKE_TOOLCHAIN_PREFIX}clang-scan-deps${__version_x}" "${_CMAKE_TOOLCHAIN_PREFIX}clang-scan-deps" HINTS ${__clang_hints} NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH diff --git a/Modules/Compiler/Clang-HIP.cmake b/Modules/Compiler/Clang-HIP.cmake index 4dbe2e8..92925f1 100644 --- a/Modules/Compiler/Clang-HIP.cmake +++ b/Modules/Compiler/Clang-HIP.cmake @@ -1,4 +1,5 @@ include(Compiler/Clang) + __compiler_clang(HIP) __compiler_clang_cxx_standards(HIP) diff --git a/Modules/Compiler/Clang.cmake b/Modules/Compiler/Clang.cmake index 6c544fd..46f5fc1 100644 --- a/Modules/Compiler/Clang.cmake +++ b/Modules/Compiler/Clang.cmake @@ -173,7 +173,12 @@ macro(__compiler_clang_cxx_standards lang) unset(_clang_version_std17) - if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 12.0) + if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 17.0) + set(CMAKE_${lang}23_STANDARD_COMPILE_OPTION "-std=c++23") + set(CMAKE_${lang}23_EXTENSION_COMPILE_OPTION "-std=gnu++23") + set(CMAKE_${lang}26_STANDARD_COMPILE_OPTION "-std=c++26") + set(CMAKE_${lang}26_EXTENSION_COMPILE_OPTION "-std=gnu++26") + elseif(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 12.0) set(CMAKE_${lang}23_STANDARD_COMPILE_OPTION "-std=c++2b") set(CMAKE_${lang}23_EXTENSION_COMPILE_OPTION "-std=gnu++2b") endif() diff --git a/Modules/Compiler/GNU-FindBinUtils.cmake b/Modules/Compiler/GNU-FindBinUtils.cmake index 4dcdd53..3941715 100644 --- a/Modules/Compiler/GNU-FindBinUtils.cmake +++ b/Modules/Compiler/GNU-FindBinUtils.cmake @@ -18,6 +18,7 @@ get_filename_component(__gcc_hints "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPIL find_program(CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_AR NAMES "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ar-${__version_x_y}" "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ar-${__version_x}" + "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ar${__version_x}" "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ar${_CMAKE_COMPILER_SUFFIX}" HINTS ${__gcc_hints} NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH @@ -29,6 +30,7 @@ mark_as_advanced(CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_AR) find_program(CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_RANLIB NAMES "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ranlib-${__version_x_y}" "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ranlib-${__version_x}" + "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ranlib${__version_x}" "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ranlib${_CMAKE_COMPILER_SUFFIX}" HINTS ${__gcc_hints} NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH diff --git a/Modules/Compiler/GNU.cmake b/Modules/Compiler/GNU.cmake index 5930e37..d01054b 100644 --- a/Modules/Compiler/GNU.cmake +++ b/Modules/Compiler/GNU.cmake @@ -52,6 +52,52 @@ macro(__compiler_gnu lang) set(CMAKE_DEPFILE_FLAGS_${lang} "-MD -MT <DEP_TARGET> -MF <DEP_FILE>") endif() + # define flags for linker depfile generation + set(CMAKE_${lang}_LINKER_DEPFILE_FLAGS "LINKER:--dependency-file,<DEP_FILE>") + set(CMAKE_${lang}_LINKER_DEPFILE_FORMAT gcc) + + if(NOT DEFINED CMAKE_${lang}_LINKER_DEPFILE_SUPPORTED) + ## Ensure ninja tool is recent enough... + if(CMAKE_GENERATOR MATCHES "^Ninja") + # Ninja 1.10 or upper is required + execute_process(COMMAND "${CMAKE_MAKE_PROGRAM}" --version + OUTPUT_VARIABLE _ninja_version + ERROR_VARIABLE _ninja_version) + if (_ninja_version MATCHES "[0-9]+(\\.[0-9]+)*") + set (_ninja_version "${CMAKE_MATCH_0}") + endif() + if (_ninja_version VERSION_LESS "1.10") + set(CMAKE_${lang}_LINKER_DEPFILE_SUPPORTED FALSE) + endif() + unset(_ninja_version) + endif() + + if (NOT DEFINED CMAKE_${lang}_LINKER_DEPFILE_SUPPORTED) + ## check if this feature is supported by the linker + execute_process(COMMAND "${CMAKE_${lang}_COMPILER}" -Wl,--help + OUTPUT_VARIABLE _linker_capabilities + ERROR_VARIABLE _linker_capabilities) + if(_linker_capabilities MATCHES "--dependency-file") + set(CMAKE_${lang}_LINKER_DEPFILE_SUPPORTED TRUE) + else() + set(CMAKE_${lang}_LINKER_DEPFILE_SUPPORTED FALSE) + endif() + unset(_linker_capabilities) + endif() + endif() + if (CMAKE_${lang}_LINKER_DEPFILE_SUPPORTED) + set(CMAKE_${lang}_LINK_DEPENDS_USE_LINKER TRUE) + else() + unset(CMAKE_${lang}_LINK_DEPENDS_USE_LINKER) + endif() + + # For now, due to GNU binutils ld bug when LTO is enabled (see GNU bug + # `30568 <https://sourceware.org/bugzilla/show_bug.cgi?id=30568>`_), + # deactivate this feature. + if (NOT DEFINED CMAKE_LINK_DEPENDS_USE_LINKER) + set(CMAKE_LINK_DEPENDS_USE_LINKER FALSE) + endif() + # Initial configuration flags. string(APPEND CMAKE_${lang}_FLAGS_INIT " ") string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " -g") diff --git a/Modules/Compiler/IAR-ASM.cmake b/Modules/Compiler/IAR-ASM.cmake index bae0fbd..5f1dac0 100644 --- a/Modules/Compiler/IAR-ASM.cmake +++ b/Modules/Compiler/IAR-ASM.cmake @@ -2,44 +2,78 @@ include(Compiler/IAR) -cmake_policy(PUSH) -cmake_policy(SET CMP0057 NEW) # if IN_LIST - -set(_CMAKE_IAR_ITOOLS "ARM" "RH850" "RL78" "RX" "RISC-V" "STM8") -set(_CMAKE_IAR_XTOOLS "AVR" "MSP430" "V850" "8051") +# Architecture specific +if("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" STREQUAL "ARM") + __compiler_iar_ilink(ASM) + __assembler_iar_deps("-y" 9.30) + set(_CMAKE_IAR_SILENCER_FLAG " -S") + set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;asm;msa;S) -set(_CMAKE_IAR_ASM_SILENT "RH850" "RL78" "RX" "RISC-V" "STM8") -if("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" IN_LIST _CMAKE_IAR_ASM_SILENT) +elseif("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" STREQUAL "RX") + __compiler_iar_ilink(ASM) + __assembler_iar_deps("--dependencies=ns" 2.50.1) set(_CMAKE_IAR_SILENCER_FLAG " --silent") -else() - set(_CMAKE_IAR_SILENCER_FLAG " -S") -endif() + set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;asm;msa;S) -string(APPEND CMAKE_ASM_FLAGS_INIT " ") -string(APPEND CMAKE_ASM_FLAGS_DEBUG_INIT " -r") -string(APPEND CMAKE_ASM_FLAGS_MINSIZEREL_INIT " -DNDEBUG") -string(APPEND CMAKE_ASM_FLAGS_RELEASE_INIT " -DNDEBUG") -string(APPEND CMAKE_ASM_FLAGS_RELWITHDEBINFO_INIT " -r -DNDEBUG") +elseif("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" STREQUAL "RH850") + __compiler_iar_ilink(ASM) + __assembler_iar_deps("--dependencies=ns" 2) + set(_CMAKE_IAR_SILENCER_FLAG " --silent") + set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;asm;msa;S) -set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> ${_CMAKE_IAR_SILENCER_FLAG} <SOURCE> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT>") +elseif("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" STREQUAL "RL78") + __compiler_iar_ilink(ASM) + __assembler_iar_deps("--dependencies=ns" 2) + set(_CMAKE_IAR_SILENCER_FLAG " --silent") + set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;asm;msa;S) -if("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" IN_LIST _CMAKE_IAR_ITOOLS) +elseif("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" MATCHES "(RISCV|RISC-V)") __compiler_iar_ilink(ASM) + __assembler_iar_deps("--dependencies=ns" 1) + set(_CMAKE_IAR_SILENCER_FLAG " --silent") set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;asm;msa;S) -elseif("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" IN_LIST _CMAKE_IAR_XTOOLS) +elseif("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" STREQUAL "AVR") + __compiler_iar_xlink(ASM) + __assembler_iar_deps("-y" 8) + set(_CMAKE_IAR_SILENCER_FLAG " -S") + set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s90;asm;msa) + set(CMAKE_ASM_OUTPUT_EXTENSION ".r90") + +elseif("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" STREQUAL "MSP430") __compiler_iar_xlink(ASM) - # AVR=s90, MSP430=s43, V850=s85, 8051=s51 - set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s90;s43;s85;s51;asm;msa) + __assembler_iar_deps("-y" 8) + set(_CMAKE_IAR_SILENCER_FLAG " -S") + set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s43;asm;msa) + set(CMAKE_ASM_OUTPUT_EXTENSION ".r43") -else() - message(FATAL_ERROR "CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID not detected. This should be automatic.") +elseif("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" STREQUAL "V850") + __compiler_iar_xlink(ASM) + set(_CMAKE_IAR_SILENCER_FLAG " -S") + set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s85;asm;msa) + set(CMAKE_ASM_OUTPUT_EXTENSION ".r85") + +elseif("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" STREQUAL "8051") + __compiler_iar_xlink(ASM) + set(_CMAKE_IAR_SILENCER_FLAG " -S") + set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s51;asm;msa) + set(CMAKE_ASM_OUTPUT_EXTENSION ".r51") + +elseif("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" STREQUAL "STM8") + __compiler_iar_ilink(ASM) + __assembler_iar_deps("--dependencies=ns" 2) + set(_CMAKE_IAR_SILENCER_FLAG " --silent") + set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;asm;msa;S) +else() + message(FATAL_ERROR "CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID not detected. This should be automatic." ) endif() -unset(_CMAKE_IAR_ITOOLS) -unset(_CMAKE_IAR_XTOOLS) -unset(_CMAKE_IAR_ASM_SILENT) -unset(_CMAKE_IAR_SILENCER_FLAG) +string(APPEND CMAKE_ASM_FLAGS_DEBUG_INIT " -r") +string(APPEND CMAKE_ASM_FLAGS_MINSIZEREL_INIT " -DNDEBUG") +string(APPEND CMAKE_ASM_FLAGS_RELEASE_INIT " -DNDEBUG") +string(APPEND CMAKE_ASM_FLAGS_RELWITHDEBINFO_INIT " -r -DNDEBUG") -cmake_policy(POP) +set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> ${_CMAKE_IAR_SILENCER_FLAG} <SOURCE> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT>") + +unset(_CMAKE_IAR_SILENCER_FLAG) diff --git a/Modules/Compiler/IAR-C.cmake b/Modules/Compiler/IAR-C.cmake index 0ef1a2a..c4907c5 100644 --- a/Modules/Compiler/IAR-C.cmake +++ b/Modules/Compiler/IAR-C.cmake @@ -59,7 +59,7 @@ elseif("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "RISCV") elseif("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "AVR") __compiler_iar_xlink(C) - __compiler_check_default_language_standard(C 7.10 99) + __compiler_check_default_language_standard(C 7.10 99 8.10 17) set(CMAKE_C_OUTPUT_EXTENSION ".r90") elseif("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "MSP430") diff --git a/Modules/Compiler/IAR-CXX.cmake b/Modules/Compiler/IAR-CXX.cmake index 3f0ef1f..b598e36 100644 --- a/Modules/Compiler/IAR-CXX.cmake +++ b/Modules/Compiler/IAR-CXX.cmake @@ -68,7 +68,8 @@ elseif("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "RISCV") elseif("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "AVR") __compiler_iar_xlink(CXX) - __compiler_check_default_language_standard(CXX 7.10 98) + __compiler_check_default_language_standard(CXX 7.10 98 8.10 17) + set(CMAKE_CXX_OUTPUT_EXTENSION ".r90") elseif("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "MSP430") __compiler_iar_xlink(CXX) @@ -78,12 +79,12 @@ elseif("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "MSP430") elseif("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "V850") __compiler_iar_xlink(CXX) __compiler_check_default_language_standard(CXX 1.10 98) - set(CMAKE_C_OUTPUT_EXTENSION ".r85") + set(CMAKE_CXX_OUTPUT_EXTENSION ".r85") elseif("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "8051") __compiler_iar_xlink(CXX) __compiler_check_default_language_standard(CXX 6.10 98) - set(CMAKE_C_OUTPUT_EXTENSION ".r51") + set(CMAKE_CXX_OUTPUT_EXTENSION ".r51") elseif("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "STM8") __compiler_iar_ilink(CXX) diff --git a/Modules/Compiler/IAR.cmake b/Modules/Compiler/IAR.cmake index 7908f96..8dadb76 100644 --- a/Modules/Compiler/IAR.cmake +++ b/Modules/Compiler/IAR.cmake @@ -1,6 +1,6 @@ # This file is processed when the IAR C/C++ Compiler is used # -# CPU <arch> supported in CMake: 8051, Arm, AVR, MSP430, RH850, RISC-V, RL78, RX and V850 +# CPU <arch> supported in CMake: 8051, Arm, AVR, MSP430, RH850, RISC-V, RL78, RX, STM8 and V850 # # The compiler user documentation is architecture-dependent # and it can found with the product installation under <arch>/doc/{EW,BX}<arch>_DevelopmentGuide.ENU.pdf @@ -9,7 +9,7 @@ include_guard() macro(__compiler_iar_common lang) - if (${lang} MATCHES "^(C|CXX)$") + if ("x${lang}" MATCHES "^x(C|CXX)$") set(CMAKE_${lang}_COMPILE_OBJECT "<CMAKE_${lang}_COMPILER> ${CMAKE_IAR_${lang}_FLAG} --silent <SOURCE> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT>") set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE "<CMAKE_${lang}_COMPILER> ${CMAKE_IAR_${lang}_FLAG} --silent <SOURCE> <DEFINES> <INCLUDES> <FLAGS> --preprocess=cnl <PREPROCESSED_SOURCE>") set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE "<CMAKE_${lang}_COMPILER> ${CMAKE_IAR_${lang}_FLAG} --silent <SOURCE> <DEFINES> <INCLUDES> <FLAGS> -lAH <ASSEMBLY_SOURCE> -o <OBJECT>.dummy") @@ -23,6 +23,7 @@ macro(__compiler_iar_common lang) string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " -Oh -r -DNDEBUG") endif() + set(CMAKE_${lang}_OUTPUT_EXTENSION_REPLACE 1) set(CMAKE_${lang}_RESPONSE_FILE_FLAG "-f ") set(CMAKE_${lang}_RESPONSE_FILE_LINK_FLAG "-f ") @@ -35,7 +36,9 @@ macro(__compiler_iar_ilink lang) __compiler_iar_common(${lang}) - set(CMAKE_${lang}_LINK_EXECUTABLE "<CMAKE_LINKER> --silent <OBJECTS> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES> -o <TARGET>") + string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " --silent") + set(CMAKE_${lang}_LINK_EXECUTABLE "<CMAKE_LINKER> <OBJECTS> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES> -o <TARGET>") + set(CMAKE_${lang}_CREATE_STATIC_LIBRARY "<CMAKE_AR> <TARGET> --create <LINK_FLAGS> <OBJECTS>") set(CMAKE_${lang}_ARCHIVE_CREATE "<CMAKE_AR> <TARGET> --create <LINK_FLAGS> <OBJECTS>") set(CMAKE_${lang}_ARCHIVE_APPEND "<CMAKE_AR> <TARGET> --replace <LINK_FLAGS> <OBJECTS>") @@ -46,10 +49,18 @@ macro(__compiler_iar_xlink lang) __compiler_iar_common(${lang}) - set(CMAKE_${lang}_LINK_EXECUTABLE "<CMAKE_LINKER> -S <OBJECTS> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES> -o <TARGET>") + string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " -S") + set(CMAKE_${lang}_LINK_EXECUTABLE "<CMAKE_LINKER> <OBJECTS> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES> -o <TARGET>") + set(CMAKE_${lang}_CREATE_STATIC_LIBRARY "<CMAKE_AR> <TARGET> <LINK_FLAGS> <OBJECTS>") set(CMAKE_${lang}_ARCHIVE_CREATE "<CMAKE_AR> <TARGET> <LINK_FLAGS> <OBJECTS>") set(CMAKE_${lang}_ARCHIVE_APPEND "") set(CMAKE_LIBRARY_PATH_FLAG "-I") endmacro() + +macro(__assembler_iar_deps flag min_version) + if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL ${min_version}) + set(CMAKE_DEPFILE_FLAGS_ASM "${flag} <DEP_FILE>") + endif() +endmacro() diff --git a/Modules/Compiler/IBMClang.cmake b/Modules/Compiler/IBMClang.cmake index a9d760f..169a0f0 100644 --- a/Modules/Compiler/IBMClang.cmake +++ b/Modules/Compiler/IBMClang.cmake @@ -43,7 +43,10 @@ macro(__compiler_ibmclang lang) set(_CMAKE_${lang}_IPO_SUPPORTED_BY_CMAKE YES) set(_CMAKE_${lang}_IPO_MAY_BE_SUPPORTED_BY_COMPILER YES) - set(_CMAKE_LTO_THIN TRUE) + # Thin LTO is not yet supported on AIX. + if(NOT (CMAKE_SYSTEM_NAME STREQUAL "AIX")) + set(_CMAKE_LTO_THIN TRUE) + endif() if(_CMAKE_LTO_THIN) set(CMAKE_${lang}_COMPILE_OPTIONS_IPO "-flto=thin") diff --git a/Modules/Compiler/LCC-Fortran.cmake b/Modules/Compiler/LCC-Fortran.cmake index 8091b29..2d82ea8 100644 --- a/Modules/Compiler/LCC-Fortran.cmake +++ b/Modules/Compiler/LCC-Fortran.cmake @@ -10,8 +10,11 @@ set(CMAKE_Fortran_PREPROCESS_SOURCE set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-ffixed-form") set(CMAKE_Fortran_FORMAT_FREE_FLAG "-ffree-form") -set(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_ON "-cpp") -set(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_OFF "-nocpp") +# LCC < 1.24.00 has a broken Fortran preprocessor +if(CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER_EQUAL "1.24.00") + set(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_ON "-cpp") + set(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_OFF "-nocpp") +endif() set(CMAKE_Fortran_POSTPROCESS_FLAG "-fpreprocessed") diff --git a/Modules/Compiler/NVHPC-Fortran.cmake b/Modules/Compiler/NVHPC-Fortran.cmake index 59755b3..ca5f1b2 100644 --- a/Modules/Compiler/NVHPC-Fortran.cmake +++ b/Modules/Compiler/NVHPC-Fortran.cmake @@ -1,3 +1,7 @@ include(Compiler/PGI-Fortran) include(Compiler/NVHPC) __compiler_nvhpc(Fortran) +if(CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 21.7) + # Before NVHPC 21.7 nvfortran didn't support isystem + unset(CMAKE_INCLUDE_SYSTEM_FLAG_Fortran) +endif() diff --git a/Modules/Compiler/NVHPC.cmake b/Modules/Compiler/NVHPC.cmake index 474ac80..0593456 100644 --- a/Modules/Compiler/NVHPC.cmake +++ b/Modules/Compiler/NVHPC.cmake @@ -13,5 +13,5 @@ include(Compiler/PGI) macro(__compiler_nvhpc lang) # Logic specific to NVHPC. set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-isystem ") - set(CMAKE_${lang}_COMPILE_OPTIONS_WARNING_AS_ERROR "-Werror" "all-warnings") + set(CMAKE_${lang}_COMPILE_OPTIONS_WARNING_AS_ERROR "-Werror") endmacro() diff --git a/Modules/Compiler/NVIDIA-CUDA.cmake b/Modules/Compiler/NVIDIA-CUDA.cmake index 0823954..c839d1c 100644 --- a/Modules/Compiler/NVIDIA-CUDA.cmake +++ b/Modules/Compiler/NVIDIA-CUDA.cmake @@ -8,6 +8,11 @@ set(_CMAKE_COMPILE_AS_CUDA_FLAG "-x cu") set(_CMAKE_CUDA_WHOLE_FLAG "-c") set(_CMAKE_CUDA_RDC_FLAG "-rdc=true") set(_CMAKE_CUDA_PTX_FLAG "-ptx") +set(_CMAKE_CUDA_CUBIN_FLAG "-cubin") +set(_CMAKE_CUDA_FATBIN_FLAG "-fatbin") +if(CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL "11.7.0") + set(_CMAKE_CUDA_OPTIX_FLAG "-optix-ir") +endif() if (CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 10.2.89) # The -forward-unknown-to-host-compiler flag was only diff --git a/Modules/CompilerId/VS-10.vcxproj.in b/Modules/CompilerId/VS-10.vcxproj.in index 3598fc7..fa324d8 100644 --- a/Modules/CompilerId/VS-10.vcxproj.in +++ b/Modules/CompilerId/VS-10.vcxproj.in @@ -26,6 +26,7 @@ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|@id_platform@'" Label="Configuration"> <ConfigurationType>@id_config_type@</ConfigurationType> @id_toolset@ + @id_api_level@ <CharacterSet>MultiByte</CharacterSet> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> @@ -44,7 +45,7 @@ <PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions> <MinimalRebuild>false</MinimalRebuild> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> - <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <RuntimeLibrary Condition="'$(ApplicationType)'!='Android'">MultiThreadedDebugDLL</RuntimeLibrary> <PrecompiledHeader> </PrecompiledHeader> <WarningLevel>TurnOffAllWarnings</WarningLevel> diff --git a/Modules/Dart.cmake b/Modules/Dart.cmake index 154fe9d..3610012 100644 --- a/Modules/Dart.cmake +++ b/Modules/Dart.cmake @@ -5,6 +5,11 @@ Dart ---- +.. deprecated:: 3.27 + This module is available only if policy :policy:`CMP0145` + is not set to ``NEW``. Do not use it in new code. + Use the :module:`CTest` module instead. + Configure a project for testing with CTest or old Dart Tcl Client This file is the backwards-compatibility version of the CTest module. @@ -33,10 +38,24 @@ whether testing support should be enabled. The default is ON. # # +# include(Dart) already warns about CMP0145, but back when this module was in +# common use, it was often loaded via include(${CMAKE_ROOT}/Modules/Dart.cmake) +# which will not warn. Warn again just in case. +cmake_policy(GET CMP0145 cmp0145) +if(cmp0145 STREQUAL "") + cmake_policy(GET_WARNING CMP0145 _cmp0145_warning) + message(AUTHOR_WARNING "${_cmp0145_warning}") +endif() + option(BUILD_TESTING "Build the testing tree." ON) if(BUILD_TESTING) + # We only get here if a project already ran include(Dart), + # so avoid warning about CMP0145 again. + cmake_policy(PUSH) + cmake_policy(SET CMP0145 OLD) find_package(Dart QUIET) + cmake_policy(POP) # # Section #1: diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index b34a35b..605908d 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -232,7 +232,12 @@ External Project Definition measure. .. versionchanged:: 3.6 - This option also applies to ``git clone`` invocations. + This option also applies to ``git clone`` invocations, although the + default behavior is different. If ``TLS_VERIFY`` is not given and + :variable:`CMAKE_TLS_VERIFY` is not set, the behavior will be + determined by git's defaults. Normally, the ``sslVerify`` git + config setting defaults to true, but the user may have overridden + this at a global level. ``TLS_CAINFO <file>`` Specify a custom certificate authority file to use if ``TLS_VERIFY`` @@ -278,6 +283,13 @@ External Project Definition URL of the git repository. Any URL understood by the ``git`` command may be used. + .. versionchanged:: 3.27 + A relative URL will be resolved based on the parent project's + remote, subject to :policy:`CMP0150`. See the policy documentation + for how the remote is selected, including conditions where the + remote selection can fail. Local filesystem remotes should + always use absolute paths. + ``GIT_TAG <tag>`` Git branch name, tag or commit hash. Note that branch names and tags should generally be specified as remote names (i.e. ``origin/myBranch`` @@ -441,13 +453,23 @@ External Project Definition ``UPDATE_DISCONNECTED <bool>`` .. versionadded:: 3.2 - When enabled, this option causes the update step to be skipped. It does - not, however, prevent the download step. The update step can still be + When enabled, this option causes the update step to be skipped (but see + below for changed behavior where this is not the case). It does not + prevent the download step. The update step can still be added as a step target (see :command:`ExternalProject_Add_StepTargets`) and called manually. This is useful if you want to allow developers to build the project when disconnected from the network (the network may still be needed for the download step though). + .. versionchanged:: 3.27 + + When ``UPDATE_DISCONNECTED`` is true, the update step will be executed + if any details about the update or download step are changed. + Furthermore, if using the git download/update method, the update + logic will be modified to skip attempts to contact the remote. + If the ``GIT_TAG`` mentions a ref that is not known locally, the + update step will halt with a fatal error. + When this option is present, it is generally advisable to make the value a cache variable under the developer's control rather than hard-coding it. If this option is not present, the default value is taken from the @@ -1188,6 +1210,8 @@ The custom step could then be triggered from the main build like so:: #]=======================================================================] +include(${CMAKE_CURRENT_LIST_DIR}/ExternalProject/shared_internal_commands.cmake) + cmake_policy(PUSH) cmake_policy(SET CMP0054 NEW) # if() quoted variables not dereferenced cmake_policy(SET CMP0057 NEW) # if() supports IN_LIST @@ -1309,6 +1333,8 @@ function(_ep_write_gitclone_script message(FATAL_ERROR "Tag for git checkout should not be empty.") endif() + set(git_submodules_config_options "") + if(GIT_VERSION_STRING VERSION_LESS 2.20 OR 2.21 VERSION_LESS_EQUAL GIT_VERSION_STRING) set(git_clone_options "--no-checkout") @@ -1331,18 +1357,26 @@ function(_ep_write_gitclone_script if(NOT ${git_remote_name} STREQUAL "origin") list(APPEND git_clone_options --origin \"${git_remote_name}\") endif() + if(NOT "x${tls_verify}" STREQUAL "x") + # The clone config option is sticky, it will apply to all subsequent git + # update operations. The submodules config option is not sticky, because + # git doesn't provide any way to do that. Thus, we will have to pass the + # same config option in the update step too for submodules, but not for + # the main git repo. + if(tls_verify) + # Default git behavior is "true", but the user might have changed the + # global default to "false". Since TLS_VERIFY was given, ensure we honor + # the specified setting regardless of what the global default might be. + list(APPEND git_clone_options -c http.sslVerify=true) + set(git_submodules_config_options -c http.sslVerify=true) + else() + list(APPEND git_clone_options -c http.sslVerify=false) + set(git_submodules_config_options -c http.sslVerify=false) + endif() + endif() string (REPLACE ";" " " git_clone_options "${git_clone_options}") - set(git_options) - # disable cert checking if explicitly told not to do it - if(NOT "x${tls_verify}" STREQUAL "x" AND NOT tls_verify) - set(git_options - -c http.sslVerify=false - ) - endif() - string (REPLACE ";" " " git_options "${git_options}") - configure_file( ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/ExternalProject/gitclone.cmake.in ${script_filename} @@ -1385,6 +1419,7 @@ function(_ep_write_gitupdate_script git_repository work_dir git_update_strategy + tls_verify ) if("${git_tag}" STREQUAL "") @@ -1399,6 +1434,22 @@ function(_ep_write_gitupdate_script list(APPEND git_stash_save_options --all) endif() + set(git_submodules_config_options "") + if(NOT "x${tls_verify}" STREQUAL "x") + # The submodules config option is not sticky, git doesn't provide any way + # to do that. We have to pass this config option for the update step too. + # We don't need to set it for the non-submodule update because it gets + # recorded as part of the clone operation in a sticky manner. + if(tls_verify) + # Default git behavior is "true", but the user might have changed the + # global default to "false". Since TLS_VERIFY was given, ensure we honor + # the specified setting regardless of what the global default might be. + set(git_submodules_config_options -c http.sslVerify=true) + else() + set(git_submodules_config_options -c http.sslVerify=false) + endif() + endif() + configure_file( "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/ExternalProject/gitupdate.cmake.in" "${script_filename}" @@ -2090,13 +2141,7 @@ function(_ep_get_configuration_subdir_genex suffix_var) set(suffix "") get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) if(_isMultiConfig) - if(CMAKE_GENERATOR STREQUAL "Xcode") - # The Xcode generator does not support per-config sources, - # so use the underlying build system's placeholder instead. - set(suffix "/${CMAKE_CFG_INTDIR}") - else() - set(suffix "/$<CONFIG>") - endif() + set(suffix "/$<CONFIG>") endif() set(${suffix_var} "${suffix}" PARENT_SCOPE) endfunction() @@ -2444,7 +2489,7 @@ function(ExternalProject_Add_Step name step) PROPERTY _EP_${step}_ALWAYS ) if(always) - set(touch) + set(maybe_COMMAND_touch "") # Mark stamp files for all configs as SYMBOLIC since we do not create them. # Remove any existing stamp in case the option changed in an existing tree. get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) @@ -2466,7 +2511,7 @@ function(ExternalProject_Add_Step name step) file(REMOVE ${stamp_file}) endif() else() - set(touch ${CMAKE_COMMAND} -E touch ${stamp_file}) + set(maybe_COMMAND_touch "COMMAND \${CMAKE_COMMAND} -E touch \${stamp_file}") endif() # Wrap with log script? @@ -2494,7 +2539,7 @@ function(ExternalProject_Add_Step name step) BYPRODUCTS \${byproducts} COMMENT \${comment} COMMAND ${__cmdQuoted} - COMMAND \${touch} + ${maybe_COMMAND_touch} DEPENDS \${depends} WORKING_DIRECTORY \${work_dir} VERBATIM @@ -3213,7 +3258,7 @@ function(_ep_get_update_disconnected var name) endfunction() function(_ep_add_update_command name) - ExternalProject_Get_Property(${name} source_dir tmp_dir) + ExternalProject_Get_Property(${name} source_dir stamp_dir tmp_dir) get_property(cmd_set TARGET ${name} PROPERTY _EP_UPDATE_COMMAND SET) get_property(cmd TARGET ${name} PROPERTY _EP_UPDATE_COMMAND) @@ -3227,6 +3272,7 @@ function(_ep_add_update_command name) set(work_dir) set(comment) set(always) + set(file_deps) if(cmd_set) set(work_dir ${source_dir}) @@ -3288,6 +3334,7 @@ function(_ep_add_update_command name) endif() set(work_dir ${source_dir}) set(comment "Performing update step for '${name}'") + set(comment_disconnected "Performing disconnected update step for '${name}'") get_property(git_tag TARGET ${name} @@ -3341,8 +3388,15 @@ function(_ep_add_update_command name) _ep_get_git_submodules_recurse(git_submodules_recurse) + get_property(tls_verify TARGET ${name} PROPERTY _EP_TLS_VERIFY) + if("x${tls_verify}" STREQUAL "x" AND DEFINED CMAKE_TLS_VERIFY) + set(tls_verify "${CMAKE_TLS_VERIFY}") + endif() + + set(update_script "${tmp_dir}/${name}-gitupdate.cmake") + list(APPEND file_deps ${update_script}) _ep_write_gitupdate_script( - "${tmp_dir}/${name}-gitupdate.cmake" + "${update_script}" "${GIT_EXECUTABLE}" "${git_tag}" "${git_remote_name}" @@ -3352,8 +3406,10 @@ function(_ep_add_update_command name) "${git_repository}" "${work_dir}" "${git_update_strategy}" + "${tls_verify}" ) - set(cmd ${CMAKE_COMMAND} -P ${tmp_dir}/${name}-gitupdate.cmake) + set(cmd ${CMAKE_COMMAND} -Dcan_fetch=YES -P ${update_script}) + set(cmd_disconnected ${CMAKE_COMMAND} -Dcan_fetch=NO -P ${update_script}) set(always 1) elseif(hg_repository) if(NOT HG_EXECUTABLE) @@ -3361,6 +3417,7 @@ function(_ep_add_update_command name) endif() set(work_dir ${source_dir}) set(comment "Performing update step (hg pull) for '${name}'") + set(comment_disconnected "Performing disconnected update step for '${name}'") get_property(hg_tag TARGET ${name} @@ -3386,9 +3443,23 @@ Update to Mercurial >= 2.1.1. ${HG_EXECUTABLE} pull COMMAND ${HG_EXECUTABLE} update ${hg_tag} ) + set(cmd_disconnected ${HG_EXECUTABLE} update ${hg_tag}) set(always 1) endif() + # We use configure_file() to write the update_info_file so that the file's + # timestamp is not updated if we don't change the contents + if(NOT DEFINED cmd_disconnected) + set(cmd_disconnected "${cmd}") + endif() + set(update_info_file ${stamp_dir}/${name}-update-info.txt) + list(APPEND file_deps ${update_info_file}) + configure_file( + "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/ExternalProject/UpdateInfo.txt.in" + "${update_info_file}" + @ONLY + ) + get_property(log TARGET ${name} PROPERTY _EP_LOG_UPDATE @@ -3422,16 +3493,39 @@ Update to Mercurial >= 2.1.1. EXCLUDE_FROM_MAIN \${update_disconnected} WORKING_DIRECTORY \${work_dir} DEPENDEES download + DEPENDS \${file_deps} ${log} ${uses_terminal} )" ) + if(update_disconnected) + if(NOT DEFINED comment_disconnected) + set(comment_disconnected "${comment}") + endif() + set(__cmdQuoted) + foreach(__item IN LISTS cmd_disconnected) + string(APPEND __cmdQuoted " [==[${__item}]==]") + endforeach() + + cmake_language(EVAL CODE " + ExternalProject_Add_Step(${name} update_disconnected + INDEPENDENT TRUE + COMMENT \${comment_disconnected} + COMMAND ${__cmdQuoted} + WORKING_DIRECTORY \${work_dir} + DEPENDEES download + DEPENDS \${file_deps} + ${log} + ${uses_terminal} + )" + ) + endif() endfunction() function(_ep_add_patch_command name) - ExternalProject_Get_Property(${name} source_dir) + ExternalProject_Get_Property(${name} source_dir stamp_dir) get_property(cmd_set TARGET ${name} PROPERTY _EP_PATCH_COMMAND SET) get_property(cmd TARGET ${name} PROPERTY _EP_PATCH_COMMAND) @@ -3442,6 +3536,15 @@ function(_ep_add_patch_command name) set(work_dir ${source_dir}) endif() + # We use configure_file() to write the patch_info_file so that the file's + # timestamp is not updated if we don't change the contents + set(patch_info_file ${stamp_dir}/${name}-patch-info.txt) + configure_file( + "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/ExternalProject/PatchInfo.txt.in" + "${patch_info_file}" + @ONLY + ) + get_property(log TARGET ${name} PROPERTY _EP_LOG_PATCH @@ -3463,11 +3566,6 @@ function(_ep_add_patch_command name) endif() _ep_get_update_disconnected(update_disconnected ${name}) - if(update_disconnected) - set(patch_dep download) - else() - set(patch_dep update) - endif() set(__cmdQuoted) foreach(__item IN LISTS cmd) @@ -3478,11 +3576,28 @@ function(_ep_add_patch_command name) INDEPENDENT TRUE COMMAND ${__cmdQuoted} WORKING_DIRECTORY \${work_dir} - DEPENDEES \${patch_dep} + EXCLUDE_FROM_MAIN \${update_disconnected} + DEPENDEES update + DEPENDS \${patch_info_file} ${log} ${uses_terminal} )" ) + + if(update_disconnected) + cmake_language(EVAL CODE " + ExternalProject_Add_Step(${name} patch_disconnected + INDEPENDENT TRUE + COMMAND ${__cmdQuoted} + WORKING_DIRECTORY \${work_dir} + DEPENDEES update_disconnected + DEPENDS \${patch_info_file} + ${log} + ${uses_terminal} + )" + ) + endif() + endfunction() function(_ep_get_file_deps var name) @@ -3692,6 +3807,13 @@ function(_ep_add_configure_command name) list(APPEND file_deps ${tmp_dir}/${name}-cfgcmd.txt) list(APPEND file_deps ${_ep_cache_args_script}) + _ep_get_update_disconnected(update_disconnected ${name}) + if(update_disconnected) + set(dependees patch_disconnected) + else() + set(dependees patch) + endif() + get_property(log TARGET ${name} PROPERTY _EP_LOG_CONFIGURE @@ -3721,7 +3843,7 @@ function(_ep_add_configure_command name) INDEPENDENT FALSE COMMAND ${__cmdQuoted} WORKING_DIRECTORY \${binary_dir} - DEPENDEES patch + DEPENDEES \${dependees} DEPENDS \${file_deps} ${log} ${uses_terminal} @@ -4144,6 +4266,10 @@ function(ExternalProject_Add name) # Miscellaneous options # LIST_SEPARATOR + # + # Internal options (undocumented) + # + EXTERNALPROJECT_INTERNAL_ARGUMENT_SEPARATOR ) _ep_parse_arguments( ExternalProject_Add @@ -4165,6 +4291,17 @@ function(ExternalProject_Add name) set_property(TARGET ${name} PROPERTY EXCLUDE_FROM_ALL TRUE) endif() + get_property(repo TARGET ${name} PROPERTY _EP_GIT_REPOSITORY) + if(NOT repo STREQUAL "") + cmake_policy(GET CMP0150 cmp0150 + PARENT_SCOPE # undocumented, do not use outside of CMake + ) + get_property(source_dir TARGET ${name} PROPERTY _EP_SOURCE_DIR) + get_filename_component(work_dir "${source_dir}" PATH) + _ep_resolve_git_remote(resolved_git_repository "${repo}" "${cmp0150}" "${work_dir}") + set_property(TARGET ${name} PROPERTY _EP_GIT_REPOSITORY ${resolved_git_repository}) + endif() + # The 'complete' step depends on all other steps and creates a # 'done' mark. A dependent external project's 'configure' step # depends on the 'done' mark so that it rebuilds when this project diff --git a/Modules/ExternalProject/PatchInfo.txt.in b/Modules/ExternalProject/PatchInfo.txt.in new file mode 100644 index 0000000..112953c --- /dev/null +++ b/Modules/ExternalProject/PatchInfo.txt.in @@ -0,0 +1,6 @@ +# This is a generated file and its contents are an internal implementation detail. +# The update step will be re-executed if anything in this file changes. +# No other meaning or use of this file is supported. + +command=@cmd@ +work_dir=@work_dir@ diff --git a/Modules/ExternalProject/UpdateInfo.txt.in b/Modules/ExternalProject/UpdateInfo.txt.in new file mode 100644 index 0000000..67ee434 --- /dev/null +++ b/Modules/ExternalProject/UpdateInfo.txt.in @@ -0,0 +1,7 @@ +# This is a generated file and its contents are an internal implementation detail. +# The patch step will be re-executed if anything in this file changes. +# No other meaning or use of this file is supported. + +command (connected)=@cmd@ +command (disconnected)=@cmd_disconnected@ +work_dir=@work_dir@ diff --git a/Modules/ExternalProject/download.cmake.in b/Modules/ExternalProject/download.cmake.in index ff8c659..bf7f209 100644 --- a/Modules/ExternalProject/download.cmake.in +++ b/Modules/ExternalProject/download.cmake.in @@ -108,7 +108,7 @@ message(STATUS "Downloading... timeout='@TIMEOUT_MSG@' inactivity timeout='@INACTIVITY_TIMEOUT_MSG@'" ) -set(download_retry_codes 7 6 8 15) +set(download_retry_codes 7 6 8 15 28) set(skip_url_list) set(status_code) foreach(i RANGE ${retry_number}) diff --git a/Modules/ExternalProject/gitclone.cmake.in b/Modules/ExternalProject/gitclone.cmake.in index 3312171..94b329a 100644 --- a/Modules/ExternalProject/gitclone.cmake.in +++ b/Modules/ExternalProject/gitclone.cmake.in @@ -25,7 +25,7 @@ set(error_code 1) set(number_of_tries 0) while(error_code AND number_of_tries LESS 3) execute_process( - COMMAND "@git_EXECUTABLE@" @git_options@ + COMMAND "@git_EXECUTABLE@" clone @git_clone_options@ "@git_repository@" "@src_name@" WORKING_DIRECTORY "@work_dir@" RESULT_VARIABLE error_code @@ -40,7 +40,7 @@ if(error_code) endif() execute_process( - COMMAND "@git_EXECUTABLE@" @git_options@ + COMMAND "@git_EXECUTABLE@" checkout "@git_tag@" @git_checkout_explicit--@ WORKING_DIRECTORY "@work_dir@/@src_name@" RESULT_VARIABLE error_code @@ -52,7 +52,7 @@ endif() set(init_submodules @init_submodules@) if(init_submodules) execute_process( - COMMAND "@git_EXECUTABLE@" @git_options@ + COMMAND "@git_EXECUTABLE@" @git_submodules_config_options@ submodule update @git_submodules_recurse@ --init @git_submodules@ WORKING_DIRECTORY "@work_dir@/@src_name@" RESULT_VARIABLE error_code diff --git a/Modules/ExternalProject/gitupdate.cmake.in b/Modules/ExternalProject/gitupdate.cmake.in index 50f0167..171aa7b 100644 --- a/Modules/ExternalProject/gitupdate.cmake.in +++ b/Modules/ExternalProject/gitupdate.cmake.in @@ -3,6 +3,15 @@ cmake_minimum_required(VERSION 3.5) +function(do_fetch) + message(VERBOSE "Fetching latest from the remote @git_remote_name@") + execute_process( + COMMAND "@git_EXECUTABLE@" --git-dir=.git fetch --tags --force "@git_remote_name@" + WORKING_DIRECTORY "@work_dir@" + COMMAND_ERROR_IS_FATAL LAST + ) +endfunction() + function(get_hash_for_ref ref out_var err_var) execute_process( COMMAND "@git_EXECUTABLE@" --git-dir=.git rev-parse "${ref}^0" @@ -33,17 +42,16 @@ execute_process( ) if(show_ref_output MATCHES "^[a-z0-9]+[ \\t]+refs/remotes/") # Given a full remote/branch-name and we know about it already. Since - # branches can move around, we always have to fetch. - set(fetch_required YES) + # branches can move around, we should always fetch, if permitted. + if(can_fetch) + do_fetch() + endif() set(checkout_name "@git_tag@") elseif(show_ref_output MATCHES "^[a-z0-9]+[ \\t]+refs/tags/") # Given a tag name that we already know about. We don't know if the tag we - # have matches the remote though (tags can move), so we should fetch. - set(fetch_required YES) - set(checkout_name "@git_tag@") - - # Special case to preserve backward compatibility: if we are already at the + # have matches the remote though (tags can move), so we should fetch. As a + # special case to preserve backward compatibility, if we are already at the # same commit as the tag we hold locally, don't do a fetch and assume the tag # hasn't moved on the remote. # FIXME: We should provide an option to always fetch for this case @@ -53,12 +61,20 @@ elseif(show_ref_output MATCHES "^[a-z0-9]+[ \\t]+refs/tags/") return() endif() + if(can_fetch) + do_fetch() + endif() + set(checkout_name "@git_tag@") + elseif(show_ref_output MATCHES "^[a-z0-9]+[ \\t]+refs/heads/") # Given a branch name without any remote and we already have a branch by that # name. We might already have that branch checked out or it might be a - # different branch. It isn't safe to use a bare branch name without the - # remote, so do a fetch and replace the ref with one that includes the remote. - set(fetch_required YES) + # different branch. It isn't fully safe to use a bare branch name without the + # remote, so do a fetch (if allowed) and replace the ref with one that + # includes the remote. + if(can_fetch) + do_fetch() + endif() set(checkout_name "@git_remote_name@/@git_tag@") else() @@ -70,20 +86,26 @@ else() elseif(tag_sha STREQUAL "") # We don't know about this ref yet, so we have no choice but to fetch. + if(NOT can_fetch) + message(FATAL_ERROR + "Requested git ref \"@git_tag@\" is not present locally, and not " + "allowed to contact remote due to UPDATE_DISCONNECTED setting." + ) + endif() + # We deliberately swallow any error message at the default log level # because it can be confusing for users to see a failed git command. # That failure is being handled here, so it isn't an error. - set(fetch_required YES) - set(checkout_name "@git_tag@") if(NOT error_msg STREQUAL "") message(VERBOSE "${error_msg}") endif() + do_fetch() + set(checkout_name "@git_tag@") else() # We have the commit, so we know we were asked to find a commit hash # (otherwise it would have been handled further above), but we don't - # have that commit checked out yet - set(fetch_required NO) + # have that commit checked out yet. We don't need to fetch from the remote. set(checkout_name "@git_tag@") if(NOT error_msg STREQUAL "") message(WARNING "${error_msg}") @@ -92,15 +114,6 @@ else() endif() endif() -if(fetch_required) - message(VERBOSE "Fetching latest from the remote @git_remote_name@") - execute_process( - COMMAND "@git_EXECUTABLE@" --git-dir=.git fetch --tags --force "@git_remote_name@" - WORKING_DIRECTORY "@work_dir@" - COMMAND_ERROR_IS_FATAL ANY - ) -endif() - set(git_update_strategy "@git_update_strategy@") if(git_update_strategy STREQUAL "") # Backward compatibility requires REBASE as the default behavior @@ -270,7 +283,9 @@ endif() set(init_submodules "@init_submodules@") if(init_submodules) execute_process( - COMMAND "@git_EXECUTABLE@" --git-dir=.git submodule update @git_submodules_recurse@ --init @git_submodules@ + COMMAND "@git_EXECUTABLE@" + --git-dir=.git @git_submodules_config_options@ + submodule update @git_submodules_recurse@ --init @git_submodules@ WORKING_DIRECTORY "@work_dir@" COMMAND_ERROR_IS_FATAL ANY ) diff --git a/Modules/ExternalProject/shared_internal_commands.cmake b/Modules/ExternalProject/shared_internal_commands.cmake new file mode 100644 index 0000000..ca3cd9f --- /dev/null +++ b/Modules/ExternalProject/shared_internal_commands.cmake @@ -0,0 +1,182 @@ +cmake_policy(VERSION 3.25) + +# Determine the remote URL of the project containing the working_directory. +# This will leave output_variable unset if the URL can't be determined. +function(_ep_get_git_remote_url output_variable working_directory) + set("${output_variable}" "" PARENT_SCOPE) + + find_package(Git QUIET REQUIRED) + + execute_process( + COMMAND ${GIT_EXECUTABLE} symbolic-ref --short HEAD + WORKING_DIRECTORY "${working_directory}" + OUTPUT_VARIABLE git_symbolic_ref + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET + ) + + if(NOT git_symbolic_ref STREQUAL "") + # We are potentially on a branch. See if that branch is associated with + # an upstream remote (might be just a local one or not a branch at all). + execute_process( + COMMAND ${GIT_EXECUTABLE} config branch.${git_symbolic_ref}.remote + WORKING_DIRECTORY "${working_directory}" + OUTPUT_VARIABLE git_remote_name + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET + ) + endif() + + if(NOT git_remote_name) + # Can't select a remote based on a branch. If there's only one remote, + # or we have multiple remotes but one is called "origin", choose that. + execute_process( + COMMAND ${GIT_EXECUTABLE} remote + WORKING_DIRECTORY "${working_directory}" + OUTPUT_VARIABLE git_remote_list + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET + ) + string(REPLACE "\n" ";" git_remote_list "${git_remote_list}") + list(LENGTH git_remote_list git_remote_list_length) + + if(git_remote_list_length EQUAL 0) + message(FATAL_ERROR "Git remote not found in parent project.") + elseif(git_remote_list_length EQUAL 1) + list(GET git_remote_list 0 git_remote_name) + else() + set(base_warning_msg "Multiple git remotes found for parent project") + if("origin" IN_LIST git_remote_list) + message(WARNING "${base_warning_msg}, defaulting to origin.") + set(git_remote_name "origin") + else() + message(FATAL_ERROR "${base_warning_msg}, none of which are origin.") + endif() + endif() + endif() + + if(GIT_VERSION VERSION_LESS 1.7.5) + set(_git_remote_url_cmd_args config remote.${git_remote_name}.url) + elseif(GIT_VERSION VERSION_LESS 2.7) + set(_git_remote_url_cmd_args ls-remote --get-url ${git_remote_name}) + else() + set(_git_remote_url_cmd_args remote get-url ${git_remote_name}) + endif() + + execute_process( + COMMAND ${GIT_EXECUTABLE} ${_git_remote_url_cmd_args} + WORKING_DIRECTORY "${working_directory}" + OUTPUT_VARIABLE git_remote_url + OUTPUT_STRIP_TRAILING_WHITESPACE + COMMAND_ERROR_IS_FATAL LAST + ENCODING UTF-8 # Needed to handle non-ascii characters in local paths + ) + + set("${output_variable}" "${git_remote_url}" PARENT_SCOPE) +endfunction() + +function(_ep_is_relative_git_remote output_variable remote_url) + if(remote_url MATCHES "^\\.\\./") + set("${output_variable}" TRUE PARENT_SCOPE) + else() + set("${output_variable}" FALSE PARENT_SCOPE) + endif() +endfunction() + +# Return an absolute remote URL given an existing remote URL and relative path. +# The output_variable will be set to an empty string if an absolute URL +# could not be computed (no error message is output). +function(_ep_resolve_relative_git_remote + output_variable + parent_remote_url + relative_remote_url +) + set("${output_variable}" "" PARENT_SCOPE) + + if(parent_remote_url STREQUAL "") + return() + endif() + + string(REGEX MATCH + "^(([A-Za-z0-9][A-Za-z0-9+.-]*)://)?(([^/@]+)@)?(\\[[A-Za-z0-9:]+\\]|[^/:]+)?([/:]/?)(.+(\\.git)?/?)$" + git_remote_url_components + "${parent_remote_url}" + ) + + set(protocol "${CMAKE_MATCH_1}") + set(auth "${CMAKE_MATCH_3}") + set(host "${CMAKE_MATCH_5}") + set(separator "${CMAKE_MATCH_6}") + set(path "${CMAKE_MATCH_7}") + + string(REPLACE "/" ";" remote_path_components "${path}") + string(REPLACE "/" ";" relative_path_components "${relative_remote_url}") + + foreach(relative_path_component IN LISTS relative_path_components) + if(NOT relative_path_component STREQUAL "..") + break() + endif() + + list(LENGTH remote_path_components remote_path_component_count) + + if(remote_path_component_count LESS 1) + return() + endif() + + list(POP_BACK remote_path_components) + list(POP_FRONT relative_path_components) + endforeach() + + list(APPEND final_path_components ${remote_path_components} ${relative_path_components}) + list(JOIN final_path_components "/" path) + + set("${output_variable}" "${protocol}${auth}${host}${separator}${path}" PARENT_SCOPE) +endfunction() + +# The output_variable will be set to the original git_repository if it +# could not be resolved (no error message is output). The original value is +# also returned if it doesn't need to be resolved. +function(_ep_resolve_git_remote + output_variable + git_repository + cmp0150 + cmp0150_old_base_dir +) + if(git_repository STREQUAL "") + set("${output_variable}" "" PARENT_SCOPE) + return() + endif() + + _ep_is_relative_git_remote(_git_repository_is_relative "${git_repository}") + + if(NOT _git_repository_is_relative) + set("${output_variable}" "${git_repository}" PARENT_SCOPE) + return() + endif() + + if(cmp0150 STREQUAL "NEW") + _ep_get_git_remote_url(_parent_git_remote_url "${CMAKE_CURRENT_SOURCE_DIR}") + _ep_resolve_relative_git_remote(_resolved_git_remote_url "${_parent_git_remote_url}" "${git_repository}") + + if(_resolved_git_remote_url STREQUAL "") + message(FATAL_ERROR + "Failed to resolve relative git remote URL:\n" + " Relative URL: ${git_repository}\n" + " Parent URL: ${_parent_git_remote_url}" + ) + endif() + set("${output_variable}" "${_resolved_git_remote_url}" PARENT_SCOPE) + return() + elseif(cmp0150 STREQUAL "") + cmake_policy(GET_WARNING CMP0150 _cmp0150_warning) + message(AUTHOR_WARNING + "${_cmp0150_warning}\n" + "A relative GIT_REPOSITORY path was detected. " + "This will be interpreted as a local path to where the project is being cloned. " + "Set GIT_REPOSITORY to an absolute path or set policy CMP0150 to NEW to avoid " + "this warning." + ) + endif() + + set("${output_variable}" "${cmp0150_old_base_dir}/${git_repository}" PARENT_SCOPE) +endfunction() diff --git a/Modules/FetchContent.cmake b/Modules/FetchContent.cmake index 8afb9bc..4ff43ed 100644 --- a/Modules/FetchContent.cmake +++ b/Modules/FetchContent.cmake @@ -665,10 +665,16 @@ A number of cache variables can influence the behavior where details from a This is a less severe download/update control compared to :variable:`FETCHCONTENT_FULLY_DISCONNECTED`. Instead of bypassing all download and update logic, ``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 - :variable:`FETCHCONTENT_FULLY_DISCONNECTED`. It is ``OFF`` by default. + prevents the update step from making connections to remote servers + when using the git or hg download methods. Updates still occur if details + about the update step change, but the update is attempted with only the + information already available locally (so switching to a different tag or + commit that is already fetched locally will succeed, but switching to an + unknown commit hash will fail). The download step is not affected, so if + content has not been downloaded previously, it will still be downloaded + when this option is enabled. This can speed up the configure step, but + not as much as :variable:`FETCHCONTENT_FULLY_DISCONNECTED`. + ``FETCHCONTENT_UPDATES_DISCONNECTED`` is ``OFF`` by default. .. variable:: FETCHCONTENT_TRY_FIND_PACKAGE_MODE @@ -735,10 +741,11 @@ content name: This is the per-content equivalent of :variable:`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. + this option is ``ON``, then updates for the git and hg methods will not + contact any remote for the named content. They will only use information + already available locally. Disabling updates for individual content can + be useful for content whose details rarely change, while still leaving + other frequently changing content with updates enabled. .. _`fetch-content-examples`: @@ -1076,6 +1083,8 @@ current working directory. #]=======================================================================] +include(${CMAKE_CURRENT_LIST_DIR}/ExternalProject/shared_internal_commands.cmake) + #======================================================================= # Recording and retrieving content details for later population #======================================================================= @@ -1223,6 +1232,7 @@ function(FetchContent_Declare contentName) # cannot check for multi-value arguments with this method. We will have to # handle the URL keyword differently. set(oneValueArgs + GIT_REPOSITORY SVN_REPOSITORY DOWNLOAD_NO_EXTRACT DOWNLOAD_EXTRACT_TIMESTAMP @@ -1242,6 +1252,30 @@ function(FetchContent_Declare contentName) set(ARG_SOURCE_DIR "${FETCHCONTENT_BASE_DIR}/${contentNameLower}-src") endif() + if(ARG_GIT_REPOSITORY) + # We resolve the GIT_REPOSITORY here so that we get the right parent in the + # remote selection logic. In the sub-build, ExternalProject_Add() would see + # the private sub-build directory as the parent project, but the parent + # project should be the one that called FetchContent_Declare(). We resolve + # a relative repo here so that the sub-build's ExternalProject_Add() only + # ever sees a non-relative repo. + # Since these checks may be non-trivial on some platforms (notably Windows), + # don't perform them if we won't be using these details. This also allows + # projects to override calls with relative URLs when they have checked out + # the parent project in an unexpected way, such as from a mirror or fork. + set(savedDetailsPropertyName "_FetchContent_${contentNameLower}_savedDetails") + get_property(alreadyDefined GLOBAL PROPERTY ${savedDetailsPropertyName} DEFINED) + if(NOT alreadyDefined) + cmake_policy(GET CMP0150 cmp0150 + PARENT_SCOPE # undocumented, do not use outside of CMake + ) + _ep_resolve_git_remote(_resolved_git_repository + "${ARG_GIT_REPOSITORY}" "${cmp0150}" "${FETCHCONTENT_BASE_DIR}" + ) + set(ARG_GIT_REPOSITORY "${_resolved_git_repository}") + endif() + endif() + 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 @@ -1302,9 +1336,11 @@ function(FetchContent_Declare contentName) endif() # Add back in the keyword args we pulled out and potentially tweaked/added + set(sep EXTERNALPROJECT_INTERNAL_ARGUMENT_SEPARATOR) foreach(key IN LISTS oneValueArgs) if(DEFINED ARG_${key}) - list(PREPEND ARG_UNPARSED_ARGUMENTS ${key} "${ARG_${key}}") + list(PREPEND ARG_UNPARSED_ARGUMENTS ${key} "${ARG_${key}}" ${sep}) + set(sep "") endif() endforeach() @@ -1536,7 +1572,9 @@ ExternalProject_Add_Step(${contentName}-populate copyfile if(CMAKE_GENERATOR_TOOLSET) list(APPEND subCMakeOpts "-T${CMAKE_GENERATOR_TOOLSET}") endif() - + if(CMAKE_GENERATOR_INSTANCE) + list(APPEND subCMakeOpts "-DCMAKE_GENERATOR_INSTANCE:INTERNAL=${CMAKE_GENERATOR_INSTANCE}") + endif() if(CMAKE_MAKE_PROGRAM) list(APPEND subCMakeOpts "-DCMAKE_MAKE_PROGRAM:FILEPATH=${CMAKE_MAKE_PROGRAM}") endif() @@ -1596,7 +1634,9 @@ set_property(GLOBAL PROPERTY _CMAKE_FindGit_GIT_EXECUTABLE_VERSION # has this set to something not findable on the PATH. We also ensured above # that the Debug config will be defined for multi-config generators. configure_file("${CMAKE_CURRENT_FUNCTION_LIST_DIR}/FetchContent/CMakeLists.cmake.in" - "${ARG_SUBBUILD_DIR}/CMakeLists.txt") + "${ARG_SUBBUILD_DIR}/CMakeLists.txt" + @ONLY + ) execute_process( COMMAND ${CMAKE_COMMAND} ${subCMakeOpts} . RESULT_VARIABLE result diff --git a/Modules/FetchContent/CMakeLists.cmake.in b/Modules/FetchContent/CMakeLists.cmake.in index d94b0f4..8adb533 100644 --- a/Modules/FetchContent/CMakeLists.cmake.in +++ b/Modules/FetchContent/CMakeLists.cmake.in @@ -1,21 +1,27 @@ # 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}) +cmake_minimum_required(VERSION @CMAKE_VERSION@) + +# Reject any attempt to use a toolchain file. We must not use one because +# we could be downloading it here. If the CMAKE_TOOLCHAIN_FILE environment +# variable is set, the cache variable will have been initialized from it. +unset(CMAKE_TOOLCHAIN_FILE CACHE) +unset(ENV{CMAKE_TOOLCHAIN_FILE}) # 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) +project(@contentName@-populate NONE) @__FETCHCONTENT_CACHED_INFO@ include(ExternalProject) -ExternalProject_Add(${contentName}-populate - ${ARG_EXTRA} - SOURCE_DIR "${ARG_SOURCE_DIR}" - BINARY_DIR "${ARG_BINARY_DIR}" +ExternalProject_Add(@contentName@-populate + @ARG_EXTRA@ + SOURCE_DIR "@ARG_SOURCE_DIR@" + BINARY_DIR "@ARG_BINARY_DIR@" CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "" diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake index 7af1017..39a1163 100644 --- a/Modules/FindBLAS.cmake +++ b/Modules/FindBLAS.cmake @@ -93,6 +93,11 @@ BLAS/LAPACK Vendors ``ACML``, ``ACML_MP``, ``ACML_GPU`` AMD Core Math Library +``AOCL``, ``AOCL_mt`` + .. versionadded:: 3.27 + + AMD Optimizing CPU Libraries + ``Apple``, ``NAS`` Apple BLAS (Accelerate), and Apple NAS (vecLib) @@ -386,10 +391,10 @@ set(BLAS_LINKER_FLAGS) set(BLAS_LIBRARIES) set(BLAS95_LIBRARIES) set(_blas_fphsa_req_var BLAS_LIBRARIES) -if(NOT $ENV{BLA_VENDOR} STREQUAL "") - set(BLA_VENDOR $ENV{BLA_VENDOR}) -else() - if(NOT BLA_VENDOR) +if(NOT BLA_VENDOR) + if(NOT "$ENV{BLA_VENDOR}" STREQUAL "") + set(BLA_VENDOR "$ENV{BLA_VENDOR}") + else() set(BLA_VENDOR "All") endif() endif() @@ -848,6 +853,38 @@ if(BLA_VENDOR STREQUAL "FLAME" OR BLA_VENDOR STREQUAL "All") unset(_blas_flame_lib) endif() +# AOCL's blis library? (https://developer.amd.com/amd-aocl/) +if(BLA_VENDOR MATCHES "AOCL" OR BLA_VENDOR STREQUAL "All") + set(_blas_aocl_lib "blis") + + if(_blas_sizeof_integer EQUAL 8) + set(_blas_aocl_subdir "ILP64") + else() + set(_blas_aocl_subdir "LP64") + endif() + + # Check for multi-threaded support + if(BLA_VENDOR MATCHES "_mt") + string(APPEND _blas_aocl_lib "-mt") + endif() + + if(NOT BLAS_LIBRARIES) + check_blas_libraries( + BLAS_LIBRARIES + BLAS + sgemm + "" + "${_blas_aocl_lib}" + "" + "" + "${_blas_aocl_subdir}" + ) + endif() + + unset(_blas_aocl_lib) + unset(_blas_aocl_subdir) +endif() + # BLAS in the ATLAS library? (http://math-atlas.sourceforge.net/) if(BLA_VENDOR STREQUAL "ATLAS" OR BLA_VENDOR STREQUAL "All") if(NOT BLAS_LIBRARIES) diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 72a9a4c..f2e4804 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -1380,7 +1380,7 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret) set(_Boost_TIMER_DEPENDENCIES chrono) set(_Boost_WAVE_DEPENDENCIES filesystem serialization thread chrono atomic) set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) - if(Boost_VERSION_STRING VERSION_GREATER_EQUAL 1.82.0 AND NOT Boost_NO_WARN_NEW_VERSIONS) + if(Boost_VERSION_STRING VERSION_GREATER_EQUAL 1.83.0 AND NOT Boost_NO_WARN_NEW_VERSIONS) message(WARNING "New Boost version may have incorrect or missing dependencies and imported targets") endif() endif() @@ -1445,6 +1445,7 @@ function(_Boost_COMPONENT_HEADERS component _hdrs) set(_Boost_MATH_TR1L_HEADERS "boost/math/tr1.hpp") set(_Boost_MPI_HEADERS "boost/mpi.hpp") set(_Boost_MPI_PYTHON_HEADERS "boost/mpi/python/config.hpp") + set(_Boost_MYSQL_HEADERS "boost/mysql.hpp") set(_Boost_NUMPY_HEADERS "boost/python/numpy.hpp") set(_Boost_NOWIDE_HEADERS "boost/nowide/cstdlib.hpp") set(_Boost_PRG_EXEC_MONITOR_HEADERS "boost/test/prg_exec_monitor.hpp") @@ -1654,7 +1655,7 @@ else() # _Boost_COMPONENT_HEADERS. See the instructions at the top of # _Boost_COMPONENT_DEPENDENCIES. set(_Boost_KNOWN_VERSIONS ${Boost_ADDITIONAL_VERSIONS} - "1.81.0" "1.81" "1.80.0" "1.80" "1.79.0" "1.79" + "1.82.0" "1.82" "1.81.0" "1.81" "1.80.0" "1.80" "1.79.0" "1.79" "1.78.0" "1.78" "1.77.0" "1.77" "1.76.0" "1.76" "1.75.0" "1.75" "1.74.0" "1.74" "1.73.0" "1.73" "1.72.0" "1.72" "1.71.0" "1.71" "1.70.0" "1.70" "1.69.0" "1.69" "1.68.0" "1.68" "1.67.0" "1.67" "1.66.0" "1.66" "1.65.1" "1.65.0" "1.65" diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index c928157..0d7f1a4 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -2,7 +2,12 @@ FindCUDA -------- -.. warning:: *Deprecated since version 3.10.* +.. versionchanged:: 3.27 + This module is available only if policy :policy:`CMP0146` is not set to ``NEW``. + Port projects to CMake's first-class ``CUDA`` language support. + +.. deprecated:: 3.10 + Do not use this module in new code. It is no longer necessary to use this module or call ``find_package(CUDA)`` for compiling CUDA code. Instead, list ``CUDA`` among the languages named @@ -555,6 +560,23 @@ The script defines the following variables: # ############################################################################### +cmake_policy(GET CMP0146 _FindCUDA_CMP0146) +if(_FindCUDA_CMP0146 STREQUAL "NEW") + message(FATAL_ERROR "The FindCUDA module has been removed by policy CMP0146.") +endif() + +if(CMAKE_GENERATOR MATCHES "Visual Studio") + cmake_policy(GET CMP0147 _FindCUDA_CMP0147) + if(_FindCUDA_CMP0147 STREQUAL "NEW") + message(FATAL_ERROR "The FindCUDA module does not work in Visual Studio with policy CMP0147.") + endif() +endif() + +if(_FindCUDA_testing) + set(_FindCUDA_included TRUE) + return() +endif() + # FindCUDA.cmake # This macro helps us find the location of helper files we will need the full path to @@ -1052,6 +1074,7 @@ if(CUDA_USE_STATIC_CUDA_RUNTIME) if(NOT APPLE AND NOT (CMAKE_SYSTEM_NAME STREQUAL "QNX")) #On Linux, you must link against librt when using the static cuda runtime. find_library(CUDA_rt_LIBRARY rt) + mark_as_advanced(CUDA_rt_LIBRARY) if (NOT CUDA_rt_LIBRARY) message(WARNING "Expecting to find librt for libcudart_static, but didn't find it.") endif() @@ -1919,7 +1942,7 @@ function(CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS output_file cuda_target options list(APPEND flags -Xcompiler ${f}) endforeach() - # Add our general CUDA_NVCC_FLAGS with the configuration specifig flags + # Add our general CUDA_NVCC_FLAGS with the configuration specific flags set(nvcc_flags ${CUDA_NVCC_FLAGS} ${config_specific_flags} ${nvcc_flags}) file(RELATIVE_PATH output_file_relative_path "${CMAKE_BINARY_DIR}" "${output_file}") diff --git a/Modules/FindCUDAToolkit.cmake b/Modules/FindCUDAToolkit.cmake index cb5da8c..c2627e7 100644 --- a/Modules/FindCUDAToolkit.cmake +++ b/Modules/FindCUDAToolkit.cmake @@ -109,6 +109,7 @@ of the following libraries that are part of the CUDAToolkit: - :ref:`CUDA Runtime Library<cuda_toolkit_rt_lib>` - :ref:`CUDA Driver Library<cuda_toolkit_driver_lib>` - :ref:`cuBLAS<cuda_toolkit_cuBLAS>` +- :ref:`cuDLA<cuda_toolkit_cuDLA>` - :ref:`cuFile<cuda_toolkit_cuFile>` - :ref:`cuFFT<cuda_toolkit_cuFFT>` - :ref:`cuRAND<cuda_toolkit_cuRAND>` @@ -166,6 +167,19 @@ Targets Created: - ``CUDA::cublasLt`` starting in CUDA 10.1 - ``CUDA::cublasLt_static`` starting in CUDA 10.1 +.. _`cuda_toolkit_cuDLA`: + +cuDLA +"""""" + +.. versionadded:: 3.27 + +The NVIDIA Tegra Deep Learning Accelerator `cuDLA <https://docs.nvidia.com/cuda/cublas/index.html>`_ library. + +Targets Created: + +- ``CUDA::cudla`` starting in CUDA 11.6 + .. _`cuda_toolkit_cuFile`: cuFile @@ -173,7 +187,7 @@ cuFile .. versionadded:: 3.25 -The NVIDIA GPUDirect Storage `cuFile <https://docs.nvidia.com/cuda/cufile-api/index.html>`_ library. +The NVIDIA GPUDirect Storage `cuFile <https://docs.nvidia.com/gpudirect-storage/api-reference-guide/index.html>`_ library. Targets Created: @@ -236,13 +250,20 @@ Targets Created: cupti """"" -The `NVIDIA CUDA Profiling Tools Interface <https://developer.nvidia.com/CUPTI>`_. +The `NVIDIA CUDA Profiling Tools Interface <https://developer.nvidia.com/cupti>`_. Targets Created: - ``CUDA::cupti`` - ``CUDA::cupti_static`` +.. versionadded:: 3.27 + + - ``CUDA::nvperf_host`` starting in CUDA 10.2 + - ``CUDA::nvperf_host_static`` starting in CUDA 10.2 + - ``CUDA::nvperf_target`` starting in CUDA 10.2 + - ``CUDA::pcsamplingutil`` starting in CUDA 11.3 + .. _`cuda_toolkit_NPP`: NPP @@ -330,7 +351,7 @@ Targets Created: nvGRAPH """"""" -The `nvGRAPH <https://docs.nvidia.com/cuda/nvgraph/index.html>`_ library. +The `nvGRAPH <https://web.archive.org/web/20201111171403/https://docs.nvidia.com/cuda/nvgraph/index.html>`_ library. Removed starting in CUDA 11.0 Targets Created: @@ -374,7 +395,6 @@ nvRTC """"" The `nvRTC <https://docs.nvidia.com/cuda/nvrtc/index.html>`_ (Runtime Compilation) library. -This is a shared library only. Targets Created: @@ -417,7 +437,7 @@ nvToolsExt .. deprecated:: 3.25 With CUDA 10.0+, use :ref:`nvtx3 <cuda_toolkit_nvtx3>`. -The `NVIDIA Tools Extension <https://docs.nvidia.com/gameworks/content/gameworkslibrary/nvtx/nvidia_tools_extension_library_nvtx.htm>`_. +The `NVIDIA Tools Extension <https://docs.nvidia.com/nvtx/>`_. This is a shared library only. Targets Created: @@ -609,8 +629,8 @@ else() endif() unset(_CUDA_NVCC_OUT) - mark_as_advanced(CUDAToolkit_BIN_DIR) set(CUDAToolkit_BIN_DIR "${CUDAToolkit_BIN_DIR}" CACHE PATH "" FORCE) + mark_as_advanced(CUDAToolkit_BIN_DIR) endif() if(CUDAToolkit_SENTINEL_FILE) @@ -1092,6 +1112,11 @@ if(CUDAToolkit_FOUND) _CUDAToolkit_find_and_add_import_lib(cuFile_rdma_static DEPS cuFile_static culibos) endif() + if(CUDAToolkit_VERSION VERSION_GREATER_EQUAL 11.6) + _CUDAToolkit_find_and_add_import_lib(cudla) + endif() + + # cuFFTW depends on cuFFT _CUDAToolkit_find_and_add_import_lib(cufftw DEPS cufft) _CUDAToolkit_find_and_add_import_lib(cufftw_static DEPS cufft_static) @@ -1135,20 +1160,35 @@ if(CUDAToolkit_FOUND) "${CUDAToolkit_INCLUDE_DIR}/../extras/CUPTI/include" "${CUDAToolkit_INCLUDE_DIR}" NO_DEFAULT_PATH) + mark_as_advanced(CUDAToolkit_CUPTI_INCLUDE_DIR) if(CUDAToolkit_CUPTI_INCLUDE_DIR) + set(_cmake_cupti_extra_paths extras/CUPTI/lib64/ + extras/CUPTI/lib/ + ../extras/CUPTI/lib64/ + ../extras/CUPTI/lib/) _CUDAToolkit_find_and_add_import_lib(cupti - EXTRA_PATH_SUFFIXES extras/CUPTI/lib64/ - extras/CUPTI/lib/ - ../extras/CUPTI/lib64/ - ../extras/CUPTI/lib/ + EXTRA_PATH_SUFFIXES ${_cmake_cupti_extra_paths} EXTRA_INCLUDE_DIRS "${CUDAToolkit_CUPTI_INCLUDE_DIR}") _CUDAToolkit_find_and_add_import_lib(cupti_static - EXTRA_PATH_SUFFIXES extras/CUPTI/lib64/ - extras/CUPTI/lib/ - ../extras/CUPTI/lib64/ - ../extras/CUPTI/lib/ + EXTRA_PATH_SUFFIXES ${_cmake_cupti_extra_paths} EXTRA_INCLUDE_DIRS "${CUDAToolkit_CUPTI_INCLUDE_DIR}") + if(CUDAToolkit_VERSION VERSION_GREATER_EQUAL 10.2.0) + _CUDAToolkit_find_and_add_import_lib(nvperf_host + EXTRA_PATH_SUFFIXES ${_cmake_cupti_extra_paths} + EXTRA_INCLUDE_DIRS "${CUDAToolkit_CUPTI_INCLUDE_DIR}") + _CUDAToolkit_find_and_add_import_lib(nvperf_host_static + EXTRA_PATH_SUFFIXES ${_cmake_cupti_extra_paths} + EXTRA_INCLUDE_DIRS "${CUDAToolkit_CUPTI_INCLUDE_DIR}") + _CUDAToolkit_find_and_add_import_lib(nvperf_target + EXTRA_PATH_SUFFIXES ${_cmake_cupti_extra_paths} + EXTRA_INCLUDE_DIRS "${CUDAToolkit_CUPTI_INCLUDE_DIR}") + endif() + if(CUDAToolkit_VERSION VERSION_GREATER_EQUAL 11.3.0) + _CUDAToolkit_find_and_add_import_lib(pcsamplingutil + EXTRA_PATH_SUFFIXES ${_cmake_cupti_extra_paths} + EXTRA_INCLUDE_DIRS "${CUDAToolkit_CUPTI_INCLUDE_DIR}") + endif() endif() if(CUDAToolkit_VERSION VERSION_GREATER_EQUAL 11.1.0) diff --git a/Modules/FindCURL.cmake b/Modules/FindCURL.cmake index acb87dc..2f33dac 100644 --- a/Modules/FindCURL.cmake +++ b/Modules/FindCURL.cmake @@ -58,6 +58,18 @@ returns its results with no further action. Set ``CURL_NO_CURL_CMAKE`` to ``ON`` to disable this search. +Hints +^^^^^ + +``CURL_USE_STATIC_LIBS`` + + .. versionadded:: 3.28 + + Set to ``TRUE`` to use static libraries. + + This is meaningful only when CURL is not found via its + CMake Package Configuration file. + #]=======================================================================] include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) @@ -193,6 +205,11 @@ if(CURL_FOUND) set_target_properties(CURL::libcurl PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${CURL_INCLUDE_DIRS}") + if(CURL_USE_STATIC_LIBS) + set_property(TARGET CURL::libcurl APPEND PROPERTY + INTERFACE_COMPILE_DEFINITIONS "CURL_STATICLIB") + endif() + if(EXISTS "${CURL_LIBRARY}") set_target_properties(CURL::libcurl PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES "C" @@ -212,5 +229,11 @@ if(CURL_FOUND) IMPORTED_LINK_INTERFACE_LANGUAGES "C" IMPORTED_LOCATION_DEBUG "${CURL_LIBRARY_DEBUG}") endif() + + if(CURL_USE_STATIC_LIBS AND MSVC) + set_target_properties(CURL::libcurl PROPERTIES + INTERFACE_LINK_LIBRARIES "normaliz.lib;ws2_32.lib;wldap32.lib") + endif() + endif() endif() diff --git a/Modules/FindCxxTest.cmake b/Modules/FindCxxTest.cmake index 04f8b59..714927f 100644 --- a/Modules/FindCxxTest.cmake +++ b/Modules/FindCxxTest.cmake @@ -7,136 +7,119 @@ FindCxxTest Find CxxTest unit testing framework. -Find the CxxTest suite and declare a helper macro for creating unit -tests and integrating them with CTest. For more details on CxxTest -see https://cxxtest.com +Find the `CxxTest`_ suite and declare a helper macro for creating +unit tests and integrating them with CTest. -INPUT Variables +.. _`CxxTest`: https://github.com/CxxTest/cxxtest#readme -:: +Input Variables +^^^^^^^^^^^^^^^ - CXXTEST_USE_PYTHON [deprecated since 1.3] - Only used in the case both Python & Perl - are detected on the system to control - which CxxTest code generator is used. - Valid only for CxxTest version 3. +``CXXTEST_USE_PYTHON`` + .. deprecated:: 1.3 + Only used in the case both Python & Perl + are detected on the system to control + which CxxTest code generator is used. + Valid only for CxxTest version 3. + In older versions of this Find Module, + this variable controlled if the Python test + generator was used instead of the Perl one, + regardless of which scripting language the + user had installed. -:: +``CXXTEST_TESTGEN_ARGS`` + .. versionadded:: 2.8.3 - NOTE: In older versions of this Find Module, - this variable controlled if the Python test - generator was used instead of the Perl one, - regardless of which scripting language the - user had installed. + Specify a list of options to pass to the CxxTest code + generator. If not defined, ``--error-printer`` is passed. +Result Variables +^^^^^^^^^^^^^^^^ +``CXXTEST_FOUND`` + True if the CxxTest framework was found -:: +``CXXTEST_INCLUDE_DIRS`` + Where to find the CxxTest include directory - CXXTEST_TESTGEN_ARGS (since CMake 2.8.3) - Specify a list of options to pass to the CxxTest code - generator. If not defined, --error-printer is - passed. +``CXXTEST_PERL_TESTGEN_EXECUTABLE`` + The perl-based test generator +``CXXTEST_PYTHON_TESTGEN_EXECUTABLE`` + The python-based test generator +``CXXTEST_TESTGEN_EXECUTABLE`` + .. versionadded:: 2.8.3 -OUTPUT Variables + The test generator that is actually used (chosen using user preferences + and interpreters found in the system) -:: +``CXXTEST_TESTGEN_INTERPRETER`` + .. versionadded:: 2.8.3 - CXXTEST_FOUND - True if the CxxTest framework was found - CXXTEST_INCLUDE_DIRS - Where to find the CxxTest include directory - CXXTEST_PERL_TESTGEN_EXECUTABLE - The perl-based test generator - CXXTEST_PYTHON_TESTGEN_EXECUTABLE - The python-based test generator - CXXTEST_TESTGEN_EXECUTABLE (since CMake 2.8.3) - The test generator that is actually used (chosen using user preferences - and interpreters found in the system) - CXXTEST_TESTGEN_INTERPRETER (since CMake 2.8.3) - The full path to the Perl or Python executable on the system, on - platforms where the script cannot be executed using its shebang line. + The full path to the Perl or Python executable on the system, on + platforms where the script cannot be executed using its shebang line. +Module Commands +^^^^^^^^^^^^^^^ -MACROS for optional use by CMake users: +.. command:: cxxtest_add_test -:: + Create a CxxTest runner and adds it to the CTest testing suite:: - CXXTEST_ADD_TEST(<test_name> <gen_source_file> <input_files_to_testgen...>) - Creates a CxxTest runner and adds it to the CTest testing suite - Parameters: - test_name The name of the test - gen_source_file The generated source filename to be - generated by CxxTest - input_files_to_testgen The list of header files containing the - CxxTest::TestSuite's to be included in - this runner + CXXTEST_ADD_TEST(<test_name> <gen_source_file> + <input_files_to_testgen>...) + Parameters: + ``test_name`` + The name of the test -:: + ``gen_source_file`` + The generated source filename to be generated by CxxTest - #============== - Example Usage: + ``input_files_to_testgen`` + The list of header files containing the CxxTest::TestSuite's + to be included in this runner +Example Usage +^^^^^^^^^^^^^ +The following example, if CxxTest is found, will: -:: +* Invoke the testgen executable to autogenerate foo_test.cc in the + binary tree from "foo_test.h" in the current source directory. +* Create an executable and test called unittest_foo. - find_package(CxxTest) - if(CXXTEST_FOUND) - include_directories(${CXXTEST_INCLUDE_DIR}) - enable_testing() +.. code-block:: cmake + find_package(CxxTest) + if(CXXTEST_FOUND) + include_directories(${CXXTEST_INCLUDE_DIR}) + enable_testing() + CXXTEST_ADD_TEST(unittest_foo foo_test.cc + ${CMAKE_CURRENT_SOURCE_DIR}/foo_test.h) + target_link_libraries(unittest_foo foo) # as needed + endif() +``foo_test.h`` contains: -:: - - CXXTEST_ADD_TEST(unittest_foo foo_test.cc - ${CMAKE_CURRENT_SOURCE_DIR}/foo_test.h) - target_link_libraries(unittest_foo foo) # as needed - endif() - - - -:: - - This will (if CxxTest is found): - 1. Invoke the testgen executable to autogenerate foo_test.cc in the - binary tree from "foo_test.h" in the current source directory. - 2. Create an executable and test called unittest_foo. - - - -:: - - #============= - Example foo_test.h: - - - -:: - - #include <cxxtest/TestSuite.h> - - +.. code-block:: c++ -:: + #include <cxxtest/TestSuite.h> + class MyTestSuite : public CxxTest::TestSuite + { + public: + void testAddition( void ) + { + TS_ASSERT( 1 + 1 > 1 ); + TS_ASSERT_EQUALS( 1 + 1, 2 ); + } + }; - class MyTestSuite : public CxxTest::TestSuite - { - public: - void testAddition( void ) - { - TS_ASSERT( 1 + 1 > 1 ); - TS_ASSERT_EQUALS( 1 + 1, 2 ); - } - }; #]=======================================================================] # Version 1.4 (11/18/10) (CMake 2.8.4) diff --git a/Modules/FindDart.cmake b/Modules/FindDart.cmake index 0492578..fed50e1 100644 --- a/Modules/FindDart.cmake +++ b/Modules/FindDart.cmake @@ -5,12 +5,20 @@ FindDart -------- +.. deprecated:: 3.27 + This module is available only if policy :policy:`CMP0145` is not set to ``NEW``. + Find DART This module looks for the dart testing software and sets DART_ROOT to point to where it found it. #]=======================================================================] +if(_FindDart_testing) + set(_FindDart_included TRUE) + return() +endif() + find_path(DART_ROOT README.INSTALL HINTS ENV DART_ROOT diff --git a/Modules/FindDoxygen.cmake b/Modules/FindDoxygen.cmake index ef9801e..76f4759 100644 --- a/Modules/FindDoxygen.cmake +++ b/Modules/FindDoxygen.cmake @@ -76,7 +76,8 @@ Functions [ALL] [USE_STAMP_FILE] [WORKING_DIRECTORY dir] - [COMMENT comment]) + [COMMENT comment] + [CONFIG_FILE filename]) The function constructs a ``Doxyfile`` and defines a custom target that runs Doxygen on that generated file. The listed files and directories are used as @@ -97,6 +98,10 @@ Functions the :command:`add_custom_target` command used to create the custom target internally. + .. versionadded:: 3.27 + If ``CONFIG_FILE`` is set, the given file provided with full-path + will be used as doxygen configuration file + .. versionadded:: 3.12 If ``ALL`` is set, the target will be added to the default build target. @@ -864,7 +869,7 @@ endfunction() function(doxygen_add_docs targetName) set(_options ALL USE_STAMP_FILE) - set(_one_value_args WORKING_DIRECTORY COMMENT) + set(_one_value_args WORKING_DIRECTORY COMMENT CONFIG_FILE) set(_multi_value_args) cmake_parse_arguments(_args "${_options}" @@ -1166,8 +1171,15 @@ doxygen_add_docs() for target ${targetName}") # Prepare doxygen configuration file set(_doxyfile_template "${CMAKE_BINARY_DIR}/CMakeDoxyfile.in") - set(_target_doxyfile "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile.${targetName}") - configure_file("${_doxyfile_template}" "${_target_doxyfile}") + if(_args_CONFIG_FILE) + if(NOT EXISTS "${_args_CONFIG_FILE}") + message(FATAL_ERROR "Option CONFIG_FILE specifies file:\n ${_args_CONFIG_FILE}\nbut it does not exist.") + endif() + set(_target_doxyfile "${_args_CONFIG_FILE}") + else() + set(_target_doxyfile "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile.${targetName}") + configure_file("${_doxyfile_template}" "${_target_doxyfile}") + endif() unset(_all) if(${_args_ALL}) diff --git a/Modules/FindEXPAT.cmake b/Modules/FindEXPAT.cmake index f9cb432..762931e 100644 --- a/Modules/FindEXPAT.cmake +++ b/Modules/FindEXPAT.cmake @@ -30,6 +30,15 @@ This module will set the following variables in your project: ``EXPAT_FOUND`` true if the Expat headers and libraries were found. +Hints +^^^^^ + +``EXPAT_USE_STATIC_LIBS`` + + .. versionadded:: 3.28 + + Set to ``TRUE`` to use static libraries. + #]=======================================================================] find_package(PkgConfig QUIET) @@ -39,27 +48,67 @@ pkg_check_modules(PC_EXPAT QUIET expat) # Look for the header file. find_path(EXPAT_INCLUDE_DIR NAMES expat.h HINTS ${PC_EXPAT_INCLUDE_DIRS}) -# Look for the library. -find_library(EXPAT_LIBRARY NAMES expat libexpat NAMES_PER_DIR HINTS ${PC_EXPAT_LIBRARY_DIRS}) - -if (EXPAT_INCLUDE_DIR AND EXISTS "${EXPAT_INCLUDE_DIR}/expat.h") - file(STRINGS "${EXPAT_INCLUDE_DIR}/expat.h" expat_version_str - REGEX "^#[\t ]*define[\t ]+XML_(MAJOR|MINOR|MICRO)_VERSION[\t ]+[0-9]+$") - - unset(EXPAT_VERSION_STRING) - foreach(VPART MAJOR MINOR MICRO) - foreach(VLINE ${expat_version_str}) - if(VLINE MATCHES "^#[\t ]*define[\t ]+XML_${VPART}_VERSION[\t ]+([0-9]+)$") - set(EXPAT_VERSION_PART "${CMAKE_MATCH_1}") - if(EXPAT_VERSION_STRING) - string(APPEND EXPAT_VERSION_STRING ".${EXPAT_VERSION_PART}") - else() - set(EXPAT_VERSION_STRING "${EXPAT_VERSION_PART}") - endif() - endif() - endforeach() +set(EXPAT_NAMES expat expatw) +set(EXPAT_NAMES_DEBUG expatd expatwd) + +if(WIN32) + if(EXPAT_USE_STATIC_LIBS) + list(APPEND EXPAT_NAMES expatMT expatwMT) + list(APPEND EXPAT_NAMES_DEBUG expatdMT expatwdMT) + else() + list(APPEND EXPAT_NAMES expatMT expatMD expatwMT expatwMD) + list(APPEND EXPAT_NAMES_DEBUG expatdMT expatdMD expatwdMT expatwdMD) + endif() +endif() + +# Allow EXPAT_LIBRARY to be set manually, as the location of the expat library +if(NOT EXPAT_LIBRARY) + if(DEFINED CMAKE_FIND_LIBRARY_PREFIXES) + set(_expat_ORIG_CMAKE_FIND_LIBRARY_PREFIXES "${CMAKE_FIND_LIBRARY_PREFIXES}") + else() + set(_expat_ORIG_CMAKE_FIND_LIBRARY_PREFIXES) + endif() + + if(WIN32) + list(APPEND CMAKE_FIND_LIBRARY_PREFIXES "" "lib") + endif() + + # Look for the library. + find_library(EXPAT_LIBRARY_RELEASE NAMES ${EXPAT_NAMES} NAMES_PER_DIR HINTS ${PC_EXPAT_LIBRARY_DIRS} PATH_SUFFIXES lib) + find_library(EXPAT_LIBRARY_DEBUG NAMES ${EXPAT_NAMES_DEBUG} NAMES_PER_DIR HINTS ${PC_EXPAT_LIBRARY_DIRS} PATH_SUFFIXES lib) + + # Restore the original find library ordering + if(DEFINED _expat_ORIG_CMAKE_FIND_LIBRARY_PREFIXES) + set(CMAKE_FIND_LIBRARY_PREFIXES "${_expat_ORIG_CMAKE_FIND_LIBRARY_PREFIXES}") + else() + set(CMAKE_FIND_LIBRARY_PREFIXES) + endif() + + include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake) + select_library_configurations(EXPAT) +endif() + +unset(EXPAT_NAMES) +unset(EXPAT_NAMES_DEBUG) + +if(EXPAT_INCLUDE_DIR AND EXISTS "${EXPAT_INCLUDE_DIR}/expat.h") + file(STRINGS "${EXPAT_INCLUDE_DIR}/expat.h" expat_version_str + REGEX "^#[\t ]*define[\t ]+XML_(MAJOR|MINOR|MICRO)_VERSION[\t ]+[0-9]+$") + + unset(EXPAT_VERSION_STRING) + foreach(VPART MAJOR MINOR MICRO) + foreach(VLINE ${expat_version_str}) + if(VLINE MATCHES "^#[\t ]*define[\t ]+XML_${VPART}_VERSION[\t ]+([0-9]+)$") + set(EXPAT_VERSION_PART "${CMAKE_MATCH_1}") + if(EXPAT_VERSION_STRING) + string(APPEND EXPAT_VERSION_STRING ".${EXPAT_VERSION_PART}") + else() + set(EXPAT_VERSION_STRING "${EXPAT_VERSION_PART}") + endif() + endif() endforeach() -endif () + endforeach() +endif() include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(EXPAT @@ -68,15 +117,41 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(EXPAT # Copy the results to the output variables and target. if(EXPAT_FOUND) - set(EXPAT_LIBRARIES ${EXPAT_LIBRARY}) set(EXPAT_INCLUDE_DIRS ${EXPAT_INCLUDE_DIR}) + if(NOT EXPAT_LIBRARIES) + set(EXPAT_LIBRARIES ${EXPAT_LIBRARY}) + endif() + if(NOT TARGET EXPAT::EXPAT) add_library(EXPAT::EXPAT UNKNOWN IMPORTED) set_target_properties(EXPAT::EXPAT PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES "C" - IMPORTED_LOCATION "${EXPAT_LIBRARY}" INTERFACE_INCLUDE_DIRECTORIES "${EXPAT_INCLUDE_DIRS}") + + if(EXPAT_USE_STATIC_LIBS) + set_property(TARGET EXPAT::EXPAT APPEND PROPERTY + INTERFACE_COMPILE_DEFINITIONS "XML_STATIC") + endif() + + if(EXPAT_LIBRARY_RELEASE) + set_property(TARGET EXPAT::EXPAT APPEND PROPERTY + IMPORTED_CONFIGURATIONS RELEASE) + set_target_properties(EXPAT::EXPAT PROPERTIES + IMPORTED_LOCATION_RELEASE "${EXPAT_LIBRARY_RELEASE}") + endif() + + if(EXPAT_LIBRARY_DEBUG) + set_property(TARGET EXPAT::EXPAT APPEND PROPERTY + IMPORTED_CONFIGURATIONS DEBUG) + set_target_properties(EXPAT::EXPAT PROPERTIES + IMPORTED_LOCATION_DEBUG "${EXPAT_LIBRARY_DEBUG}") + endif() + + if(NOT EXPAT_LIBRARY_RELEASE AND NOT EXPAT_LIBRARY_DEBUG) + set_property(TARGET EXPAT::EXPAT APPEND PROPERTY + IMPORTED_LOCATION "${EXPAT_LIBRARY}") + endif() endif() endif() diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake index 6fab08f..a44c6f9 100644 --- a/Modules/FindHDF5.cmake +++ b/Modules/FindHDF5.cmake @@ -219,7 +219,7 @@ endif() function(_HDF5_test_regular_compiler_C success version is_parallel) if(NOT ${success} OR NOT EXISTS ${_HDF5_TEST_DIR}/compiler_has_h5_c) - file(WRITE "${_HDF5_TEST_SRC}" + file(WRITE "${_HDF5_TEST_DIR}/${_HDF5_TEST_SRC}" "#include <hdf5.h>\n" "const char* info_ver = \"INFO\" \":\" H5_VERSION;\n" "#ifdef H5_HAVE_PARALLEL\n" @@ -235,7 +235,7 @@ function(_HDF5_test_regular_compiler_C success version is_parallel) " fid = H5Fcreate(\"foo.h5\",H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT);\n" " return 0;\n" "}") - try_compile(${success} SOURCES "${_HDF5_TEST_SRC}" + try_compile(${success} SOURCES "${_HDF5_TEST_DIR}/${_HDF5_TEST_SRC}" COPY_FILE ${_HDF5_TEST_DIR}/compiler_has_h5_c ) endif() @@ -263,7 +263,7 @@ endfunction() function(_HDF5_test_regular_compiler_CXX success version is_parallel) if(NOT ${success} OR NOT EXISTS ${_HDF5_TEST_DIR}/compiler_has_h5_cxx) - file(WRITE "${_HDF5_TEST_SRC}" + file(WRITE "${_HDF5_TEST_DIR}/${_HDF5_TEST_SRC}" "#include <H5Cpp.h>\n" "#ifndef H5_NO_NAMESPACE\n" "using namespace H5;\n" @@ -281,7 +281,7 @@ function(_HDF5_test_regular_compiler_CXX success version is_parallel) " H5File file(\"foo.h5\", H5F_ACC_TRUNC);\n" " return 0;\n" "}") - try_compile(${success} SOURCES "${_HDF5_TEST_SRC}" + try_compile(${success} SOURCES "${_HDF5_TEST_DIR}/${_HDF5_TEST_SRC}" COPY_FILE ${_HDF5_TEST_DIR}/compiler_has_h5_cxx ) endif() @@ -308,22 +308,29 @@ endfunction() function(_HDF5_test_regular_compiler_Fortran success is_parallel) if(NOT ${success}) - file(WRITE "${_HDF5_TEST_SRC}" + file(WRITE "${_HDF5_TEST_DIR}/${_HDF5_TEST_SRC}" "program hdf5_hello\n" " use hdf5\n" " integer error\n" " call h5open_f(error)\n" " call h5close_f(error)\n" "end\n") - try_compile(${success} SOURCES "${_HDF5_TEST_SRC}") + try_compile(${success} SOURCES "${_HDF5_TEST_DIR}/${_HDF5_TEST_SRC}") if(${success}) execute_process(COMMAND ${CMAKE_Fortran_COMPILER} -showconfig OUTPUT_VARIABLE config_output ERROR_VARIABLE config_error RESULT_VARIABLE config_result ) - if(config_output MATCHES "Parallel HDF5: yes") - set(${is_parallel} TRUE PARENT_SCOPE) + if(config_output MATCHES "Parallel HDF5: ([A-Za-z0-9]+)") + # The value may be anything used when HDF5 was configured, + # so see if CMake interprets it as "true". + set(parallelHDF5 "${CMAKE_MATCH_1}") + if(parallelHDF5) + set(${is_parallel} TRUE PARENT_SCOPE) + else() + set(${is_parallel} FALSE PARENT_SCOPE) + endif() else() set(${is_parallel} FALSE PARENT_SCOPE) endif() @@ -349,9 +356,13 @@ function( _HDF5_invoke_compiler language output_var return_value_var version_var ERROR_VARIABLE output RESULT_VARIABLE return_value ) - if(return_value AND NOT HDF5_FIND_QUIETLY) - message(STATUS - "HDF5 ${language} compiler wrapper is unable to compile a minimal HDF5 program.") + if(NOT return_value EQUAL 0) + message(CONFIGURE_LOG + "HDF5 ${language} compiler wrapper is unable to compile a minimal HDF5 program.\n\n${output}") + if(NOT HDF5_FIND_QUIETLY) + message(STATUS + "HDF5 ${language} compiler wrapper is unable to compile a minimal HDF5 program.") + endif() else() execute_process( COMMAND ${HDF5_${language}_COMPILER_EXECUTABLE} -show ${lib_type_args} "${_HDF5_TEST_SRC}" @@ -361,9 +372,13 @@ function( _HDF5_invoke_compiler language output_var return_value_var version_var RESULT_VARIABLE return_value OUTPUT_STRIP_TRAILING_WHITESPACE ) - if(return_value AND NOT HDF5_FIND_QUIETLY) - message(STATUS - "Unable to determine HDF5 ${language} flags from HDF5 wrapper.") + if(NOT return_value EQUAL 0) + message(CONFIGURE_LOG + "Unable to determine HDF5 ${language} flags from HDF5 wrapper.\n\n${output}") + if(NOT HDF5_FIND_QUIETLY) + message(STATUS + "Unable to determine HDF5 ${language} flags from HDF5 wrapper.") + endif() endif() execute_process( COMMAND ${HDF5_${language}_COMPILER_EXECUTABLE} -showconfig @@ -372,17 +387,26 @@ function( _HDF5_invoke_compiler language output_var return_value_var version_var RESULT_VARIABLE return_value OUTPUT_STRIP_TRAILING_WHITESPACE ) - if(return_value AND NOT HDF5_FIND_QUIETLY) - message(STATUS - "Unable to determine HDF5 ${language} version_var from HDF5 wrapper.") + if(NOT return_value EQUAL 0) + message(CONFIGURE_LOG + "Unable to determine HDF5 ${language} version_var from HDF5 wrapper.\n\n${output}") + if(NOT HDF5_FIND_QUIETLY) + message(STATUS + "Unable to determine HDF5 ${language} version_var from HDF5 wrapper.") + endif() endif() string(REGEX MATCH "HDF5 Version: ([a-zA-Z0-9\\.\\-]*)" version "${config_output}") if(version) string(REPLACE "HDF5 Version: " "" version "${version}") string(REPLACE "-patch" "." version "${version}") endif() - if(config_output MATCHES "Parallel HDF5: yes") - set(is_parallel TRUE) + if(config_output MATCHES "Parallel HDF5: ([A-Za-z0-9]+)") + # The value may be anything used when HDF5 was configured, + # so see if CMake interprets it as "true". + set(parallelHDF5 "${CMAKE_MATCH_1}") + if(parallelHDF5) + set(is_parallel TRUE) + endif() endif() endif() foreach(var output return_value version is_parallel) @@ -576,23 +600,23 @@ if(NOT HDF5_FOUND) # First check to see if our regular compiler is one of wrappers if(_lang STREQUAL "C") - set(_HDF5_TEST_SRC ${_HDF5_TEST_DIR}/cmake_hdf5_test.c) + set(_HDF5_TEST_SRC cmake_hdf5_test.c) if(CMAKE_CXX_COMPILER_LOADED AND NOT CMAKE_C_COMPILER_LOADED) # CXX project without C enabled - set(_HDF5_TEST_SRC ${_HDF5_TEST_DIR}/cmake_hdf5_test.cxx) + set(_HDF5_TEST_SRC cmake_hdf5_test.cxx) endif() _HDF5_test_regular_compiler_C( HDF5_${_lang}_COMPILER_NO_INTERROGATE HDF5_${_lang}_VERSION HDF5_${_lang}_IS_PARALLEL) elseif(_lang STREQUAL "CXX") - set(_HDF5_TEST_SRC ${_HDF5_TEST_DIR}/cmake_hdf5_test.cxx) + set(_HDF5_TEST_SRC cmake_hdf5_test.cxx) _HDF5_test_regular_compiler_CXX( HDF5_${_lang}_COMPILER_NO_INTERROGATE HDF5_${_lang}_VERSION HDF5_${_lang}_IS_PARALLEL) elseif(_lang STREQUAL "Fortran") - set(_HDF5_TEST_SRC ${_HDF5_TEST_DIR}/cmake_hdf5_test.f90) + set(_HDF5_TEST_SRC cmake_hdf5_test.f90) _HDF5_test_regular_compiler_Fortran( HDF5_${_lang}_COMPILER_NO_INTERROGATE HDF5_${_lang}_IS_PARALLEL) diff --git a/Modules/FindLAPACK.cmake b/Modules/FindLAPACK.cmake index 1eecb1c..4d3ab5a 100644 --- a/Modules/FindLAPACK.cmake +++ b/Modules/FindLAPACK.cmake @@ -304,10 +304,12 @@ endif() # Search for different LAPACK distributions if BLAS is found if(NOT LAPACK_NOT_FOUND_MESSAGE) set(LAPACK_LINKER_FLAGS ${BLAS_LINKER_FLAGS}) - if(NOT $ENV{BLA_VENDOR} STREQUAL "") - set(BLA_VENDOR $ENV{BLA_VENDOR}) - elseif(NOT BLA_VENDOR) - set(BLA_VENDOR "All") + if(NOT BLA_VENDOR) + if(NOT "$ENV{BLA_VENDOR}" STREQUAL "") + set(BLA_VENDOR "$ENV{BLA_VENDOR}") + else() + set(BLA_VENDOR "All") + endif() endif() # LAPACK in the Intel MKL 10+ library? @@ -559,6 +561,29 @@ if(NOT LAPACK_NOT_FOUND_MESSAGE) endif() endif() + # AOCL? (https://developer.amd.com/amd-aocl/) + if(NOT LAPACK_LIBRARIES + AND (BLA_VENDOR MATCHES "AOCL" OR BLA_VENDOR STREQUAL "All")) + if(_lapack_sizeof_integer EQUAL 8) + set(_lapack_aocl_subdir "ILP64") + else() + set(_lapack_aocl_subdir "LP64") + endif() + + check_lapack_libraries( + LAPACK_LIBRARIES + LAPACK + cheev + "" + "flame" + "-fopenmp" + "" + "${_lapack_aocl_subdir}" + "${BLAS_LIBRARIES}" + ) + unset(_lapack_aocl_subdir) + endif() + # LAPACK in SCSL library? (SGI/Cray Scientific Library) if(NOT LAPACK_LIBRARIES AND (BLA_VENDOR MATCHES "SCSL" OR BLA_VENDOR STREQUAL "All")) diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake index 1fbb4f9..e3246c6 100644 --- a/Modules/FindMPI.cmake +++ b/Modules/FindMPI.cmake @@ -1554,7 +1554,7 @@ foreach(LANG IN ITEMS C CXX Fortran) endif() endif() - # We are on a Cray, environment identfier: PE_ENV is set (CRAY), and + # We are on a Cray, environment identifier: PE_ENV is set (CRAY), and # have NOT found an mpic++-like compiler wrapper (previous block), # and we do NOT use the Cray cc/CC compiler wrappers as CC/CXX CMake # compiler. diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake index 34b1c5b..3ab6bc1 100644 --- a/Modules/FindMatlab.cmake +++ b/Modules/FindMatlab.cmake @@ -137,6 +137,12 @@ Result variables ``Matlab_FOUND`` ``TRUE`` if the Matlab installation is found, ``FALSE`` otherwise. All variable below are defined if Matlab is found. +``Matlab_VERSION`` + .. versionadded:: 3.27 + + the numerical version (e.g. 9.13) of Matlab found. Not to be confused with + Matlab release name (e.g. R2022b) that can be obtained with + :command:`matlab_get_release_name_from_version`. ``Matlab_ROOT_DIR`` the final root of the Matlab installation determined by the FindMatlab module. @@ -337,7 +343,14 @@ endif() #[=======================================================================[.rst: .. command:: matlab_get_version_from_release_name - Returns the version of Matlab (17.58) from a release name (R2017k) + .. code-block:: cmake + + matlab_get_version_from_release_name(release version) + + * Input: ``release`` is the release name (R2022b) + * Output: ``version`` is the version of Matlab (9.13) + + Returns the version of Matlab from a release name #]=======================================================================] macro(matlab_get_version_from_release_name release_name version_name) @@ -354,13 +367,17 @@ macro(matlab_get_version_from_release_name release_name version_name) endmacro() +#[=======================================================================[.rst: +.. command:: matlab_get_release_name_from_version + .. code-block:: cmake + matlab_get_release_name_from_version(version release_name) -#[=======================================================================[.rst: -.. command:: matlab_get_release_name_from_version + * Input: ``version`` is the version of Matlab (9.13) + * Output: ``release_name`` is the release name (R2022b) - Returns the release name (R2017k) from the version of Matlab (17.58) + Returns the release name from the version of Matlab #]=======================================================================] macro(matlab_get_release_name_from_version version release_name) @@ -371,7 +388,7 @@ macro(matlab_get_release_name_from_version version release_name) set(${release_name} ${CMAKE_MATCH_1}) break() endif() - endforeach(_var) + endforeach() unset(_var) unset(_matched) @@ -382,10 +399,7 @@ macro(matlab_get_release_name_from_version version release_name) endmacro() - - - -# extracts all the supported release names (R2017k...) of Matlab +# extracts all the supported release names (R2022b...) of Matlab # internal use macro(matlab_get_supported_releases list_releases) set(${list_releases}) @@ -396,7 +410,7 @@ macro(matlab_get_supported_releases list_releases) endif() unset(_matched) unset(CMAKE_MATCH_1) - endforeach(_var) + endforeach() unset(_var) endmacro() @@ -413,7 +427,7 @@ macro(matlab_get_supported_versions list_versions) endif() unset(_matched) unset(CMAKE_MATCH_1) - endforeach(_var) + endforeach() unset(_var) endmacro() @@ -421,8 +435,15 @@ endmacro() #[=======================================================================[.rst: .. command:: matlab_extract_all_installed_versions_from_registry - This function parses the registry and founds the Matlab versions that are - installed. The found versions are returned in `matlab_versions`. + .. code-block:: cmake + + matlab_extract_all_installed_versions_from_registry(win64 matlab_versions) + + * Input: ``win64`` is a boolean to search for the 64 bit version of Matlab + * Output: ``matlab_versions`` is a list of all the versions of Matlab found + + This function parses the Windows registry and founds the Matlab versions that + are installed. The found versions are returned in `matlab_versions`. Set `win64` to `TRUE` if the 64 bit version of Matlab should be looked for The returned list contains all versions under ``HKLM\\SOFTWARE\\Mathworks\\MATLAB`` and @@ -505,31 +526,6 @@ macro(extract_matlab_versions_from_registry_brute_force matlab_versions) set(matlab_supported_versions) matlab_get_supported_versions(matlab_supported_versions) - - # this is a manual population of the versions we want to look for - # this can be done as is, but preferably with the call to - # matlab_get_supported_versions and variable - - # populating the versions we want to look for - # set(matlab_supported_versions) - - # # Matlab 7 - # set(matlab_major 7) - # foreach(current_matlab_minor RANGE 4 20) - # list(APPEND matlab_supported_versions "${matlab_major}.${current_matlab_minor}") - # endforeach(current_matlab_minor) - - # # Matlab 8 - # set(matlab_major 8) - # foreach(current_matlab_minor RANGE 0 5) - # list(APPEND matlab_supported_versions "${matlab_major}.${current_matlab_minor}") - # endforeach(current_matlab_minor) - - # # taking into account the possible additional versions provided by the user - # if(DEFINED MATLAB_ADDITIONAL_VERSIONS) - # list(APPEND matlab_supported_versions MATLAB_ADDITIONAL_VERSIONS) - # endif() - # we order from more recent to older if(matlab_supported_versions) list(REMOVE_DUPLICATES matlab_supported_versions) @@ -541,8 +537,6 @@ macro(extract_matlab_versions_from_registry_brute_force matlab_versions) endmacro() - - #[=======================================================================[.rst: .. command:: matlab_get_all_valid_matlab_roots_from_registry @@ -552,16 +546,12 @@ endmacro() ``(type,version_number,matlab_root_path)``, where ``type`` indicates either ``MATLAB`` or ``MCR``. - :: + .. code-block:: cmake - matlab_get_all_valid_matlab_roots_from_registry( - matlab_versions - matlab_roots) + matlab_get_all_valid_matlab_roots_from_registry(matlab_versions matlab_roots) - ``matlab_versions`` - the versions of each of the Matlab or MCR installations - ``matlab_roots`` - the location of each of the Matlab or MCR installations + * Input: ``matlab_versions`` of each of the Matlab or MCR installations + * Output: ``matlab_roots`` location of each of the Matlab or MCR installations #]=======================================================================] function(matlab_get_all_valid_matlab_roots_from_registry matlab_versions matlab_roots) @@ -571,7 +561,7 @@ function(matlab_get_all_valid_matlab_roots_from_registry matlab_versions matlab_ set(_matlab_roots_list ) # check for Matlab installations - foreach(_matlab_current_version ${matlab_versions}) + foreach(_matlab_current_version IN LISTS matlab_versions) get_filename_component( current_MATLAB_ROOT "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MathWorks\\MATLAB\\${_matlab_current_version};MATLABROOT]" @@ -584,7 +574,7 @@ function(matlab_get_all_valid_matlab_roots_from_registry matlab_versions matlab_ endforeach() # Check for MCR installations - foreach(_matlab_current_version ${matlab_versions}) + foreach(_matlab_current_version IN LISTS matlab_versions) get_filename_component( current_MATLAB_ROOT "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MathWorks\\MATLAB Runtime\\${_matlab_current_version};MATLABROOT]" @@ -600,7 +590,7 @@ function(matlab_get_all_valid_matlab_roots_from_registry matlab_versions matlab_ endforeach() # Check for old MCR installations - foreach(_matlab_current_version ${matlab_versions}) + foreach(_matlab_current_version IN LISTS matlab_versions) get_filename_component( current_MATLAB_ROOT "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MathWorks\\MATLAB Compiler Runtime\\${_matlab_current_version};MATLABROOT]" @@ -624,16 +614,12 @@ endfunction() This function should not be called before the appropriate Matlab root has been found. - :: + .. code-block:: cmake - matlab_get_mex_suffix( - matlab_root - mex_suffix) + matlab_get_mex_suffix(matlab_root mex_suffix) - ``matlab_root`` - the root of the Matlab/MCR installation - ``mex_suffix`` - the variable name in which the suffix will be returned. + * Input: ``matlab_root`` root of Matlab/MCR install e.g. ``Matlab_ROOT_DIR`` + * Output: ``mex_suffix`` variable name in which the suffix will be returned. #]=======================================================================] function(matlab_get_mex_suffix matlab_root mex_suffix) @@ -711,8 +697,6 @@ function(matlab_get_mex_suffix matlab_root mex_suffix) endfunction() - - #[=======================================================================[.rst: .. command:: matlab_get_version_from_matlab_run @@ -720,16 +704,12 @@ endfunction() version. If the path provided for the Matlab installation points to an MCR installation, the version is extracted from the installed files. - :: + .. code-block:: cmake - matlab_get_version_from_matlab_run( - matlab_binary_path - matlab_list_versions) + matlab_get_version_from_matlab_run(matlab_binary_path matlab_list_versions) - ``matlab_binary_path`` - the location of the `matlab` binary executable - ``matlab_list_versions`` - the version extracted from Matlab + * Input: ``matlab_binary_path`` path of the `matlab` binary executable + * Output: ``matlab_list_versions`` the version extracted from Matlab #]=======================================================================] function(matlab_get_version_from_matlab_run matlab_binary_program matlab_list_versions) @@ -899,7 +879,7 @@ endfunction() non 0 failure). Additional arguments accepted by :command:`add_test` can be passed through ``TEST_ARGS`` (eg. ``CONFIGURATION <config> ...``). - :: + .. code-block:: cmake matlab_add_unit_test( NAME <name> @@ -913,7 +893,7 @@ endfunction() [NO_UNITTEST_FRAMEWORK] ) - The function arguments are: + Function Parameters: ``NAME`` name of the unittest in ctest. @@ -971,7 +951,7 @@ function(matlab_add_unit_test) endif() # The option to run a batch program with MATLAB changes depending on the MATLAB version - # For MATLAB before R2019a (9.6), the only supported option is -r, afterwords the suggested option + # For MATLAB before R2019a (9.6), the only supported option is -r, afterwards the suggested option # is -batch as -r is deprecated set(maut_BATCH_OPTION "-r") if(NOT (Matlab_VERSION_STRING STREQUAL "")) @@ -1011,7 +991,7 @@ endfunction() for the MEX file. Remaining arguments of the call are passed to the :command:`add_library` or :command:`add_executable` command. - :: + .. code-block:: cmake matlab_add_mex( NAME <name> @@ -1026,6 +1006,8 @@ endfunction() [...] ) + Function Parameters: + ``NAME`` name of the target. ``SRC`` @@ -1210,18 +1192,17 @@ function(matlab_add_mex) if (MSVC) - set(_link_flags "${_link_flags} /EXPORT:mexFunction") + string(APPEND _link_flags " /EXPORT:mexFunction") if(NOT Matlab_VERSION_STRING VERSION_LESS "9.1") # For 9.1 (R2016b) and newer, export version - set(_link_flags "${_link_flags} /EXPORT:mexfilerequiredapiversion") + string(APPEND _link_flags " /EXPORT:mexfilerequiredapiversion") endif() set_property(TARGET ${${prefix}_NAME} APPEND PROPERTY LINK_FLAGS ${_link_flags}) endif() # No other compiler currently supported on Windows. - set_target_properties(${${prefix}_NAME} - PROPERTIES - DEFINE_SYMBOL "DLL_EXPORT_SYM=__declspec(dllexport)") + set_property(TARGET ${${prefix}_NAME} PROPERTY + DEFINE_SYMBOL "DLL_EXPORT_SYM=__declspec(dllexport)") else() @@ -1247,7 +1228,7 @@ function(matlab_add_mex) if(Matlab_HAS_CPP_API) list(APPEND _ver_map_files ${Matlab_EXTERN_LIBRARY_DIR}/cppMexFunction.map) # This one doesn't exist on Linux - set(_link_flags "${_link_flags} -Wl,-U,_mexCreateMexFunction -Wl,-U,_mexDestroyMexFunction -Wl,-U,_mexFunctionAdapter") + string(APPEND _link_flags " -Wl,-U,_mexCreateMexFunction -Wl,-U,_mexDestroyMexFunction -Wl,-U,_mexFunctionAdapter") # On MacOS, the MEX command adds the above, without it the link breaks # because we indiscriminately use "cppMexFunction.map" even for C API MEX-files. endif() @@ -1262,14 +1243,14 @@ function(matlab_add_mex) target_compile_options(${${prefix}_NAME} PRIVATE "-pthread") endif() - set(_link_flags "${_link_flags} -Wl,--as-needed") + string(APPEND _link_flags " -Wl,--as-needed") set(_export_flag_name --version-script) endif() - foreach(_file ${_ver_map_files}) - set(_link_flags "${_link_flags} -Wl,${_export_flag_name},${_file}") + foreach(_file IN LISTS _ver_map_files) + string(APPEND _link_flags " -Wl,${_export_flag_name},${_file}") endforeach() # The `mex` command doesn't add this define. It is specified here in order @@ -2021,11 +2002,13 @@ _Matlab_add_imported_target(MAT mat) _Matlab_add_imported_target(ENGINE MatlabEngine) _Matlab_add_imported_target(DATAARRAY MatlabDataArray) +set(Matlab_VERSION ${Matlab_VERSION_STRING}) + find_package_handle_standard_args( Matlab FOUND_VAR Matlab_FOUND REQUIRED_VARS ${_matlab_required_variables} - VERSION_VAR Matlab_VERSION_STRING + VERSION_VAR Matlab_VERSION HANDLE_COMPONENTS) unset(_matlab_required_variables) diff --git a/Modules/FindOpenACC.cmake b/Modules/FindOpenACC.cmake index 00e42b8..436f5ea 100644 --- a/Modules/FindOpenACC.cmake +++ b/Modules/FindOpenACC.cmake @@ -294,9 +294,9 @@ foreach (LANG IN ITEMS C CXX Fortran) endif() if(OpenACC_${LANG}_FLAGS) set_property(TARGET OpenACC::OpenACC_${LANG} PROPERTY - INTERFACE_COMPILE_OPTIONS "$<$<COMPILE_LANGUAGE:${LANG}>:${OpenACC_${LANG}_OPTIONS}>") + INTERFACE_COMPILE_OPTIONS "$<$<COMPILE_LANGUAGE:${LANG}>:SHELL:${OpenACC_${LANG}_FLAGS}>") set_property(TARGET OpenACC::OpenACC_${LANG} PROPERTY - INTERFACE_LINK_OPTIONS "$<$<COMPILE_LANGUAGE:${LANG}>:${OpenACC_${LANG}_OPTIONS}>") + INTERFACE_LINK_OPTIONS "$<$<COMPILE_LANGUAGE:${LANG}>:SHELL:${OpenACC_${LANG}_FLAGS}>") unset(_OpenACC_${LANG}_OPTIONS) endif() endforeach() diff --git a/Modules/FindOpenAL.cmake b/Modules/FindOpenAL.cmake index 53aafdc..3d58569 100644 --- a/Modules/FindOpenAL.cmake +++ b/Modules/FindOpenAL.cmake @@ -105,18 +105,16 @@ find_package_handle_standard_args( mark_as_advanced(OPENAL_LIBRARY OPENAL_INCLUDE_DIR) -if(OPENAL_INCLUDE_DIR AND OPENAL_LIBRARY) - if(NOT TARGET OpenAL::OpenAL) - if(EXISTS "${OPENAL_LIBRARY}") - add_library(OpenAL::OpenAL UNKNOWN IMPORTED) - set_target_properties(OpenAL::OpenAL PROPERTIES - IMPORTED_LOCATION "${OPENAL_LIBRARY}") - else() - add_library(OpenAL::OpenAL INTERFACE IMPORTED) - set_target_properties(OpenAL::OpenAL PROPERTIES - IMPORTED_LIBNAME "${OPENAL_LIBRARY}") - endif() +if(OPENAL_FOUND AND NOT TARGET OpenAL::OpenAL) + if(OPENAL_LIBRARY MATCHES "/([^/]+)\\.framework$") + add_library(OpenAL::OpenAL INTERFACE IMPORTED) set_target_properties(OpenAL::OpenAL PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${OPENAL_INCLUDE_DIR}") + INTERFACE_LINK_LIBRARIES "${OPENAL_LIBRARY}") + else() + add_library(OpenAL::OpenAL UNKNOWN IMPORTED) + set_target_properties(OpenAL::OpenAL PROPERTIES + IMPORTED_LOCATION "${OPENAL_LIBRARY}") endif() + set_target_properties(OpenAL::OpenAL PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${OPENAL_INCLUDE_DIR}") endif() diff --git a/Modules/FindOpenCL.cmake b/Modules/FindOpenCL.cmake index 2b700ff..55be667 100644 --- a/Modules/FindOpenCL.cmake +++ b/Modules/FindOpenCL.cmake @@ -39,6 +39,8 @@ The module will also define two cache variables:: #]=======================================================================] +set(_OPENCL_x86 "(x86)") + function(_FIND_OPENCL_VERSION) include(CheckSymbolExists) include(CMakePushCheckState) @@ -79,6 +81,9 @@ find_path(OpenCL_INCLUDE_DIR CL/cl.h OpenCL/cl.h PATHS ENV "PROGRAMFILES(X86)" + ENV "PROGRAMFILES" + $ENV{PROGRAMFILES${_OPENCL_x86}}/OpenCLHeaders + $ENV{PROGRAMFILES}/OpenCLHeaders ENV AMDAPPSDKROOT ENV INTELOCLSDKROOT ENV NVSDKCOMPUTE_ROOT @@ -100,6 +105,9 @@ if(WIN32) NAMES OpenCL PATHS ENV "PROGRAMFILES(X86)" + ENV "PROGRAMFILES" + $ENV{PROGRAMFILES${_OPENCL_x86}}/OpenCL-ICD-Loader + $ENV{PROGRAMFILES}/OpenCL-ICD-Loader ENV AMDAPPSDKROOT ENV INTELOCLSDKROOT ENV CUDA_PATH @@ -116,6 +124,9 @@ if(WIN32) NAMES OpenCL PATHS ENV "PROGRAMFILES(X86)" + ENV "PROGRAMFILES" + $ENV{PROGRAMFILES${_OPENCL_x86}}/OpenCL-ICD-Loader + $ENV{PROGRAMFILES}/OpenCL-ICD-Loader ENV AMDAPPSDKROOT ENV INTELOCLSDKROOT ENV CUDA_PATH @@ -126,6 +137,7 @@ if(WIN32) "AMD APP/lib/x86_64" lib/x86_64 lib/x64 + lib OpenCL/common/lib/x64) endif() else() @@ -156,6 +168,8 @@ else() endif() endif() +unset(_OPENCL_x86) + set(OpenCL_LIBRARIES ${OpenCL_LIBRARY}) set(OpenCL_INCLUDE_DIRS ${OpenCL_INCLUDE_DIR}) diff --git a/Modules/FindOpenGL.cmake b/Modules/FindOpenGL.cmake index a9a1b2a..843f787 100644 --- a/Modules/FindOpenGL.cmake +++ b/Modules/FindOpenGL.cmake @@ -18,8 +18,26 @@ Optional COMPONENTS .. versionadded:: 3.10 -This module respects several optional COMPONENTS: ``EGL``, ``GLX``, and -``OpenGL``. There are corresponding import targets for each of these flags. +This module respects several optional COMPONENTS: + +``EGL`` + The EGL interface between OpenGL, OpenGL ES and the underlying windowing system. + +``GLX`` + An extension to X that interfaces OpenGL, OpenGL ES with X window system. + +``OpenGL`` + The cross platform API for 3D graphics. + +``GLES2`` + .. versionadded:: 3.27 + + A subset of OpenGL API for embedded systems with limited capabilities. + +``GLES3`` + .. versionadded:: 3.27 + + A subset of OpenGL API for embedded systems with more capabilities. IMPORTED Targets ^^^^^^^^^^^^^^^^ @@ -42,6 +60,14 @@ This module defines the :prop_tgt:`IMPORTED` targets: Defined if the system has OpenGL Extension to the X Window System (GLX). ``OpenGL::EGL`` Defined if the system has EGL. +``OpenGL::GLES2`` + .. versionadded:: 3.27 + + Defined if the system has GLES2. +``OpenGL::GLES3`` + .. versionadded:: 3.27 + + Defined if the system has GLES3. Result Variables ^^^^^^^^^^^^^^^^ @@ -60,6 +86,10 @@ This module sets the following variables: True, if the system has GLX. ``OpenGL_EGL_FOUND`` True, if the system has EGL. +``OpenGL::GLES2`` + Defined if the system has GLES2. +``OpenGL::GLES3`` + Defined if the system has GLES3. ``OPENGL_INCLUDE_DIR`` Path to the OpenGL include directory. ``OPENGL_EGL_INCLUDE_DIRS`` @@ -88,6 +118,14 @@ The following cache variables may also be set: ``OPENGL_gl_LIBRARY`` Path to the OpenGL library. New code should prefer the ``OpenGL::*`` import targets. +``OPENGL_gles2_LIBRARY`` + .. versionadded:: 3.27 + + Path to the OpenGL GLES2 library. +``OPENGL_gles3_LIBRARY`` + .. versionadded:: 3.27 + + Path to the OpenGL GLES3 library. .. versionadded:: 3.10 Variables for GLVND-specific libraries ``OpenGL``, ``EGL`` and ``GLX``. @@ -122,7 +160,7 @@ The value may be one of: .. versionchanged:: 3.11 This is the default, unless policy :policy:`CMP0072` is set to ``OLD`` - and no components are requeted (since components + and no components are requested (since components correspond to GLVND libraries). ``LEGACY`` @@ -182,7 +220,10 @@ elseif (APPLE) OPENGL_glu_LIBRARY ) else() - if (CMAKE_SYSTEM_NAME MATCHES "HP-UX") + if (CMAKE_ANDROID_NDK) + set(_OPENGL_INCLUDE_PATH ${CMAKE_ANDROID_NDK}/sysroot/usr/include) + set(_OPENGL_LIB_PATH ${CMAKE_ANDROID_NDK}/platforms/android-${CMAKE_SYSTEM_VERSION}/arch-${CMAKE_ANDROID_ARCH}/usr/lib) + elseif (CMAKE_SYSTEM_NAME MATCHES "HP-UX") # Handle HP-UX cases where we only want to find OpenGL in either hpux64 # or hpux32 depending on if we're doing a 64 bit build. if(CMAKE_SIZEOF_VOID_P EQUAL 4) @@ -198,6 +239,13 @@ else() /boot/develop/lib/x86) set(_OPENGL_INCLUDE_PATH /boot/develop/headers/os/opengl) + elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux") + # CMake doesn't support arbitrary globs in search paths. + file(GLOB _OPENGL_LIB_PATH + # The NVidia driver installation tool on Linux installs libraries to a + # `nvidia-<version>` subdirectory. + "/usr/lib/nvidia-*" + "/usr/lib32/nvidia-*") endif() # The first line below is to make sure that the proper headers @@ -215,15 +263,20 @@ else() ) find_path(OPENGL_GLX_INCLUDE_DIR GL/glx.h ${_OPENGL_INCLUDE_PATH}) find_path(OPENGL_EGL_INCLUDE_DIR EGL/egl.h ${_OPENGL_INCLUDE_PATH}) + find_path(OPENGL_GLES2_INCLUDE_DIR GLES2/gl2.h ${_OPENGL_INCLUDE_PATH}) + find_path(OPENGL_GLES3_INCLUDE_DIR GLES3/gl3.h ${_OPENGL_INCLUDE_PATH}) 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 ) + list(APPEND _OpenGL_CACHE_VARS OPENGL_INCLUDE_DIR OPENGL_GLX_INCLUDE_DIR OPENGL_EGL_INCLUDE_DIR + OPENGL_GLES2_INCLUDE_DIR + OPENGL_GLES3_INCLUDE_DIR OPENGL_xmesa_INCLUDE_DIR ) @@ -246,6 +299,17 @@ else() PATH_SUFFIXES libglvnd ) + find_library(OPENGL_gles2_LIBRARY + NAMES GLESv2 + PATHS ${_OPENGL_LIB_PATH} + ) + + find_library(OPENGL_gles3_LIBRARY + NAMES GLESv3 + GLESv2 # mesa provides only libGLESv2 + PATHS ${_OPENGL_LIB_PATH} + ) + find_library(OPENGL_glu_LIBRARY NAMES GLU MesaGLU PATHS ${OPENGL_gl_LIBRARY} @@ -258,6 +322,8 @@ else() OPENGL_opengl_LIBRARY OPENGL_glx_LIBRARY OPENGL_egl_LIBRARY + OPENGL_gles2_LIBRARY + OPENGL_gles3_LIBRARY OPENGL_glu_LIBRARY ) @@ -338,12 +404,16 @@ else() OPENGL_glx_LIBRARY AND NOT OPENGL_gl_LIBRARY) OR (NOT OPENGL_USE_EGL AND + NOT OPENGL_USE_GLES3 AND + NOT OPENGL_USE_GLES2 AND NOT OPENGL_glx_LIBRARY AND NOT OPENGL_gl_LIBRARY) OR (NOT OPENGL_USE_EGL AND OPENGL_opengl_LIBRARY AND OPENGL_glx_LIBRARY) OR - ( OPENGL_USE_EGL)) + (NOT OPENGL_USE_GLES3 AND + NOT OPENGL_USE_GLES2 AND + OPENGL_USE_EGL)) list(APPEND _OpenGL_REQUIRED_VARS OPENGL_opengl_LIBRARY) endif() @@ -351,13 +421,19 @@ else() if((NOT OPENGL_USE_OPENGL AND NOT OPENGL_USE_GLX AND NOT OPENGL_USE_EGL AND + NOT OPENGL_USE_GLES3 AND + NOT OPENGL_USE_GLES2 AND NOT OPENGL_glx_LIBRARY AND NOT OPENGL_gl_LIBRARY) OR ( OPENGL_USE_GLX AND NOT OPENGL_USE_EGL AND + NOT OPENGL_USE_GLES3 AND + NOT OPENGL_USE_GLES2 AND NOT OPENGL_glx_LIBRARY AND NOT OPENGL_gl_LIBRARY) OR (NOT OPENGL_USE_EGL AND + NOT OPENGL_USE_GLES3 AND + NOT OPENGL_USE_GLES2 AND OPENGL_opengl_LIBRARY AND OPENGL_glx_LIBRARY) OR (OPENGL_USE_GLX AND OPENGL_USE_EGL)) @@ -369,6 +445,16 @@ else() list(APPEND _OpenGL_REQUIRED_VARS OPENGL_egl_LIBRARY) endif() + # GLVND GLES2 library. + if(OPENGL_USE_GLES2) + list(APPEND _OpenGL_REQUIRED_VARS OPENGL_gles2_LIBRARY) + endif() + + # GLVND GLES3 library. + if(OPENGL_USE_GLES3) + list(APPEND _OpenGL_REQUIRED_VARS OPENGL_gles3_LIBRARY) + endif() + # Old-style "libGL" library: used as a fallback when GLVND isn't available. if((NOT OPENGL_USE_EGL AND NOT OPENGL_opengl_LIBRARY AND @@ -381,7 +467,11 @@ else() endif() # We always need the 'gl.h' include dir. - list(APPEND _OpenGL_REQUIRED_VARS OPENGL_INCLUDE_DIR) + if(OPENGL_USE_EGL) + list(APPEND _OpenGL_REQUIRED_VARS OPENGL_EGL_INCLUDE_DIR) + else() + list(APPEND _OpenGL_REQUIRED_VARS OPENGL_INCLUDE_DIR) + endif() unset(_OPENGL_INCLUDE_PATH) unset(_OPENGL_LIB_PATH) @@ -428,6 +518,18 @@ else() set(OpenGL_EGL_FOUND FALSE) endif() +if(OPENGL_gles2_LIBRARY AND OPENGL_GLES2_INCLUDE_DIR) + set(OpenGL_GLES2_FOUND TRUE) +else() + set(OpenGL_GLES2_FOUND FALSE) +endif() + +if(OPENGL_gles3_LIBRARY AND OPENGL_GLES3_INCLUDE_DIR) + set(OpenGL_GLES3_FOUND TRUE) +else() + set(OpenGL_GLES3_FOUND FALSE) +endif() + # User-visible names should be plural. if(OPENGL_EGL_INCLUDE_DIR) set(OPENGL_EGL_INCLUDE_DIRS ${OPENGL_EGL_INCLUDE_DIR}) @@ -461,6 +563,7 @@ if(OPENGL_FOUND) endif() set_target_properties(OpenGL::OpenGL PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${OPENGL_INCLUDE_DIR}") + set(_OpenGL_EGL_IMPL OpenGL::OpenGL) endif() # ::GLX is a GLVND library, and thus Linux-only: we don't bother checking @@ -481,6 +584,73 @@ if(OPENGL_FOUND) "${OPENGL_GLX_INCLUDE_DIR}") endif() + # ::GLES2 is a GLVND library, and thus Linux-only: we don't bother checking + # for a framework version of this library. + if(OpenGL_GLES2_FOUND AND NOT TARGET OpenGL::GLES2) + + # Initialize target + if(NOT OPENGL_gles2_LIBRARY) + add_library(OpenGL::GLES2 INTERFACE IMPORTED) + else() + if(IS_ABSOLUTE "${OPENGL_gles2_LIBRARY}") + add_library(OpenGL::GLES2 UNKNOWN IMPORTED) + set_target_properties(OpenGL::GLES2 PROPERTIES + IMPORTED_LOCATION "${OPENGL_gles2_LIBRARY}" + ) + else() + add_library(OpenGL::GLES2 INTERFACE IMPORTED) + set_target_properties(OpenGL::GLES2 PROPERTIES + IMPORTED_LIBNAME "${OPENGL_gles2_LIBRARY}" + ) + endif() + endif() + + # Attach target properties + set_target_properties(OpenGL::GLES2 + PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES + "${OPENGL_GLES2_INCLUDE_DIR}" + ) + + if (OPENGL_USE_GLES2) + set(_OpenGL_EGL_IMPL OpenGL::GLES2) + endif () + + endif() + + # ::GLES3 is a GLVND library, and thus Linux-only: we don't bother checking + # for a framework version of this library. + if(OpenGL_GLES3_FOUND AND NOT TARGET OpenGL::GLES3) + + # Initialize target + if(NOT OPENGL_gles3_LIBRARY) + add_library(OpenGL::GLES3 INTERFACE IMPORTED) + else() + if(IS_ABSOLUTE "${OPENGL_gles3_LIBRARY}") + add_library(OpenGL::GLES3 UNKNOWN IMPORTED) + set_target_properties(OpenGL::GLES3 PROPERTIES + IMPORTED_LOCATION "${OPENGL_gles3_LIBRARY}" + ) + else() + add_library(OpenGL::GLES3 INTERFACE IMPORTED) + set_target_properties(OpenGL::GLES3 PROPERTIES + IMPORTED_LIBNAME "${OPENGL_gles3_LIBRARY}" + ) + endif() + endif() + + # Attach target properties + set_target_properties(OpenGL::GLES3 PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES + "${OPENGL_GLES3_INCLUDE_DIR}" + ) + + if (OPENGL_USE_GLES3) + set(_OpenGL_EGL_IMPL OpenGL::GLES3) + endif () + + endif() + if(OPENGL_gl_LIBRARY AND NOT TARGET OpenGL::GL) # A legacy GL library is available, so use it for the legacy GL target. if(IS_ABSOLUTE "${OPENGL_gl_LIBRARY}") @@ -517,10 +687,9 @@ if(OPENGL_FOUND) # ::EGL is a GLVND library, and thus Linux-only: we don't bother checking # for a framework version of this library. - # Note we test for OpenGL::OpenGL as a target. When this module is updated to - # support GLES, we would additionally want to check for the hypothetical GLES - # target and enable EGL if either ::GLES or ::OpenGL is created. - if(TARGET OpenGL::OpenGL AND OpenGL_EGL_FOUND AND NOT TARGET OpenGL::EGL) + # Note we test whether _OpenGL_EGL_IMPL is set. Based on the OpenGL implementation, + # _OpenGL_EGL_IMPL will be one of OpenGL::OpenGL, OpenGL::GLES2, OpenGL::GLES3 + if(_OpenGL_EGL_IMPL AND OpenGL_EGL_FOUND AND NOT TARGET OpenGL::EGL) if(IS_ABSOLUTE "${OPENGL_egl_LIBRARY}") add_library(OpenGL::EGL UNKNOWN IMPORTED) set_target_properties(OpenGL::EGL PROPERTIES IMPORTED_LOCATION @@ -531,7 +700,7 @@ if(OPENGL_FOUND) "${OPENGL_egl_LIBRARY}") endif() set_target_properties(OpenGL::EGL PROPERTIES INTERFACE_LINK_LIBRARIES - OpenGL::OpenGL) + "${_OpenGL_EGL_IMPL}") # Note that EGL's include directory is different from OpenGL/GLX's! set_target_properties(OpenGL::EGL PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${OPENGL_EGL_INCLUDE_DIR}") diff --git a/Modules/FindOpenMP.cmake b/Modules/FindOpenMP.cmake index 68be2d6..cd912c3 100644 --- a/Modules/FindOpenMP.cmake +++ b/Modules/FindOpenMP.cmake @@ -600,15 +600,13 @@ foreach(LANG IN LISTS OpenMP_FINDLIST) add_library(OpenMP::OpenMP_${LANG} INTERFACE IMPORTED) endif() if(OpenMP_${LANG}_FLAGS) - separate_arguments(_OpenMP_${LANG}_OPTIONS NATIVE_COMMAND "${OpenMP_${LANG}_FLAGS}") set_property(TARGET OpenMP::OpenMP_${LANG} PROPERTY - INTERFACE_COMPILE_OPTIONS "$<$<COMPILE_LANGUAGE:${LANG}>:${_OpenMP_${LANG}_OPTIONS}>") + INTERFACE_COMPILE_OPTIONS "$<$<COMPILE_LANGUAGE:${LANG}>:SHELL:${OpenMP_${LANG}_FLAGS}>") if(CMAKE_${LANG}_COMPILER_ID STREQUAL "Fujitsu" OR ${CMAKE_${LANG}_COMPILER_ID} STREQUAL "IntelLLVM") set_property(TARGET OpenMP::OpenMP_${LANG} PROPERTY - INTERFACE_LINK_OPTIONS "${OpenMP_${LANG}_FLAGS}") + INTERFACE_LINK_OPTIONS "SHELL:${OpenMP_${LANG}_FLAGS}") endif() - unset(_OpenMP_${LANG}_OPTIONS) endif() if(OpenMP_${LANG}_INCLUDE_DIRS) set_property(TARGET OpenMP::OpenMP_${LANG} PROPERTY diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake index 4e8374c..426d00d 100644 --- a/Modules/FindOpenSSL.cmake +++ b/Modules/FindOpenSSL.cmake @@ -107,13 +107,13 @@ The following variables may be set to control search behavior: ``ENV{PKG_CONFIG_PATH}`` On UNIX-like systems, ``pkg-config`` is used to locate the system OpenSSL. - Set the ``PKG_CONFIG_PATH`` environment varialbe to look in alternate + Set the ``PKG_CONFIG_PATH`` environment variable to look in alternate locations. Useful on multi-lib systems. #]=======================================================================] macro(_OpenSSL_test_and_find_dependencies ssl_library crypto_library) unset(_OpenSSL_extra_static_deps) - if((CMAKE_SYSTEM_NAME STREQUAL "Linux") AND + if(UNIX AND (("${ssl_library}" MATCHES "\\${CMAKE_STATIC_LIBRARY_SUFFIX}$") OR ("${crypto_library}" MATCHES "\\${CMAKE_STATIC_LIBRARY_SUFFIX}$"))) set(_OpenSSL_has_dependencies TRUE) @@ -140,7 +140,7 @@ macro(_OpenSSL_test_and_find_dependencies ssl_library crypto_library) endif() endforeach() unset(_OPENSSL_DEP_LIB) - else() + elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux") set(_OpenSSL_has_dependency_dl TRUE) endif() if(_OpenSSL_ldflags_other) @@ -152,7 +152,7 @@ macro(_OpenSSL_test_and_find_dependencies ssl_library crypto_library) endif() endforeach() unset(_OPENSSL_DEP_LDFLAG) - else() + elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux") set(_OpenSSL_has_dependency_threads TRUE) find_package(Threads) endif() @@ -210,7 +210,7 @@ endif () # Support preference of static libs by adjusting CMAKE_FIND_LIBRARY_SUFFIXES if(OPENSSL_USE_STATIC_LIBS) set(_openssl_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) - if(WIN32) + if(MSVC) set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) else() set(CMAKE_FIND_LIBRARY_SUFFIXES .a ) @@ -230,13 +230,15 @@ else() set(_OPENSSL_FIND_PATH_SUFFIX "include") endif() -if (WIN32) +if ((DEFINED OPENSSL_ROOT_DIR) OR (DEFINED ENV{OPENSSL_ROOT_DIR})) + set(_OPENSSL_ROOT_HINTS HINTS ${OPENSSL_ROOT_DIR} ENV OPENSSL_ROOT_DIR) + set(_OPENSSL_ROOT_PATHS NO_DEFAULT_PATH) +elseif (MSVC) # http://www.slproweb.com/products/Win32OpenSSL.html set(_OPENSSL_ROOT_HINTS - ${OPENSSL_ROOT_DIR} + HINTS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;Inno Setup: App Path]" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (64-bit)_is1;Inno Setup: App Path]" - ENV OPENSSL_ROOT_DIR ) if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "8") @@ -255,6 +257,7 @@ if (WIN32) endif() set(_OPENSSL_ROOT_PATHS + PATHS "${_programfiles}/OpenSSL" "${_programfiles}/OpenSSL-${_arch}" "C:/OpenSSL/" @@ -262,16 +265,11 @@ if (WIN32) ) unset(_programfiles) unset(_arch) -else () - set(_OPENSSL_ROOT_HINTS - ${OPENSSL_ROOT_DIR} - ENV OPENSSL_ROOT_DIR - ) endif () set(_OPENSSL_ROOT_HINTS_AND_PATHS - HINTS ${_OPENSSL_ROOT_HINTS} - PATHS ${_OPENSSL_ROOT_PATHS} + ${_OPENSSL_ROOT_HINTS} + ${_OPENSSL_ROOT_PATHS} ) find_path(OPENSSL_INCLUDE_DIR diff --git a/Modules/FindPNG.cmake b/Modules/FindPNG.cmake index 94d15db..043b69c 100644 --- a/Modules/FindPNG.cmake +++ b/Modules/FindPNG.cmake @@ -48,18 +48,35 @@ Since PNG depends on the ZLib compression library, none of the above will be defined unless ZLib can be found. #]=======================================================================] +# Default install location on windows when installing from included cmake build +# From FindZLIB.cmake +set(_PNG_x86 "(x86)") +set(_PNG_INCLUDE_SEARCH_NORMAL + "$ENV{ProgramFiles}/libpng" + "$ENV{ProgramFiles${_PNG_x86}}/libpng") +set(_PNG_LIB_SEARCH_NORMAL + "$ENV{ProgramFiles}/libpng/lib" + "$ENV{ProgramFiles${_PNG_x86}}/libpng/lib") +unset(_PNG_x86) + if(PNG_FIND_QUIETLY) set(_FIND_ZLIB_ARG QUIET) endif() find_package(ZLIB ${_FIND_ZLIB_ARG}) if(ZLIB_FOUND) - find_path(PNG_PNG_INCLUDE_DIR png.h PATH_SUFFIXES include/libpng) + set(_PNG_VERSION_SUFFIXES 17 16 15 14 12) + + list(APPEND _PNG_INCLUDE_PATH_SUFFIXES include/libpng) + foreach(v IN LISTS _PNG_VERSION_SUFFIXES) + list(APPEND _PNG_INCLUDE_PATH_SUFFIXES include/libpng${v}) + endforeach() + + find_path(PNG_PNG_INCLUDE_DIR png.h PATH_SUFFIXES ${_PNG_INCLUDE_PATH_SUFFIXES} PATHS ${_PNG_INCLUDE_SEARCH_NORMAL} ) mark_as_advanced(PNG_PNG_INCLUDE_DIR) list(APPEND PNG_NAMES png libpng) unset(PNG_NAMES_DEBUG) - set(_PNG_VERSION_SUFFIXES 17 16 15 14 12) if (PNG_FIND_VERSION MATCHES "^([0-9]+)\\.([0-9]+)(\\..*)?$") set(_PNG_VERSION_SUFFIX_MIN "${CMAKE_MATCH_1}${CMAKE_MATCH_2}") if (PNG_FIND_VERSION_EXACT) @@ -79,14 +96,15 @@ if(ZLIB_FOUND) # For compatibility with versions prior to this multi-config search, honor # any PNG_LIBRARY that is already specified and skip the search. if(NOT PNG_LIBRARY) - find_library(PNG_LIBRARY_RELEASE NAMES ${PNG_NAMES} NAMES_PER_DIR) - find_library(PNG_LIBRARY_DEBUG NAMES ${PNG_NAMES_DEBUG} NAMES_PER_DIR) + find_library(PNG_LIBRARY_RELEASE NAMES ${PNG_NAMES} NAMES_PER_DIR PATHS ${_PNG_LIB_SEARCH_NORMAL}) + find_library(PNG_LIBRARY_DEBUG NAMES ${PNG_NAMES_DEBUG} NAMES_PER_DIR PATHS ${_PNG_LIB_SEARCH_NORMAL}) include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake) select_library_configurations(PNG) mark_as_advanced(PNG_LIBRARY_RELEASE PNG_LIBRARY_DEBUG) endif() unset(PNG_NAMES) unset(PNG_NAMES_DEBUG) + unset(_PNG_INCLUDE_PATH_SUFFIXES) # Set by select_library_configurations(), but we want the one from # find_package_handle_standard_args() below. diff --git a/Modules/FindPostgreSQL.cmake b/Modules/FindPostgreSQL.cmake index c92fbdc..6e970e8 100644 --- a/Modules/FindPostgreSQL.cmake +++ b/Modules/FindPostgreSQL.cmake @@ -53,7 +53,7 @@ is set regardless of the presence of the ``Server`` component in find_package ca # In Windows the default installation of PostgreSQL uses that as part of the path. # E.g C:\Program Files\PostgreSQL\8.4. # Currently, the following version numbers are known to this module: -# "14" "13" "12" "11" "10" "9.6" "9.5" "9.4" "9.3" "9.2" "9.1" "9.0" "8.4" "8.3" "8.2" "8.1" "8.0" +# "15" "14" "13" "12" "11" "10" "9.6" "9.5" "9.4" "9.3" "9.2" "9.1" "9.0" "8.4" "8.3" "8.2" "8.1" "8.0" # # To use this variable just do something like this: # set(PostgreSQL_ADDITIONAL_VERSIONS "9.2" "8.4.4") @@ -102,7 +102,7 @@ set(PostgreSQL_ROOT_DIR_MESSAGE "Set the PostgreSQL_ROOT system variable to wher set(PostgreSQL_KNOWN_VERSIONS ${PostgreSQL_ADDITIONAL_VERSIONS} - "14" "13" "12" "11" "10" "9.6" "9.5" "9.4" "9.3" "9.2" "9.1" "9.0" "8.4" "8.3" "8.2" "8.1" "8.0") + "15" "14" "13" "12" "11" "10" "9.6" "9.5" "9.4" "9.3" "9.2" "9.1" "9.0" "8.4" "8.3" "8.2" "8.1" "8.0") # Define additional search paths for root directories. set( PostgreSQL_ROOT_DIRECTORIES diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake index c73a2d8..008b537 100644 --- a/Modules/FindProtobuf.cmake +++ b/Modules/FindProtobuf.cmake @@ -136,15 +136,95 @@ Example: Variable to define with autogenerated Python files ``ARGN`` ``.proto`` files + +.. command:: protobuf_generate + + .. versionadded:: 3.13 + + Automatically generate source files from ``.proto`` schema files at build time:: + + protobuf_generate ( + TARGET <target> + [LANGUAGE <lang>] + [OUT_VAR <out_var>] + [EXPORT_MACRO <macro>] + [PROTOC_OUT_DIR <dir>] + [PLUGIN <plugin>] + [PLUGIN_OPTIONS <plugin_options>] + [DEPENDENCIES <depends] + [PROTOS <protobuf_files>] + [IMPORT_DIRS <dirs>] + [GENERATE_EXTENSIONS <extensions>] + [PROTOC_OPTIONS <protoc_options>] + [APPEND_PATH]) + + ``APPEND_PATH`` + A flag that causes the base path of all proto schema files to be added to + ``IMPORT_DIRS``. + ``LANGUAGE`` + A single value: cpp or python. Determines what kind of source files are + being generated. Defaults to cpp. + ``OUT_VAR`` + Name of a CMake variable that will be filled with the paths to the generated + source files. + ``EXPORT_MACRO`` + Name of a macro that is applied to all generated Protobuf message classes + and extern variables. It can, for example, be used to declare DLL exports. + ``PROTOC_OUT_DIR`` + Output directory of generated source files. Defaults to ``CMAKE_CURRENT_BINARY_DIR``. + ``PLUGIN`` + .. versionadded:: 3.21 + + An optional plugin executable. This could, for example, be the path to + ``grpc_cpp_plugin``. + ``PLUGIN_OPTIONS`` + .. versionadded:: 3.28 + + Additional options provided to the plugin, such as ``generate_mock_code=true`` + for the gRPC cpp plugin. + ``DEPENDENCIES`` + .. versionadded:: 3.28 + + Arguments forwarded to the ``DEPENDS`` of the underlying ``add_custom_command`` + invocation. + ``TARGET`` + CMake target that will have the generated files added as sources. + ``PROTOS`` + List of proto schema files. If omitted, then every source file ending in *proto* of ``TARGET`` will be used. + ``IMPORT_DIRS`` + A common parent directory for the schema files. For example, if the schema file is + ``proto/helloworld/helloworld.proto`` and the import directory ``proto/`` then the + generated files are ``${PROTOC_OUT_DIR}/helloworld/helloworld.pb.h`` and + ``${PROTOC_OUT_DIR}/helloworld/helloworld.pb.cc``. + ``GENERATE_EXTENSIONS`` + If LANGUAGE is omitted then this must be set to the extensions that protoc generates. + ``PROTOC_OPTIONS`` + .. versionadded:: 3.28 + + Additional arguments that are forwarded to protoc. + + Example:: + + find_package(gRPC CONFIG REQUIRED) + find_package(Protobuf REQUIRED) + add_library(ProtoTest Test.proto) + target_link_libraries(ProtoTest PUBLIC gRPC::grpc++) + protobuf_generate(TARGET ProtoTest) + protobuf_generate( + TARGET ProtoTest + LANGUAGE grpc + PLUGIN protoc-gen-grpc=$<TARGET_FILE:gRPC::grpc_cpp_plugin> + PLUGIN_OPTIONS generate_mock_code=true + GENERATE_EXTENSIONS .grpc.pb.h .grpc.pb.cc) #]=======================================================================] function(protobuf_generate) set(_options APPEND_PATH DESCRIPTORS) - set(_singleargs LANGUAGE OUT_VAR EXPORT_MACRO PROTOC_OUT_DIR PLUGIN) + set(_singleargs LANGUAGE OUT_VAR EXPORT_MACRO PROTOC_OUT_DIR PLUGIN PLUGIN_OPTIONS DEPENDENCIES) if(COMMAND target_sources) list(APPEND _singleargs TARGET) endif() - set(_multiargs PROTOS IMPORT_DIRS GENERATE_EXTENSIONS) + set(_multiargs PROTOS IMPORT_DIRS GENERATE_EXTENSIONS PROTOC_OPTIONS) cmake_parse_arguments(protobuf_generate "${_options}" "${_singleargs}" "${_multiargs}" "${ARGN}") @@ -168,9 +248,18 @@ function(protobuf_generate) endif() if(protobuf_generate_EXPORT_MACRO AND protobuf_generate_LANGUAGE STREQUAL cpp) - set(_dll_export_decl "dllexport_decl=${protobuf_generate_EXPORT_MACRO}:") + set(_dll_export_decl "dllexport_decl=${protobuf_generate_EXPORT_MACRO}") endif() + foreach(_option ${_dll_export_decl} ${protobuf_generate_PLUGIN_OPTIONS}) + # append comma - not using CMake lists and string replacement as users + # might have semicolons in options + if(_plugin_options) + set( _plugin_options "${_plugin_options},") + endif() + set(_plugin_options "${_plugin_options}${_option}") + endforeach() + if(protobuf_generate_PLUGIN) set(_plugin "--plugin=${protobuf_generate_PLUGIN}") endif() @@ -204,14 +293,12 @@ function(protobuf_generate) # Create an include path for each file specified foreach(_file ${protobuf_generate_PROTOS}) get_filename_component(_abs_file ${_file} ABSOLUTE) - get_filename_component(_abs_path ${_abs_file} PATH) - list(FIND _protobuf_include_path ${_abs_path} _contains_already) + get_filename_component(_abs_dir ${_abs_file} DIRECTORY) + list(FIND _protobuf_include_path ${_abs_dir} _contains_already) if(${_contains_already} EQUAL -1) - list(APPEND _protobuf_include_path -I ${_abs_path}) + list(APPEND _protobuf_include_path -I ${_abs_dir}) endif() endforeach() - else() - set(_protobuf_include_path -I ${CMAKE_CURRENT_SOURCE_DIR}) endif() foreach(DIR ${protobuf_generate_IMPORT_DIRS}) @@ -222,6 +309,10 @@ function(protobuf_generate) endif() endforeach() + if(NOT _protobuf_include_path) + set(_protobuf_include_path -I ${CMAKE_CURRENT_SOURCE_DIR}) + endif() + set(_generated_srcs_all) foreach(_proto ${protobuf_generate_PROTOS}) get_filename_component(_abs_file ${_proto} ABSOLUTE) @@ -246,12 +337,20 @@ function(protobuf_generate) endif() list(APPEND _generated_srcs_all ${_generated_srcs}) + set(_comment "Running ${protobuf_generate_LANGUAGE} protocol buffer compiler on ${_proto}") + if(protobuf_generate_PROTOC_OPTIONS) + set(_comment "${_comment}, protoc-options: ${protobuf_generate_PROTOC_OPTIONS}") + endif() + if(_plugin_options) + set(_comment "${_comment}, plugin-options: ${_plugin_options}") + endif() + add_custom_command( OUTPUT ${_generated_srcs} - COMMAND protobuf::protoc - ARGS --${protobuf_generate_LANGUAGE}_out ${_dll_export_decl}${protobuf_generate_PROTOC_OUT_DIR} ${_plugin} ${_dll_desc_out} ${_protobuf_include_path} ${_abs_file} - DEPENDS ${_abs_file} protobuf::protoc - COMMENT "Running ${protobuf_generate_LANGUAGE} protocol buffer compiler on ${_proto}" + COMMAND protobuf::protoc + ARGS ${protobuf_generate_PROTOC_OPTIONS} --${protobuf_generate_LANGUAGE}_out ${_plugin_options}:${protobuf_generate_PROTOC_OUT_DIR} ${_plugin} ${_dll_desc_out} ${_protobuf_include_path} ${_abs_file} + DEPENDS ${_abs_file} protobuf::protoc ${protobuf_generate_DEPENDENCIES} + COMMENT ${_comment} VERBATIM ) endforeach() @@ -520,7 +619,9 @@ if(Protobuf_INCLUDE_DIR) "${Protobuf_PROTOC_EXECUTABLE} reveals version ${_PROTOBUF_PROTOC_EXECUTABLE_VERSION}") endif() - if(NOT "${_PROTOBUF_PROTOC_EXECUTABLE_VERSION}" VERSION_EQUAL "${Protobuf_VERSION}") + # protoc version 22 and up don't print the major version any more + if(NOT "${_PROTOBUF_PROTOC_EXECUTABLE_VERSION}" VERSION_EQUAL "${Protobuf_VERSION}" AND + NOT "${_PROTOBUF_PROTOC_EXECUTABLE_VERSION}" VERSION_EQUAL "${_PROTOBUF_MINOR_VERSION}.${_PROTOBUF_SUBMINOR_VERSION}") message(WARNING "Protobuf compiler version ${_PROTOBUF_PROTOC_EXECUTABLE_VERSION}" " doesn't match library version ${Protobuf_VERSION}") endif() @@ -552,7 +653,7 @@ if(Protobuf_INCLUDE_DIR) INTERFACE_COMPILE_FEATURES cxx_std_11 ) endif() - if (MSVC AND NOT Protobuf_USE_STATIC_LIBS) + if (WIN32 AND NOT Protobuf_USE_STATIC_LIBS) set_property(TARGET protobuf::libprotobuf APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS "PROTOBUF_USE_DLLS" ) @@ -585,7 +686,7 @@ if(Protobuf_INCLUDE_DIR) set_target_properties(protobuf::libprotobuf-lite PROPERTIES IMPORTED_LOCATION_DEBUG "${Protobuf_LITE_LIBRARY_DEBUG}") endif() - if (MSVC AND NOT Protobuf_USE_STATIC_LIBS) + if (WIN32 AND NOT Protobuf_USE_STATIC_LIBS) set_property(TARGET protobuf::libprotobuf-lite APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS "PROTOBUF_USE_DLLS" ) @@ -623,7 +724,7 @@ if(Protobuf_INCLUDE_DIR) INTERFACE_COMPILE_FEATURES cxx_std_11 ) endif() - if (MSVC AND NOT Protobuf_USE_STATIC_LIBS) + if (WIN32 AND NOT Protobuf_USE_STATIC_LIBS) set_property(TARGET protobuf::libprotoc APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS "PROTOBUF_USE_DLLS" ) diff --git a/Modules/FindPython.cmake b/Modules/FindPython.cmake index 31ef1c7..19b6c2a 100644 --- a/Modules/FindPython.cmake +++ b/Modules/FindPython.cmake @@ -125,38 +125,28 @@ This module will set the following variables in your project ``Python_STDLIB`` Standard platform independent installation directory. - Information returned by - ``distutils.sysconfig.get_python_lib(plat_specific=False,standard_lib=True)`` - or else ``sysconfig.get_path('stdlib')``. + Information returned by ``sysconfig.get_path('stdlib')``. ``Python_STDARCH`` Standard platform dependent installation directory. - Information returned by - ``distutils.sysconfig.get_python_lib(plat_specific=True,standard_lib=True)`` - or else ``sysconfig.get_path('platstdlib')``. + Information returned by ``sysconfig.get_path('platstdlib')``. ``Python_SITELIB`` Third-party platform independent installation directory. - Information returned by - ``distutils.sysconfig.get_python_lib(plat_specific=False,standard_lib=False)`` - or else ``sysconfig.get_path('purelib')``. + Information returned by ``sysconfig.get_path('purelib')``. ``Python_SITEARCH`` Third-party platform dependent installation directory. - Information returned by - ``distutils.sysconfig.get_python_lib(plat_specific=True,standard_lib=False)`` - or else ``sysconfig.get_path('platlib')``. + Information returned by ``sysconfig.get_path('platlib')``. ``Python_SOABI`` .. versionadded:: 3.17 Extension suffix for modules. - Information computed from ``distutils.sysconfig.get_config_var('EXT_SUFFIX')`` - or ``distutils.sysconfig.get_config_var('SOABI')`` or - ``python3-config --extension-suffix``. If package ``distutils.sysconfig`` is - not available, ``sysconfig.get_config_var('EXT_SUFFIX')`` or - ``sysconfig.get_config_var('SOABI')`` are used. + Information computed from ``sysconfig.get_config_var('EXT_SUFFIX')`` or + ``sysconfig.get_config_var('SOABI')`` or + ``python3-config --extension-suffix``. ``Python_SOSABI`` .. versionadded:: 3.26 @@ -335,6 +325,8 @@ Hints constraints is founded. This is the default if policy :policy:`CMP0094` is set to ``NEW``. + See also ``Python_FIND_UNVERSIONED_NAMES``. + ``Python_FIND_REGISTRY`` .. versionadded:: 3.13 @@ -442,6 +434,8 @@ Hints This is the default. * ``NEVER``: The generic name are not searched at all. + See also ``Python_FIND_STRATEGY``. + Artifacts Specification ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/Modules/FindPython/Support.cmake b/Modules/FindPython/Support.cmake index f842068..0f0e2af 100644 --- a/Modules/FindPython/Support.cmake +++ b/Modules/FindPython/Support.cmake @@ -192,28 +192,25 @@ function (_PYTHON_GET_REGISTRIES _PYTHON_PGR_REGISTRY_PATHS) if (implementation STREQUAL "CPython") foreach (version IN LISTS _PGR_VERSION) string (REPLACE "." "" version_no_dots ${version}) - list (APPEND registries - [HKEY_CURRENT_USER/SOFTWARE/Python/PythonCore/${version}-${_${_PYTHON_PREFIX}_ARCH}/InstallPath] - [HKEY_CURRENT_USER/SOFTWARE/Python/PythonCore/${version}-${_${_PYTHON_PREFIX}_ARCH2}/InstallPath]) + list (TRANSFORM _${_PYTHON_PREFIX}_ARCH REPLACE "^(.+)$" "[HKEY_CURRENT_USER/SOFTWARE/Python/PythonCore/${version}-\\1/InstallPath]" OUTPUT_VARIABLE reg_paths) + list (APPEND registries ${reg_paths}) if (version VERSION_GREATER_EQUAL "3.5") # cmake_host_system_information is not usable in bootstrap get_filename_component (arch "[HKEY_CURRENT_USER\\Software\\Python\\PythonCore\\${version};SysArchitecture]" NAME) - if (arch MATCHES "(${_${_PYTHON_PREFIX}_ARCH}|${_${_PYTHON_PREFIX}_ARCH2})bit") - list (APPEND registries - [HKEY_CURRENT_USER/SOFTWARE/Python/PythonCore/${version}/InstallPath]) + string (REPLACE "bit" "" arch "${arch}") + if (arch IN_LIST _${_PYTHON_PREFIX}_ARCH) + list (APPEND registries [HKEY_CURRENT_USER/SOFTWARE/Python/PythonCore/${version}/InstallPath]) endif() else() - list (APPEND registries - [HKEY_CURRENT_USER/SOFTWARE/Python/PythonCore/${version}/InstallPath]) - endif() - list (APPEND registries - [HKEY_CURRENT_USER/SOFTWARE/Python/ContinuumAnalytics/Anaconda${version_no_dots}-${_${_PYTHON_PREFIX}_ARCH}/InstallPath] - [HKEY_CURRENT_USER/SOFTWARE/Python/ContinuumAnalytics/Anaconda${version_no_dots}-${_${_PYTHON_PREFIX}_ARCH2}/InstallPath] - [HKEY_LOCAL_MACHINE/SOFTWARE/Python/PythonCore/${version}-${_${_PYTHON_PREFIX}_ARCH}/InstallPath] - [HKEY_LOCAL_MACHINE/SOFTWARE/Python/PythonCore/${version}-${_${_PYTHON_PREFIX}_ARCH2}/InstallPath] - [HKEY_LOCAL_MACHINE/SOFTWARE/Python/PythonCore/${version}/InstallPath] - [HKEY_LOCAL_MACHINE/SOFTWARE/Python/ContinuumAnalytics/Anaconda${version_no_dots}-${_${_PYTHON_PREFIX}_ARCH}/InstallPath] - [HKEY_LOCAL_MACHINE/SOFTWARE/Python/ContinuumAnalytics/Anaconda${version_no_dots}-${_${_PYTHON_PREFIX}_ARCH2}/InstallPath]) + list (APPEND registries [HKEY_CURRENT_USER/SOFTWARE/Python/PythonCore/${version}/InstallPath]) + endif() + list (TRANSFORM _${_PYTHON_PREFIX}_ARCH REPLACE "^(.+)$" "[HKEY_CURRENT_USER/SOFTWARE/Python/ContinuumAnalytics/Anaconda${version_no_dots}-\\1/InstallPath]" OUTPUT_VARIABLE reg_paths) + list (APPEND registries ${reg_paths}) + list (TRANSFORM _${_PYTHON_PREFIX}_ARCH REPLACE "^(.+)$" "[HKEY_CURRENT_USER/SOFTWARE/Python/PythonCore/${version}-\\1/InstallPath]" OUTPUT_VARIABLE reg_paths) + list (APPEND registries ${reg_paths}) + list (APPEND registries [HKEY_LOCAL_MACHINE/SOFTWARE/Python/PythonCore/${version}/InstallPath]) + list (TRANSFORM _${_PYTHON_PREFIX}_ARCH REPLACE "^(.+)$" "[HKEY_LOCAL_MACHINE/SOFTWARE/Python/ContinuumAnalytics/Anaconda${version_no_dots}-\\1/InstallPath]" OUTPUT_VARIABLE reg_paths) + list (APPEND registries ${reg_paths}) endforeach() elseif (implementation STREQUAL "IronPython") foreach (version IN LISTS _PGR_VERSION) @@ -503,7 +500,7 @@ function (_PYTHON_GET_CONFIG_VAR _PYTHON_PGCV_VALUE NAME) if (_${_PYTHON_PREFIX}_EXECUTABLE AND NOT CMAKE_CROSSCOMPILING) if (NAME STREQUAL "PREFIX") - execute_process (COMMAND ${_${_PYTHON_PREFIX}_INTERPRETER_LAUNCHER} "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c "import sys\ntry:\n from distutils import sysconfig\n sys.stdout.write(';'.join([sysconfig.PREFIX,sysconfig.EXEC_PREFIX,sysconfig.BASE_EXEC_PREFIX]))\nexcept Exception:\n import sysconfig\n sys.stdout.write(';'.join([sysconfig.get_config_var('base') or '', sysconfig.get_config_var('installed_base') or '']))" + execute_process (COMMAND ${_${_PYTHON_PREFIX}_INTERPRETER_LAUNCHER} "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c "import sys\ntry:\n import sysconfig\n sys.stdout.write(';'.join([sysconfig.get_config_var('base') or '', sysconfig.get_config_var('installed_base') or '']))\nexcept Exception:\n from distutils import sysconfig\n sys.stdout.write(';'.join([sysconfig.PREFIX,sysconfig.EXEC_PREFIX,sysconfig.BASE_EXEC_PREFIX]))" RESULT_VARIABLE _result OUTPUT_VARIABLE _values ERROR_QUIET @@ -520,7 +517,7 @@ function (_PYTHON_GET_CONFIG_VAR _PYTHON_PGCV_VALUE NAME) set (_scheme "posix_prefix") endif() execute_process (COMMAND ${_${_PYTHON_PREFIX}_INTERPRETER_LAUNCHER} "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c - "import sys\ntry:\n from distutils import sysconfig\n sys.stdout.write(';'.join([sysconfig.get_python_inc(plat_specific=True),sysconfig.get_python_inc(plat_specific=False)]))\nexcept Exception:\n import sysconfig\n sys.stdout.write(';'.join([sysconfig.get_path('platinclude'),sysconfig.get_path('platinclude','${_scheme}'),sysconfig.get_path('include'),sysconfig.get_path('include','${_scheme}')]))" + "import sys\ntry:\n import sysconfig\n sys.stdout.write(';'.join([sysconfig.get_path('platinclude'),sysconfig.get_path('platinclude','${_scheme}'),sysconfig.get_path('include'),sysconfig.get_path('include','${_scheme}')]))\nexcept Exception:\n from distutils import sysconfig\n sys.stdout.write(';'.join([sysconfig.get_python_inc(plat_specific=True),sysconfig.get_python_inc(plat_specific=False)]))" RESULT_VARIABLE _result OUTPUT_VARIABLE _values ERROR_QUIET @@ -533,7 +530,7 @@ function (_PYTHON_GET_CONFIG_VAR _PYTHON_PGCV_VALUE NAME) elseif (NAME STREQUAL "SOABI") # first step: compute SOABI form EXT_SUFFIX config variable execute_process (COMMAND ${_${_PYTHON_PREFIX}_INTERPRETER_LAUNCHER} "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c - "import sys\ntry:\n from distutils import sysconfig\n sys.stdout.write(sysconfig.get_config_var('EXT_SUFFIX') or '')\nexcept Exception:\n import sysconfig;sys.stdout.write(sysconfig.get_config_var('EXT_SUFFIX') or '')" + "import sys\ntry:\n import sysconfig\n sys.stdout.write(sysconfig.get_config_var('EXT_SUFFIX') or '')\nexcept Exception:\n from distutils import sysconfig;sys.stdout.write(sysconfig.get_config_var('EXT_SUFFIX') or '')" RESULT_VARIABLE _result OUTPUT_VARIABLE _values ERROR_QUIET @@ -554,7 +551,7 @@ function (_PYTHON_GET_CONFIG_VAR _PYTHON_PGCV_VALUE NAME) # second step: use SOABI or SO config variables as fallback if (NOT _values) execute_process (COMMAND ${_${_PYTHON_PREFIX}_INTERPRETER_LAUNCHER} "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c - "import sys\ntry:\n from distutils import sysconfig\n sys.stdout.write(';'.join([sysconfig.get_config_var('SOABI') or '',sysconfig.get_config_var('SO') or '']))\nexcept Exception:\n import sysconfig;sys.stdout.write(';'.join([sysconfig.get_config_var('SOABI') or '',sysconfig.get_config_var('SO') or '']))" + "import sys\ntry:\n import sysconfig\n sys.stdout.write(';'.join([sysconfig.get_config_var('SOABI') or '',sysconfig.get_config_var('SO') or '']))\nexcept Exception:\n from distutils import sysconfig;sys.stdout.write(';'.join([sysconfig.get_config_var('SOABI') or '',sysconfig.get_config_var('SO') or '']))" RESULT_VARIABLE _result OUTPUT_VARIABLE _soabi ERROR_QUIET @@ -595,7 +592,7 @@ function (_PYTHON_GET_CONFIG_VAR _PYTHON_PGCV_VALUE NAME) set (config_flag "LIBPL") endif() execute_process (COMMAND ${_${_PYTHON_PREFIX}_INTERPRETER_LAUNCHER} "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c - "import sys\ntry:\n from distutils import sysconfig\n sys.stdout.write(sysconfig.get_config_var('${config_flag}'))\nexcept Exception:\n import sysconfig\n sys.stdout.write(sysconfig.get_config_var('${config_flag}'))" + "import sys\ntry:\n import sysconfig\n sys.stdout.write(sysconfig.get_config_var('${config_flag}'))\nexcept Exception:\n from distutils import sysconfig\n sys.stdout.write(sysconfig.get_config_var('${config_flag}'))" RESULT_VARIABLE _result OUTPUT_VARIABLE _values ERROR_QUIET @@ -927,6 +924,33 @@ function (_PYTHON_VALIDATE_INTERPRETER) set_property (CACHE _${_PYTHON_PREFIX}_EXECUTABLE PROPERTY VALUE "${_PYTHON_PREFIX}_EXECUTABLE-NOTFOUND") return() endif() + + if (WIN32) + # In this case, check if the interpreter is compatible with the target processor architecture + if (NOT CMAKE_GENERATOR_PLATFORM AND CMAKE_SYSTEM_PROCESSOR MATCHES "ARM" OR CMAKE_GENERATOR_PLATFORM MATCHES "ARM") + set(target_arm TRUE) + else() + set(target_arm FALSE) + endif() + execute_process (COMMAND ${launcher} "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c + "import sys, sysconfig; sys.stdout.write(sysconfig.get_platform())" + RESULT_VARIABLE result + OUTPUT_VARIABLE platform + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + string(TOUPPER "${platform}" platform) + if (result OR ((target_arm AND NOT platform MATCHES "ARM") OR + (NOT target_arm AND platform MATCHES "ARM"))) + # interpreter not usable or has wrong architecture + if (result) + set_property (CACHE _${_PYTHON_PREFIX}_Interpreter_REASON_FAILURE PROPERTY VALUE "Cannot use the interpreter \"${_${_PYTHON_PREFIX}_EXECUTABLE}\"") + else() + set_property (CACHE _${_PYTHON_PREFIX}_Interpreter_REASON_FAILURE PROPERTY VALUE "Wrong architecture for the interpreter \"${_${_PYTHON_PREFIX}_EXECUTABLE}\"") + endif() + set_property (CACHE _${_PYTHON_PREFIX}_EXECUTABLE PROPERTY VALUE "${_PYTHON_PREFIX}_EXECUTABLE-NOTFOUND") + return() + endif() + endif() endif() endfunction() @@ -957,7 +981,7 @@ function (_PYTHON_VALIDATE_COMPILER) # retrieve python environment version from compiler set (working_dir "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/PythonCompilerVersion.dir") - file (WRITE "${working_dir}/version.py" "import sys; sys.stdout.write('.'.join([str(x) for x in sys.version_info[:3]]))\n") + file (WRITE "${working_dir}/version.py" "import sys; sys.stdout.write('.'.join([str(x) for x in sys.version_info[:3]])); sys.stdout.flush()\n") execute_process (COMMAND ${launcher} "${_${_PYTHON_PREFIX}_COMPILER}" ${_${_PYTHON_PREFIX}_IRON_PYTHON_COMPILER_ARCH_FLAGS} /target:exe /embed "${working_dir}/version.py" @@ -1419,19 +1443,37 @@ if (CMAKE_SIZEOF_VOID_P) OR "Development.SABIModule" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS OR "Development.Embed" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS) # In this case, search only for 64bit or 32bit - set (_${_PYTHON_PREFIX}_ARCH2 ${_${_PYTHON_PREFIX}_ARCH}) set (_${_PYTHON_PREFIX}_REGISTRY_VIEW REGISTRY_VIEW ${_${_PYTHON_PREFIX}_ARCH}) + if (WIN32 AND (NOT CMAKE_GENERATOR_PLATFORM AND CMAKE_SYSTEM_PROCESSOR MATCHES "ARM" + OR CMAKE_GENERATOR_PLATFORM MATCHES "ARM")) + # search exclusively ARM architecture: 64bit or 32bit + if (_${_PYTHON_PREFIX}_ARCH EQUAL 64) + set (_${_PYTHON_PREFIX}_ARCH ARM64) + else() + set (_${_PYTHON_PREFIX}_ARCH ARM) + endif() + endif() else() if (_${_PYTHON_PREFIX}_ARCH EQUAL "32") - set (_${_PYTHON_PREFIX}_ARCH2 64) + if (CMAKE_SYSTEM_PROCESSOR MATCHES "ARM") + # search first ARM architectures: 32bit and then 64bit + list (PREPEND _${_PYTHON_PREFIX}_ARCH ARM ARM64) + endif() + list (APPEND _${_PYTHON_PREFIX}_ARCH 64) else() - set (_${_PYTHON_PREFIX}_ARCH2 32) + if (CMAKE_SYSTEM_PROCESSOR MATCHES "ARM") + # search first ARM architectures: 64bit and then 32bit + list (PREPEND _${_PYTHON_PREFIX}_ARCH ARM64 ARM) + endif() + list (APPEND _${_PYTHON_PREFIX}_ARCH 32) endif() endif() else() # architecture unknown, search for both 64bit and 32bit - set (_${_PYTHON_PREFIX}_ARCH 64) - set (_${_PYTHON_PREFIX}_ARCH2 32) + set (_${_PYTHON_PREFIX}_ARCH 64 32) + if (CMAKE_SYSTEM_PROCESSOR MATCHES "ARM") + list (PREPEND _${_PYTHON_PREFIX}_ARCH ARM64 ARM) + endif() endif() # IronPython support @@ -1439,7 +1481,7 @@ unset (_${_PYTHON_PREFIX}_IRON_PYTHON_INTERPRETER_NAMES) unset (_${_PYTHON_PREFIX}_IRON_PYTHON_COMPILER_NAMES) unset (_${_PYTHON_PREFIX}_IRON_PYTHON_COMPILER_ARCH_FLAGS) if (CMAKE_SIZEOF_VOID_P) - if (_${_PYTHON_PREFIX}_ARCH EQUAL "32") + if (CMAKE_SIZEOF_VOID_P EQUAL "4") set (_${_PYTHON_PREFIX}_IRON_PYTHON_COMPILER_ARCH_FLAGS "/platform:x86") else() set (_${_PYTHON_PREFIX}_IRON_PYTHON_COMPILER_ARCH_FLAGS "/platform:x64") @@ -2048,7 +2090,6 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS) list (GET _${_PYTHON_PREFIX}_INTERPRETER_PROPERTIES 3 ${_PYTHON_PREFIX}_VERSION_PATCH) list (GET _${_PYTHON_PREFIX}_INTERPRETER_PROPERTIES 4 _${_PYTHON_PREFIX}_ARCH) - set (_${_PYTHON_PREFIX}_ARCH2 ${_${_PYTHON_PREFIX}_ARCH}) list (GET _${_PYTHON_PREFIX}_INTERPRETER_PROPERTIES 5 _${_PYTHON_PREFIX}_ABIFLAGS) list (GET _${_PYTHON_PREFIX}_INTERPRETER_PROPERTIES 6 ${_PYTHON_PREFIX}_SOABI) @@ -2098,10 +2139,27 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS) if (NOT _${_PYTHON_PREFIX}_RESULT) if (${_PYTHON_PREFIX}_IS64BIT) set (_${_PYTHON_PREFIX}_ARCH 64) - set (_${_PYTHON_PREFIX}_ARCH2 64) else() set (_${_PYTHON_PREFIX}_ARCH 32) - set (_${_PYTHON_PREFIX}_ARCH2 32) + endif() + endif() + + if (WIN32) + # check if architecture is Intel or ARM + execute_process (COMMAND ${_${_PYTHON_PREFIX}_INTERPRETER_LAUNCHER} "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c + "import sys; import sysconfig; sys.stdout.write(sysconfig.get_platform())" + RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT + OUTPUT_VARIABLE _${_PYTHON_PREFIX}_PLATFORM + ERROR_VARIABLE ${_PYTHON_PREFIX}_PLATFORM) + if (NOT _${_PYTHON_PREFIX}_RESULT) + string(TOUPPER "${_${_PYTHON_PREFIX}_PLATFORM}" _${_PYTHON_PREFIX}_PLATFORM) + if (_${_PYTHON_PREFIX}_PLATFORM MATCHES "ARM") + if (${_PYTHON_PREFIX}_IS64BIT) + set (_${_PYTHON_PREFIX}_ARCH ARM64) + else() + set (_${_PYTHON_PREFIX}_ARCH ARM) + endif() + endif() endif() endif() endif() @@ -2139,7 +2197,7 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS) # retrieve various package installation directories execute_process (COMMAND ${_${_PYTHON_PREFIX}_INTERPRETER_LAUNCHER} "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c - "import sys\ntry:\n from distutils import sysconfig\n sys.stdout.write(';'.join([sysconfig.get_python_lib(plat_specific=False,standard_lib=True),sysconfig.get_python_lib(plat_specific=True,standard_lib=True),sysconfig.get_python_lib(plat_specific=False,standard_lib=False),sysconfig.get_python_lib(plat_specific=True,standard_lib=False)]))\nexcept Exception:\n import sysconfig\n sys.stdout.write(';'.join([sysconfig.get_path('stdlib'),sysconfig.get_path('platstdlib'),sysconfig.get_path('purelib'),sysconfig.get_path('platlib')]))" + "import sys\ntry:\n import sysconfig\n sys.stdout.write(';'.join([sysconfig.get_path('stdlib'),sysconfig.get_path('platstdlib'),sysconfig.get_path('purelib'),sysconfig.get_path('platlib')]))\nexcept Exception:\n from distutils import sysconfig\n sys.stdout.write(';'.join([sysconfig.get_python_lib(plat_specific=False,standard_lib=True),sysconfig.get_python_lib(plat_specific=True,standard_lib=True),sysconfig.get_python_lib(plat_specific=False,standard_lib=False),sysconfig.get_python_lib(plat_specific=True,standard_lib=False)]))" RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT OUTPUT_VARIABLE _${_PYTHON_PREFIX}_LIBPATHS ERROR_QUIET) @@ -2462,7 +2520,7 @@ if ("Compiler" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS) # retrieve python environment version from compiler _python_get_launcher (_${_PYTHON_PREFIX}_COMPILER_LAUNCHER COMPILER) set (_${_PYTHON_PREFIX}_VERSION_DIR "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/PythonCompilerVersion.dir") - file (WRITE "${_${_PYTHON_PREFIX}_VERSION_DIR}/version.py" "import sys; sys.stdout.write('.'.join([str(x) for x in sys.version_info[:3]]))\n") + file (WRITE "${_${_PYTHON_PREFIX}_VERSION_DIR}/version.py" "import sys; sys.stdout.write('.'.join([str(x) for x in sys.version_info[:3]])); sys.stdout.flush()\n") execute_process (COMMAND ${_${_PYTHON_PREFIX}_COMPILER_LAUNCHER} "${_${_PYTHON_PREFIX}_COMPILER}" ${_${_PYTHON_PREFIX}_IRON_PYTHON_COMPILER_ARCH_FLAGS} /target:exe /embed "${_${_PYTHON_PREFIX}_VERSION_DIR}/version.py" diff --git a/Modules/FindPython2.cmake b/Modules/FindPython2.cmake index 41d9b68..4c7ab5c 100644 --- a/Modules/FindPython2.cmake +++ b/Modules/FindPython2.cmake @@ -112,27 +112,23 @@ This module will set the following variables in your project ``Python2_STDLIB`` Standard platform independent installation directory. - Information returned by - ``distutils.sysconfig.get_python_lib(plat_specific=False,standard_lib=True)`` - or else ``sysconfig.get_path('stdlib')``. + Information returned by ``sysconfig.get_path('stdlib')`` or else + ``distutils.sysconfig.get_python_lib(plat_specific=False,standard_lib=True)``. ``Python2_STDARCH`` Standard platform dependent installation directory. - Information returned by - ``distutils.sysconfig.get_python_lib(plat_specific=True,standard_lib=True)`` - or else ``sysconfig.get_path('platstdlib')``. + Information returned by ``sysconfig.get_path('platstdlib')`` or else + ``distutils.sysconfig.get_python_lib(plat_specific=True,standard_lib=True)``. ``Python2_SITELIB`` Third-party platform independent installation directory. - Information returned by - ``distutils.sysconfig.get_python_lib(plat_specific=False,standard_lib=False)`` - or else ``sysconfig.get_path('purelib')``. + Information returned by ``sysconfig.get_path('purelib')`` or else + ``distutils.sysconfig.get_python_lib(plat_specific=False,standard_lib=False)``. ``Python2_SITEARCH`` Third-party platform dependent installation directory. - Information returned by - ``distutils.sysconfig.get_python_lib(plat_specific=True,standard_lib=False)`` - or else ``sysconfig.get_path('platlib')``. + Information returned by ``sysconfig.get_path('platlib')`` or else + ``distutils.sysconfig.get_python_lib(plat_specific=True,standard_lib=False)``. ``Python2_Compiler_FOUND`` System has the Python 2 compiler. ``Python2_COMPILER`` @@ -234,6 +230,8 @@ Hints constraints is founded. This is the default if policy :policy:`CMP0094` is set to ``NEW``. + See also ``Python2_FIND_UNVERSIONED_NAMES``. + ``Python2_FIND_REGISTRY`` .. versionadded:: 3.13 @@ -341,6 +339,8 @@ Hints This is the default. * ``NEVER``: The generic name are not searched at all. + See also ``Python2_FIND_STRATEGY``. + Artifacts Specification ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/Modules/FindPython3.cmake b/Modules/FindPython3.cmake index ae086e8..901565b 100644 --- a/Modules/FindPython3.cmake +++ b/Modules/FindPython3.cmake @@ -126,38 +126,28 @@ This module will set the following variables in your project ``Python3_STDLIB`` Standard platform independent installation directory. - Information returned by - ``distutils.sysconfig.get_python_lib(plat_specific=False,standard_lib=True)`` - or else ``sysconfig.get_path('stdlib')``. + Information returned by ``sysconfig.get_path('stdlib')``. ``Python3_STDARCH`` Standard platform dependent installation directory. - Information returned by - ``distutils.sysconfig.get_python_lib(plat_specific=True,standard_lib=True)`` - or else ``sysconfig.get_path('platstdlib')``. + Information returned by ``sysconfig.get_path('platstdlib')``. ``Python3_SITELIB`` Third-party platform independent installation directory. - Information returned by - ``distutils.sysconfig.get_python_lib(plat_specific=False,standard_lib=False)`` - or else ``sysconfig.get_path('purelib')``. + Information returned by ``sysconfig.get_path('purelib')``. ``Python3_SITEARCH`` Third-party platform dependent installation directory. - Information returned by - ``distutils.sysconfig.get_python_lib(plat_specific=True,standard_lib=False)`` - or else ``sysconfig.get_path('platlib')``. + Information returned by ``sysconfig.get_path('platlib')``. ``Python3_SOABI`` .. versionadded:: 3.17 Extension suffix for modules. - Information computed from ``distutils.sysconfig.get_config_var('EXT_SUFFIX')`` - or ``distutils.sysconfig.get_config_var('SOABI')`` or - ``python3-config --extension-suffix``. If package ``distutils.sysconfig`` is - not available, ``sysconfig.get_config_var('EXT_SUFFIX')`` or - ``sysconfig.get_config_var('SOABI')`` are used. + Information computed from ``sysconfig.get_config_var('EXT_SUFFIX')`` or + ``sysconfig.get_config_var('SOABI')`` or + ``python3-config --extension-suffix``. ``Python3_SOSABI`` .. versionadded:: 3.26 @@ -333,6 +323,8 @@ Hints constraints is founded. This is the default if policy :policy:`CMP0094` is set to ``NEW``. + See also ``Python3_FIND_UNVERSIONED_NAMES``. + ``Python3_FIND_REGISTRY`` .. versionadded:: 3.13 @@ -440,6 +432,8 @@ Hints This is the default. * ``NEVER``: The generic name are not searched at all. + See also ``Python3_FIND_STRATEGY``. + Artifacts Specification ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/Modules/FindPythonInterp.cmake b/Modules/FindPythonInterp.cmake index 7ad3587..b5e759d 100644 --- a/Modules/FindPythonInterp.cmake +++ b/Modules/FindPythonInterp.cmake @@ -5,6 +5,9 @@ FindPythonInterp ---------------- +.. versionchanged:: 3.27 + This module is available only if policy :policy:`CMP0148` is not set to ``NEW``. + .. deprecated:: 3.12 Use :module:`FindPython3`, :module:`FindPython2` or :module:`FindPython` instead. @@ -50,6 +53,16 @@ of PYTHON_LIBRARIES. #]=======================================================================] +cmake_policy(GET CMP0148 _FindPythonInterp_CMP0148) +if(_FindPythonInterp_CMP0148 STREQUAL "NEW") + message(FATAL_ERROR "The FindPythonInterp module has been removed by policy CMP0148.") +endif() + +if(_FindPythonInterp_testing) + set(_FindPythonInterp_included TRUE) + return() +endif() + unset(_Python_NAMES) set(_PYTHON1_VERSIONS 1.6 1.5) diff --git a/Modules/FindPythonLibs.cmake b/Modules/FindPythonLibs.cmake index 43a84dd..06004ee 100644 --- a/Modules/FindPythonLibs.cmake +++ b/Modules/FindPythonLibs.cmake @@ -5,6 +5,9 @@ FindPythonLibs -------------- +.. versionchanged:: 3.27 + This module is available only if policy :policy:`CMP0148` is not set to ``NEW``. + .. deprecated:: 3.12 Use :module:`FindPython3`, :module:`FindPython2` or :module:`FindPython` instead. @@ -45,6 +48,16 @@ get the currently active Python version by default with a consistent version of PYTHON_LIBRARIES. #]=======================================================================] +cmake_policy(GET CMP0148 _FindPythonLibs_CMP0148) +if(_FindPythonLibs_CMP0148 STREQUAL "NEW") + message(FATAL_ERROR "The FindPythonLibs module has been removed by policy CMP0148.") +endif() + +if(_FindPythonLibs_testing) + set(_FindPythonLibs_included TRUE) + return() +endif() + # Use the executable's path as a hint set(_Python_LIBRARY_PATH_HINT) if(IS_ABSOLUTE "${PYTHON_EXECUTABLE}") diff --git a/Modules/FindVulkan.cmake b/Modules/FindVulkan.cmake index 3817987..581763d 100644 --- a/Modules/FindVulkan.cmake +++ b/Modules/FindVulkan.cmake @@ -244,23 +244,26 @@ endif() if(WIN32) set(_Vulkan_library_name vulkan-1) set(_Vulkan_hint_include_search_paths - "$ENV{VULKAN_SDK}/Include" + "$ENV{VULKAN_SDK}/include" ) if(CMAKE_SIZEOF_VOID_P EQUAL 8) set(_Vulkan_hint_executable_search_paths - "$ENV{VULKAN_SDK}/Bin" + "$ENV{VULKAN_SDK}/bin" ) set(_Vulkan_hint_library_search_paths - "$ENV{VULKAN_SDK}/Lib" - "$ENV{VULKAN_SDK}/Bin" + "$ENV{VULKAN_SDK}/lib" + "$ENV{VULKAN_SDK}/bin" ) else() set(_Vulkan_hint_executable_search_paths - "$ENV{VULKAN_SDK}/Bin32" + "$ENV{VULKAN_SDK}/bin32" + "$ENV{VULKAN_SDK}/bin" ) set(_Vulkan_hint_library_search_paths - "$ENV{VULKAN_SDK}/Lib32" - "$ENV{VULKAN_SDK}/Bin32" + "$ENV{VULKAN_SDK}/lib32" + "$ENV{VULKAN_SDK}/bin32" + "$ENV{VULKAN_SDK}/lib" + "$ENV{VULKAN_SDK}/bin" ) endif() else() diff --git a/Modules/FindX11.cmake b/Modules/FindX11.cmake index 8e5a5f1..1047e4f 100644 --- a/Modules/FindX11.cmake +++ b/Modules/FindX11.cmake @@ -22,52 +22,77 @@ and also the following more fine grained variables and targets: :: - X11_ICE_INCLUDE_PATH, X11_ICE_LIB, X11_ICE_FOUND, X11::ICE - X11_SM_INCLUDE_PATH, X11_SM_LIB, X11_SM_FOUND, X11::SM - X11_X11_INCLUDE_PATH, X11_X11_LIB, X11::X11 + X11_ICE_INCLUDE_PATH, X11_ICE_LIB, X11_ICE_FOUND, X11::ICE + X11_SM_INCLUDE_PATH, X11_SM_LIB, X11_SM_FOUND, X11::SM + X11_X11_INCLUDE_PATH, X11_X11_LIB, X11::X11 X11_Xaccessrules_INCLUDE_PATH, - X11_Xaccessstr_INCLUDE_PATH, X11_Xaccess_FOUND - X11_Xau_INCLUDE_PATH, X11_Xau_LIB, X11_Xau_FOUND, X11::Xau - X11_xcb_INCLUDE_PATH, X11_xcb_LIB, X11_xcb_FOUND, X11::xcb - X11_X11_xcb_INCLUDE_PATH, X11_X11_xcb_LIB, X11_X11_xcb_FOUND, X11::X11_xcb - X11_xcb_icccm_INCLUDE_PATH, X11_xcb_icccm_LIB, X11_xcb_icccm_FOUND, X11::xcb_icccm - X11_xcb_randr_INCLUDE_PATH, X11_xcb_randr_LIB, X11_xcb_randr_FOUND, X11::xcb_randr - X11_xcb_util_INCLUDE_PATH, X11_xcb_util_LIB, X11_xcb_util_FOUND, X11::xcb_util - X11_xcb_xfixes_INCLUDE_PATH, X11_xcb_xfixes_LIB, X11_xcb_xfixes_FOUND, X11::xcb_xfixes - X11_xcb_xtest_INCLUDE_PATH, X11_xcb_xtest_LIB, X11_xcb_xtest_FOUND, X11::xcb_xtest - X11_xcb_keysyms_INCLUDE_PATH, X11_xcb_keysyms_LIB,X11_xcb_keysyms_FOUND,X11::xcb_keysyms - X11_xcb_xkb_INCLUDE_PATH, X11_xcb_xkb_LIB, X11_xcb_xkb_FOUND, X11::xcb_xkb - X11_Xcomposite_INCLUDE_PATH, X11_Xcomposite_LIB, X11_Xcomposite_FOUND, X11::Xcomposite - X11_Xcursor_INCLUDE_PATH, X11_Xcursor_LIB, X11_Xcursor_FOUND, X11::Xcursor - X11_Xdamage_INCLUDE_PATH, X11_Xdamage_LIB, X11_Xdamage_FOUND, X11::Xdamage - X11_Xdmcp_INCLUDE_PATH, X11_Xdmcp_LIB, X11_Xdmcp_FOUND, X11::Xdmcp - X11_Xext_INCLUDE_PATH, X11_Xext_LIB, X11_Xext_FOUND, X11::Xext - X11_Xxf86misc_INCLUDE_PATH, X11_Xxf86misc_LIB, X11_Xxf86misc_FOUND, X11::Xxf86misc - X11_Xxf86vm_INCLUDE_PATH, X11_Xxf86vm_LIB X11_Xxf86vm_FOUND, X11::Xxf86vm - X11_Xfixes_INCLUDE_PATH, X11_Xfixes_LIB, X11_Xfixes_FOUND, X11::Xfixes - X11_Xft_INCLUDE_PATH, X11_Xft_LIB, X11_Xft_FOUND, X11::Xft - X11_Xi_INCLUDE_PATH, X11_Xi_LIB, X11_Xi_FOUND, X11::Xi - X11_Xinerama_INCLUDE_PATH, X11_Xinerama_LIB, X11_Xinerama_FOUND, X11::Xinerama + X11_Xaccessstr_INCLUDE_PATH, X11_Xaccess_FOUND + X11_Xau_INCLUDE_PATH, X11_Xau_LIB, X11_Xau_FOUND, X11::Xau + X11_xcb_INCLUDE_PATH, X11_xcb_LIB, X11_xcb_FOUND, X11::xcb + X11_X11_xcb_INCLUDE_PATH, X11_X11_xcb_LIB, X11_X11_xcb_FOUND, X11::X11_xcb + X11_xcb_composite_INCLUDE_PATH, X11_xcb_composite_LIB, X11_xcb_composite_FOUND, X11::xcb_composite + X11_xcb_cursor_INCLUDE_PATH, X11_xcb_cursor_LIB, X11_xcb_cursor_FOUND, X11::xcb_cursor + X11_xcb_damage_INCLUDE_PATH, X11_xcb_damage_LIB, X11_xcb_damage_FOUND, X11::xcb_damage + X11_xcb_dpms_INCLUDE_PATH, X11_xcb_dpms_LIB, X11_xcb_dpms_FOUND, X11::xcb_dpms + X11_xcb_dri2_INCLUDE_PATH, X11_xcb_dri2_LIB, X11_xcb_dri2_FOUND, X11::xcb_dri2 + X11_xcb_dri3_INCLUDE_PATH, X11_xcb_dri3_LIB, X11_xcb_dri3_FOUND, X11::xcb_dri3 + X11_xcb_errors_INCLUDE_PATH, X11_xcb_errors_LIB, X11_xcb_errors_FOUND, X11::xcb_errors + X11_xcb_ewmh_INCLUDE_PATH, X11_xcb_ewmh_LIB, X11_xcb_ewmh_FOUND, X11::xcb_ewmh + X11_xcb_glx_INCLUDE_PATH, X11_xcb_glx_LIB, X11_xcb_glx_FOUND, X11::xcb_glx + X11_xcb_icccm_INCLUDE_PATH, X11_xcb_icccm_LIB, X11_xcb_icccm_FOUND, X11::xcb_icccm + X11_xcb_image_INCLUDE_PATH, X11_xcb_image_LIB, X11_xcb_image_FOUND, X11::xcb_image + X11_xcb_keysyms_INCLUDE_PATH, X11_xcb_keysyms_LIB, X11_xcb_keysyms_FOUND, X11::xcb_keysyms + X11_xcb_present_INCLUDE_PATH, X11_xcb_present_LIB, X11_xcb_present_FOUND, X11::xcb_present + X11_xcb_randr_INCLUDE_PATH, X11_xcb_randr_LIB, X11_xcb_randr_FOUND, X11::xcb_randr + X11_xcb_record_INCLUDE_PATH, X11_xcb_record_LIB, X11_xcb_record_FOUND, X11::xcb_record + X11_xcb_render_INCLUDE_PATH, X11_xcb_render_LIB, X11_xcb_render_FOUND, X11::xcb_render + X11_xcb_render_util_INCLUDE_PATH,X11_xcb_render_util_LIB,X11_xcb_render_util_FOUND,X11::xcb_render_util + X11_xcb_res_INCLUDE_PATH, X11_xcb_res_LIB, X11_xcb_res_FOUND, X11::xcb_res + X11_xcb_screensaver_INCLUDE_PATH,X11_xcb_screensaver_LIB,X11_xcb_screensaver_FOUND,X11::xcb_screensaver + X11_xcb_shape_INCLUDE_PATH, X11_xcb_shape_LIB, X11_xcb_shape_FOUND, X11::xcb_shape + X11_xcb_shm_INCLUDE_PATH, X11_xcb_shm_LIB, X11_xcb_shm_FOUND, X11::xcb_shm + X11_xcb_sync_INCLUDE_PATH, X11_xcb_sync_LIB, X11_xcb_sync_FOUND, X11::xcb_sync + X11_xcb_util_INCLUDE_PATH, X11_xcb_util_LIB, X11_xcb_util_FOUND, X11::xcb_util + X11_xcb_xf86dri_INCLUDE_PATH, X11_xcb_xf86dri_LIB, X11_xcb_xf86dri_FOUND, X11::xcb_xf86dri + X11_xcb_xfixes_INCLUDE_PATH, X11_xcb_xfixes_LIB, X11_xcb_xfixes_FOUND, X11::xcb_xfixes + X11_xcb_xinerama_INCLUDE_PATH, X11_xcb_xinerama_LIB, X11_xcb_xinerama_FOUND, X11::xcb_xinerama + X11_xcb_xinput_INCLUDE_PATH, X11_xcb_xinput_LIB, X11_xcb_xinput_FOUND, X11::xcb_xinput + X11_xcb_xkb_INCLUDE_PATH, X11_xcb_xkb_LIB, X11_xcb_xkb_FOUND, X11::xcb_xkb + X11_xcb_xrm_INCLUDE_PATH, X11_xcb_xrm_LIB, X11_xcb_xrm_FOUND, X11::xcb_xrm + X11_xcb_xtest_INCLUDE_PATH, X11_xcb_xtest_LIB, X11_xcb_xtest_FOUND, X11::xcb_xtest + X11_xcb_xvmc_INCLUDE_PATH, X11_xcb_xvmc_LIB, X11_xcb_xvmc_FOUND, X11::xcb_xvmc + X11_xcb_xv_INCLUDE_PATH, X11_xcb_xv_LIB, X11_xcb_xv_FOUND X11::xcb_xv + X11_Xcomposite_INCLUDE_PATH, X11_Xcomposite_LIB, X11_Xcomposite_FOUND, X11::Xcomposite + X11_Xcursor_INCLUDE_PATH, X11_Xcursor_LIB, X11_Xcursor_FOUND, X11::Xcursor + X11_Xdamage_INCLUDE_PATH, X11_Xdamage_LIB, X11_Xdamage_FOUND, X11::Xdamage + X11_Xdmcp_INCLUDE_PATH, X11_Xdmcp_LIB, X11_Xdmcp_FOUND, X11::Xdmcp + X11_Xext_INCLUDE_PATH, X11_Xext_LIB, X11_Xext_FOUND, X11::Xext + X11_Xxf86misc_INCLUDE_PATH, X11_Xxf86misc_LIB, X11_Xxf86misc_FOUND, X11::Xxf86misc + X11_Xxf86vm_INCLUDE_PATH, X11_Xxf86vm_LIB X11_Xxf86vm_FOUND, X11::Xxf86vm + X11_Xfixes_INCLUDE_PATH, X11_Xfixes_LIB, X11_Xfixes_FOUND, X11::Xfixes + X11_Xft_INCLUDE_PATH, X11_Xft_LIB, X11_Xft_FOUND, X11::Xft + X11_Xi_INCLUDE_PATH, X11_Xi_LIB, X11_Xi_FOUND, X11::Xi + X11_Xinerama_INCLUDE_PATH, X11_Xinerama_LIB, X11_Xinerama_FOUND, X11::Xinerama X11_Xkb_INCLUDE_PATH, - X11_Xkblib_INCLUDE_PATH, X11_Xkb_FOUND, X11::Xkb - X11_xkbcommon_INCLUDE_PATH, X11_xkbcommon_LIB, X11_xkbcommon_FOUND, X11::xkbcommon - X11_xkbcommon_X11_INCLUDE_PATH,X11_xkbcommon_X11_LIB,X11_xkbcommon_X11_FOUND,X11::xkbcommon_X11 - X11_xkbfile_INCLUDE_PATH, X11_xkbfile_LIB, X11_xkbfile_FOUND, X11::xkbfile - X11_Xmu_INCLUDE_PATH, X11_Xmu_LIB, X11_Xmu_FOUND, X11::Xmu - X11_Xpm_INCLUDE_PATH, X11_Xpm_LIB, X11_Xpm_FOUND, X11::Xpm - X11_Xtst_INCLUDE_PATH, X11_Xtst_LIB, X11_Xtst_FOUND, X11::Xtst - X11_Xrandr_INCLUDE_PATH, X11_Xrandr_LIB, X11_Xrandr_FOUND, X11::Xrandr - X11_Xrender_INCLUDE_PATH, X11_Xrender_LIB, X11_Xrender_FOUND, X11::Xrender - X11_XRes_INCLUDE_PATH, X11_XRes_LIB, X11_XRes_FOUND, X11::XRes - X11_Xss_INCLUDE_PATH, X11_Xss_LIB, X11_Xss_FOUND, X11::Xss - X11_Xt_INCLUDE_PATH, X11_Xt_LIB, X11_Xt_FOUND, X11::Xt - X11_Xutil_INCLUDE_PATH, X11_Xutil_FOUND, X11::Xutil - X11_Xv_INCLUDE_PATH, X11_Xv_LIB, X11_Xv_FOUND, X11::Xv - X11_dpms_INCLUDE_PATH, (in X11_Xext_LIB), X11_dpms_FOUND - X11_XShm_INCLUDE_PATH, (in X11_Xext_LIB), X11_XShm_FOUND - X11_Xshape_INCLUDE_PATH, (in X11_Xext_LIB), X11_Xshape_FOUND - X11_XSync_INCLUDE_PATH, (in X11_Xext_LIB), X11_XSync_FOUND - X11_Xaw_INCLUDE_PATH, X11_Xaw_LIB X11_Xaw_FOUND X11::Xaw + X11_Xkblib_INCLUDE_PATH, X11_Xkb_FOUND, X11::Xkb + X11_xkbcommon_INCLUDE_PATH, X11_xkbcommon_LIB, X11_xkbcommon_FOUND, X11::xkbcommon + X11_xkbcommon_X11_INCLUDE_PATH, X11_xkbcommon_X11_LIB, X11_xkbcommon_X11_FOUND, X11::xkbcommon_X11 + X11_xkbfile_INCLUDE_PATH, X11_xkbfile_LIB, X11_xkbfile_FOUND, X11::xkbfile + X11_Xmu_INCLUDE_PATH, X11_Xmu_LIB, X11_Xmu_FOUND, X11::Xmu + X11_Xpm_INCLUDE_PATH, X11_Xpm_LIB, X11_Xpm_FOUND, X11::Xpm + X11_Xtst_INCLUDE_PATH, X11_Xtst_LIB, X11_Xtst_FOUND, X11::Xtst + X11_Xrandr_INCLUDE_PATH, X11_Xrandr_LIB, X11_Xrandr_FOUND, X11::Xrandr + X11_Xrender_INCLUDE_PATH, X11_Xrender_LIB, X11_Xrender_FOUND, X11::Xrender + X11_XRes_INCLUDE_PATH, X11_XRes_LIB, X11_XRes_FOUND, X11::XRes + X11_Xss_INCLUDE_PATH, X11_Xss_LIB, X11_Xss_FOUND, X11::Xss + X11_Xt_INCLUDE_PATH, X11_Xt_LIB, X11_Xt_FOUND, X11::Xt + X11_Xutil_INCLUDE_PATH, X11_Xutil_FOUND, X11::Xutil + X11_Xv_INCLUDE_PATH, X11_Xv_LIB, X11_Xv_FOUND, X11::Xv + X11_dpms_INCLUDE_PATH, (in X11_Xext_LIB), X11_dpms_FOUND + X11_XShm_INCLUDE_PATH, (in X11_Xext_LIB), X11_XShm_FOUND + X11_Xshape_INCLUDE_PATH, (in X11_Xext_LIB), X11_Xshape_FOUND + X11_XSync_INCLUDE_PATH, (in X11_Xext_LIB), X11_XSync_FOUND + X11_Xaw_INCLUDE_PATH, X11_Xaw_LIB X11_Xaw_FOUND X11::Xaw .. versionadded:: 3.14 Renamed ``Xxf86misc``, ``X11_Xxf86misc``, ``X11_Xxf86vm``, ``X11_xkbfile``, @@ -88,6 +113,14 @@ and also the following more fine grained variables and targets: .. versionadded:: 3.24 Added the ``xcb_randr``, ``xcb_xtext``, and ``xcb_keysyms`` libraries. +.. versionadded:: 3.27 + Added the ``xcb_composite``, ``xcb_cursor``, ``xcb_damage``, ``xcb_dpms``, + ``xcb_dri2``, ``xcb_dri3``, ``xcb_errors``, ``xcb_ewmh``, ``xcb_glx``, + ``xcb_image``, ``xcb_present``, ``xcb_record``, ``xcb_render``, + ``xcb_render_util``, ``xcb_res``, ``xcb_screensaver``, ``xcb_shape``, + ``xcb_shm``, ``xcb_sync``, ``xcb_xf86dri``, ``xcb_xinerama``, ``xcb_xinput``, + ``xcb_xrm``, ``xcb_xvmc``, and ``xcb_xv`` libraries. + #]=======================================================================] if (UNIX) @@ -129,15 +162,41 @@ if (UNIX) find_path(X11_Xaccessrules_INCLUDE_PATH X11/extensions/XKBrules.h ${X11_INC_SEARCH_PATH}) find_path(X11_Xaccessstr_INCLUDE_PATH X11/extensions/XKBstr.h ${X11_INC_SEARCH_PATH}) find_path(X11_Xau_INCLUDE_PATH X11/Xauth.h ${X11_INC_SEARCH_PATH}) - find_path(X11_Xaw_INCLUDE_PATH X11/Xaw/Intrinsic.h ${X11_INC_SEARCH_PATH}) + find_path(X11_Xaw_INCLUDE_PATH X11/Xaw/Box.h ${X11_INC_SEARCH_PATH}) find_path(X11_xcb_INCLUDE_PATH xcb/xcb.h ${X11_INC_SEARCH_PATH}) find_path(X11_X11_xcb_INCLUDE_PATH X11/Xlib-xcb.h ${X11_INC_SEARCH_PATH}) + find_path(X11_xcb_composite_INCLUDE_PATH xcb/composite.h ${X11_INC_SEARCH_PATH}) + find_path(X11_xcb_cursor_INCLUDE_PATH xcb/xcb_cursor.h ${X11_INC_SEARCH_PATH}) + find_path(X11_xcb_damage_INCLUDE_PATH xcb/damage.h ${X11_INC_SEARCH_PATH}) + find_path(X11_xcb_dpms_INCLUDE_PATH xcb/dpms.h ${X11_INC_SEARCH_PATH}) + find_path(X11_xcb_dri2_INCLUDE_PATH xcb/dri2.h ${X11_INC_SEARCH_PATH}) + find_path(X11_xcb_dri3_INCLUDE_PATH xcb/dri3.h ${X11_INC_SEARCH_PATH}) + find_path(X11_xcb_errors_INCLUDE_PATH xcb/xcb_errors.h ${X11_INC_SEARCH_PATH}) + find_path(X11_xcb_ewmh_INCLUDE_PATH xcb/xcb_ewmh.h ${X11_INC_SEARCH_PATH}) + find_path(X11_xcb_glx_INCLUDE_PATH xcb/glx.h ${X11_INC_SEARCH_PATH}) find_path(X11_xcb_icccm_INCLUDE_PATH xcb/xcb_icccm.h ${X11_INC_SEARCH_PATH}) + find_path(X11_xcb_image_INCLUDE_PATH xcb/xcb_image.h ${X11_INC_SEARCH_PATH}) + find_path(X11_xcb_keysyms_INCLUDE_PATH xcb/xcb_keysyms.h ${X11_INC_SEARCH_PATH}) + find_path(X11_xcb_present_INCLUDE_PATH xcb/present.h ${X11_INC_SEARCH_PATH}) find_path(X11_xcb_randr_INCLUDE_PATH xcb/randr.h ${X11_INC_SEARCH_PATH}) + find_path(X11_xcb_record_INCLUDE_PATH xcb/record.h ${X11_INC_SEARCH_PATH}) + find_path(X11_xcb_render_INCLUDE_PATH xcb/render.h ${X11_INC_SEARCH_PATH}) + find_path(X11_xcb_render_util_INCLUDE_PATH xcb/xcb_renderutil.h ${X11_INC_SEARCH_PATH}) + find_path(X11_xcb_res_INCLUDE_PATH xcb/res.h ${X11_INC_SEARCH_PATH}) + find_path(X11_xcb_screensaver_INCLUDE_PATH xcb/screensaver.h ${X11_INC_SEARCH_PATH}) + find_path(X11_xcb_shape_INCLUDE_PATH xcb/shape.h ${X11_INC_SEARCH_PATH}) + find_path(X11_xcb_shm_INCLUDE_PATH xcb/shm.h ${X11_INC_SEARCH_PATH}) + find_path(X11_xcb_sync_INCLUDE_PATH xcb/sync.h ${X11_INC_SEARCH_PATH}) find_path(X11_xcb_util_INCLUDE_PATH xcb/xcb_aux.h ${X11_INC_SEARCH_PATH}) + find_path(X11_xcb_xf86dri_INCLUDE_PATH xcb/xf86dri.h ${X11_INC_SEARCH_PATH}) find_path(X11_xcb_xfixes_INCLUDE_PATH xcb/xfixes.h ${X11_INC_SEARCH_PATH}) + find_path(X11_xcb_xinerama_INCLUDE_PATH xcb/xinerama.h ${X11_INC_SEARCH_PATH}) + find_path(X11_xcb_xinput_INCLUDE_PATH xcb/xinput.h ${X11_INC_SEARCH_PATH}) + find_path(X11_xcb_xkb_INCLUDE_PATH xcb/xkb.h ${X11_INC_SEARCH_PATH}) + find_path(X11_xcb_xrm_INCLUDE_PATH xcb/xcb_xrm.h ${X11_INC_SEARCH_PATH}) find_path(X11_xcb_xtest_INCLUDE_PATH xcb/xtest.h ${X11_INC_SEARCH_PATH}) - find_path(X11_xcb_keysyms_INCLUDE_PATH xcb/xcb_keysyms.h ${X11_INC_SEARCH_PATH}) + find_path(X11_xcb_xvmc_INCLUDE_PATH xcb/xvmc.h ${X11_INC_SEARCH_PATH}) + find_path(X11_xcb_xv_INCLUDE_PATH xcb/xv.h ${X11_INC_SEARCH_PATH}) find_path(X11_Xcomposite_INCLUDE_PATH X11/extensions/Xcomposite.h ${X11_INC_SEARCH_PATH}) find_path(X11_Xcursor_INCLUDE_PATH X11/Xcursor/Xcursor.h ${X11_INC_SEARCH_PATH}) find_path(X11_Xdamage_INCLUDE_PATH X11/extensions/Xdamage.h ${X11_INC_SEARCH_PATH}) @@ -182,42 +241,67 @@ if (UNIX) find_library(X11_X11_LIB X11 ${X11_LIB_SEARCH_PATH}) # Find additional X libraries. Keep list sorted by library name. - find_library(X11_ICE_LIB ICE ${X11_LIB_SEARCH_PATH}) - find_library(X11_SM_LIB SM ${X11_LIB_SEARCH_PATH}) - find_library(X11_Xau_LIB Xau ${X11_LIB_SEARCH_PATH}) - find_library(X11_Xaw_LIB Xaw ${X11_LIB_SEARCH_PATH}) - find_library(X11_xcb_LIB xcb ${X11_LIB_SEARCH_PATH}) - find_library(X11_X11_xcb_LIB X11-xcb ${X11_LIB_SEARCH_PATH}) - find_library(X11_xcb_icccm_LIB xcb-icccm ${X11_LIB_SEARCH_PATH}) - find_library(X11_xcb_randr_LIB xcb-randr ${X11_LIB_SEARCH_PATH}) - find_library(X11_xcb_util_LIB xcb-util ${X11_LIB_SEARCH_PATH}) - find_library(X11_xcb_xfixes_LIB xcb-xfixes ${X11_LIB_SEARCH_PATH}) - find_library(X11_xcb_xtest_LIB xcb-xtest ${X11_LIB_SEARCH_PATH}) - find_library(X11_xcb_keysyms_LIB xcb-keysyms ${X11_LIB_SEARCH_PATH}) - find_library(X11_xcb_xkb_LIB xcb-xkb ${X11_LIB_SEARCH_PATH}) - find_library(X11_Xcomposite_LIB Xcomposite ${X11_LIB_SEARCH_PATH}) - find_library(X11_Xcursor_LIB Xcursor ${X11_LIB_SEARCH_PATH}) - find_library(X11_Xdamage_LIB Xdamage ${X11_LIB_SEARCH_PATH}) - find_library(X11_Xdmcp_LIB Xdmcp ${X11_LIB_SEARCH_PATH}) - find_library(X11_Xext_LIB Xext ${X11_LIB_SEARCH_PATH}) - find_library(X11_Xfixes_LIB Xfixes ${X11_LIB_SEARCH_PATH}) - find_library(X11_Xft_LIB Xft ${X11_LIB_SEARCH_PATH}) - find_library(X11_Xi_LIB Xi ${X11_LIB_SEARCH_PATH}) - find_library(X11_Xinerama_LIB Xinerama ${X11_LIB_SEARCH_PATH}) - find_library(X11_xkbcommon_LIB xkbcommon ${X11_LIB_SEARCH_PATH}) - find_library(X11_xkbcommon_X11_LIB xkbcommon-x11 ${X11_LIB_SEARCH_PATH}) - find_library(X11_xkbfile_LIB xkbfile ${X11_LIB_SEARCH_PATH}) - find_library(X11_Xmu_LIB Xmu ${X11_LIB_SEARCH_PATH}) - find_library(X11_Xpm_LIB Xpm ${X11_LIB_SEARCH_PATH}) - find_library(X11_Xrandr_LIB Xrandr ${X11_LIB_SEARCH_PATH}) - find_library(X11_Xrender_LIB Xrender ${X11_LIB_SEARCH_PATH}) - find_library(X11_XRes_LIB XRes ${X11_LIB_SEARCH_PATH}) - find_library(X11_Xss_LIB Xss ${X11_LIB_SEARCH_PATH}) - find_library(X11_Xt_LIB Xt ${X11_LIB_SEARCH_PATH}) - find_library(X11_Xtst_LIB Xtst ${X11_LIB_SEARCH_PATH}) - find_library(X11_Xv_LIB Xv ${X11_LIB_SEARCH_PATH}) - find_library(X11_Xxf86misc_LIB Xxf86misc ${X11_LIB_SEARCH_PATH}) - find_library(X11_Xxf86vm_LIB Xxf86vm ${X11_LIB_SEARCH_PATH}) + find_library(X11_ICE_LIB ICE ${X11_LIB_SEARCH_PATH}) + find_library(X11_SM_LIB SM ${X11_LIB_SEARCH_PATH}) + find_library(X11_Xau_LIB Xau ${X11_LIB_SEARCH_PATH}) + find_library(X11_Xaw_LIB Xaw ${X11_LIB_SEARCH_PATH}) + find_library(X11_xcb_LIB xcb ${X11_LIB_SEARCH_PATH}) + find_library(X11_X11_xcb_LIB X11-xcb ${X11_LIB_SEARCH_PATH}) + find_library(X11_xcb_composite_LIB xcb-composite ${X11_LIB_SEARCH_PATH}) + find_library(X11_xcb_cursor_LIB xcb-cursor ${X11_LIB_SEARCH_PATH}) + find_library(X11_xcb_damage_LIB xcb-damage ${X11_LIB_SEARCH_PATH}) + find_library(X11_xcb_dpms_LIB xcb-dpms ${X11_LIB_SEARCH_PATH}) + find_library(X11_xcb_dri2_LIB xcb-dri2 ${X11_LIB_SEARCH_PATH}) + find_library(X11_xcb_dri3_LIB xcb-dri3 ${X11_LIB_SEARCH_PATH}) + find_library(X11_xcb_errors_LIB xcb-errors ${X11_LIB_SEARCH_PATH}) + find_library(X11_xcb_ewmh_LIB xcb-ewmh ${X11_LIB_SEARCH_PATH}) + find_library(X11_xcb_glx_LIB xcb-glx ${X11_LIB_SEARCH_PATH}) + find_library(X11_xcb_icccm_LIB xcb-icccm ${X11_LIB_SEARCH_PATH}) + find_library(X11_xcb_image_LIB xcb-image ${X11_LIB_SEARCH_PATH}) + find_library(X11_xcb_keysyms_LIB xcb-keysyms ${X11_LIB_SEARCH_PATH}) + find_library(X11_xcb_present_LIB xcb-present ${X11_LIB_SEARCH_PATH}) + find_library(X11_xcb_randr_LIB xcb-randr ${X11_LIB_SEARCH_PATH}) + find_library(X11_xcb_record_LIB xcb-record ${X11_LIB_SEARCH_PATH}) + find_library(X11_xcb_render_LIB xcb-render ${X11_LIB_SEARCH_PATH}) + find_library(X11_xcb_render_util_LIB xcb-render-util ${X11_LIB_SEARCH_PATH}) + find_library(X11_xcb_res_LIB xcb-res ${X11_LIB_SEARCH_PATH}) + find_library(X11_xcb_screensaver_LIB xcb-screensaver ${X11_LIB_SEARCH_PATH}) + find_library(X11_xcb_shape_LIB xcb-shape ${X11_LIB_SEARCH_PATH}) + find_library(X11_xcb_shm_LIB xcb-shm ${X11_LIB_SEARCH_PATH}) + find_library(X11_xcb_sync_LIB xcb-sync ${X11_LIB_SEARCH_PATH}) + find_library(X11_xcb_util_LIB xcb-util ${X11_LIB_SEARCH_PATH}) + find_library(X11_xcb_xf86dri_LIB xcb-xf86dri ${X11_LIB_SEARCH_PATH}) + find_library(X11_xcb_xfixes_LIB xcb-xfixes ${X11_LIB_SEARCH_PATH}) + find_library(X11_xcb_xinerama_LIB xcb-xinerama ${X11_LIB_SEARCH_PATH}) + find_library(X11_xcb_xinput_LIB xcb-xinput ${X11_LIB_SEARCH_PATH}) + find_library(X11_xcb_xkb_LIB xcb-xkb ${X11_LIB_SEARCH_PATH}) + find_library(X11_xcb_xrm_LIB xcb-xrm ${X11_LIB_SEARCH_PATH}) + find_library(X11_xcb_xtest_LIB xcb-xtest ${X11_LIB_SEARCH_PATH}) + find_library(X11_xcb_xvmc_LIB xcb-xvmc ${X11_LIB_SEARCH_PATH}) + find_library(X11_xcb_xv_LIB xcb-xv ${X11_LIB_SEARCH_PATH}) + find_library(X11_Xcomposite_LIB Xcomposite ${X11_LIB_SEARCH_PATH}) + find_library(X11_Xcursor_LIB Xcursor ${X11_LIB_SEARCH_PATH}) + find_library(X11_Xdamage_LIB Xdamage ${X11_LIB_SEARCH_PATH}) + find_library(X11_Xdmcp_LIB Xdmcp ${X11_LIB_SEARCH_PATH}) + find_library(X11_Xext_LIB Xext ${X11_LIB_SEARCH_PATH}) + find_library(X11_Xfixes_LIB Xfixes ${X11_LIB_SEARCH_PATH}) + find_library(X11_Xft_LIB Xft ${X11_LIB_SEARCH_PATH}) + find_library(X11_Xi_LIB Xi ${X11_LIB_SEARCH_PATH}) + find_library(X11_Xinerama_LIB Xinerama ${X11_LIB_SEARCH_PATH}) + find_library(X11_xkbcommon_LIB xkbcommon ${X11_LIB_SEARCH_PATH}) + find_library(X11_xkbcommon_X11_LIB xkbcommon-x11 ${X11_LIB_SEARCH_PATH}) + find_library(X11_xkbfile_LIB xkbfile ${X11_LIB_SEARCH_PATH}) + find_library(X11_Xmu_LIB Xmu ${X11_LIB_SEARCH_PATH}) + find_library(X11_Xpm_LIB Xpm ${X11_LIB_SEARCH_PATH}) + find_library(X11_Xrandr_LIB Xrandr ${X11_LIB_SEARCH_PATH}) + find_library(X11_Xrender_LIB Xrender ${X11_LIB_SEARCH_PATH}) + find_library(X11_XRes_LIB XRes ${X11_LIB_SEARCH_PATH}) + find_library(X11_Xss_LIB Xss ${X11_LIB_SEARCH_PATH}) + find_library(X11_Xt_LIB Xt ${X11_LIB_SEARCH_PATH}) + find_library(X11_Xtst_LIB Xtst ${X11_LIB_SEARCH_PATH}) + find_library(X11_Xv_LIB Xv ${X11_LIB_SEARCH_PATH}) + find_library(X11_Xxf86misc_LIB Xxf86misc ${X11_LIB_SEARCH_PATH}) + find_library(X11_Xxf86vm_LIB Xxf86vm ${X11_LIB_SEARCH_PATH}) # Backwards compatibility. set(X11_Xinput_LIB "${X11_Xi_LIB}") @@ -289,34 +373,134 @@ if (UNIX) set(X11_X11_xcb_FOUND TRUE) endif () + if (X11_xcb_composite_LIB AND X11_xcb_composite_INCLUDE_PATH) + set(X11_xcb_composite_FOUND TRUE) + endif () + + if (X11_xcb_cursor_LIB AND X11_xcb_cursor_INCLUDE_PATH) + set(X11_xcb_cursor_FOUND TRUE) + endif () + + if (X11_xcb_damage_LIB AND X11_xcb_damage_INCLUDE_PATH) + set(X11_xcb_damage_FOUND TRUE) + endif () + + if (X11_xcb_dpms_LIB AND X11_xcb_dpms_INCLUDE_PATH) + set(X11_xcb_dpms_FOUND TRUE) + endif () + + if (X11_xcb_dri2_LIB AND X11_xcb_dri2_INCLUDE_PATH) + set(X11_xcb_dri2_FOUND TRUE) + endif () + + if (X11_xcb_dri3_LIB AND X11_xcb_dri3_INCLUDE_PATH) + set(X11_xcb_dri3_FOUND TRUE) + endif () + + if (X11_xcb_errors_LIB AND X11_xcb_errors_INCLUDE_PATH) + set(X11_xcb_errors_FOUND TRUE) + endif () + + if (X11_xcb_ewmh_LIB AND X11_xcb_ewmh_INCLUDE_PATH) + set(X11_xcb_ewmh_FOUND TRUE) + endif () + + if (X11_xcb_glx_LIB AND X11_xcb_glx_INCLUDE_PATH) + set(X11_xcb_glx_FOUND TRUE) + endif () + if (X11_xcb_icccm_LIB AND X11_xcb_icccm_INCLUDE_PATH) set(X11_xcb_icccm_FOUND TRUE) endif () + if (X11_xcb_image_LIB AND X11_xcb_image_INCLUDE_PATH) + set(X11_xcb_image_FOUND TRUE) + endif () + + if (X11_xcb_keysyms_LIB AND X11_xcb_keysyms_INCLUDE_PATH) + set(X11_xcb_keysyms_FOUND TRUE) + endif () + + if (X11_xcb_present_LIB AND X11_xcb_present_INCLUDE_PATH) + set(X11_xcb_present_FOUND TRUE) + endif () + if (X11_xcb_randr_LIB AND X11_xcb_randr_INCLUDE_PATH) set(X11_xcb_randr_FOUND TRUE) endif () + if (X11_xcb_record_LIB AND X11_xcb_record_INCLUDE_PATH) + set(X11_xcb_record_FOUND TRUE) + endif () + + if (X11_xcb_render_LIB AND X11_xcb_render_INCLUDE_PATH) + set(X11_xcb_render_FOUND TRUE) + endif () + + if (X11_xcb_render_util_LIB AND X11_xcb_render_util_INCLUDE_PATH) + set(X11_xcb_render_util_FOUND TRUE) + endif () + + if (X11_xcb_res_LIB AND X11_xcb_res_INCLUDE_PATH) + set(X11_xcb_res_FOUND TRUE) + endif () + + if (X11_xcb_screensaver_LIB AND X11_xcb_screensaver_INCLUDE_PATH) + set(X11_xcb_screensaver_FOUND TRUE) + endif () + + if (X11_xcb_shape_LIB AND X11_xcb_shape_INCLUDE_PATH) + set(X11_xcb_shape_FOUND TRUE) + endif () + + if (X11_xcb_shm_LIB AND X11_xcb_shm_INCLUDE_PATH) + set(X11_xcb_shm_FOUND TRUE) + endif () + + if (X11_xcb_sync_LIB AND X11_xcb_sync_INCLUDE_PATH) + set(X11_xcb_sync_FOUND TRUE) + endif () + if (X11_xcb_util_LIB AND X11_xcb_util_INCLUDE_PATH) set(X11_xcb_util_FOUND TRUE) endif () - if (X11_xcb_xfixes_LIB) + if (X11_xcb_xf86dri_LIB AND X11_xcb_xf86dri_INCLUDE_PATH) + set(X11_xcb_xf86dri_FOUND TRUE) + endif () + + if (X11_xcb_xfixes_LIB AND X11_xcb_xfixes_INCLUDE_PATH) set(X11_xcb_xfixes_FOUND TRUE) endif () - if (X11_xcb_xtest_LIB) - set(X11_xcb_xtest_FOUND TRUE) + if (X11_xcb_xinerama_LIB AND X11_xcb_xinerama_INCLUDE_PATH) + set(X11_xcb_xinerama_FOUND TRUE) endif () - if (X11_xcb_keysyms_LIB) - set(X11_xcb_keysyms_FOUND TRUE) + if (X11_xcb_xinput_LIB AND X11_xcb_xinput_INCLUDE_PATH) + set(X11_xcb_xinput_FOUND TRUE) endif () - if (X11_xcb_xkb_LIB) + if (X11_xcb_xkb_LIB AND X11_xcb_xkb_INCLUDE_PATH) set(X11_xcb_xkb_FOUND TRUE) endif () + if (X11_xcb_xrm_LIB AND X11_xcb_xrm_INCLUDE_PATH) + set(X11_xcb_xrm_FOUND TRUE) + endif () + + if (X11_xcb_xtest_LIB AND X11_xcb_xtest_INCLUDE_PATH) + set(X11_xcb_xtest_FOUND TRUE) + endif () + + if (X11_xcb_xvmc_LIB AND X11_xcb_xvmc_INCLUDE_PATH) + set(X11_xcb_xvmc_FOUND TRUE) + endif () + + if (X11_xcb_xv_LIB AND X11_xcb_xv_INCLUDE_PATH) + set(X11_xcb_xv_FOUND TRUE) + endif () + if (X11_Xdmcp_INCLUDE_PATH AND X11_Xdmcp_LIB) set(X11_Xdmcp_FOUND TRUE) list(APPEND X11_INCLUDE_DIR ${X11_Xdmcp_INCLUDE_PATH}) @@ -617,6 +801,69 @@ if (UNIX) INTERFACE_LINK_LIBRARIES "X11::xcb;X11::X11") endif () + if (X11_xcb_composite_FOUND AND NOT TARGET X11::xcb_composite) + add_library(X11::xcb_composite UNKNOWN IMPORTED) + set_target_properties(X11::xcb_composite PROPERTIES + IMPORTED_LOCATION "${X11_xcb_composite_LIB}" + INTERFACE_LINK_LIBRARIES "X11::xcb") + endif () + + if (X11_xcb_cursor_FOUND AND NOT TARGET X11::xcb_cursor) + add_library(X11::xcb_cursor UNKNOWN IMPORTED) + set_target_properties(X11::xcb_cursor PROPERTIES + IMPORTED_LOCATION "${X11_xcb_cursor_LIB}" + INTERFACE_LINK_LIBRARIES "X11::xcb") + endif () + + if (X11_xcb_damage_FOUND AND NOT TARGET X11::xcb_damage) + add_library(X11::xcb_damage UNKNOWN IMPORTED) + set_target_properties(X11::xcb_damage PROPERTIES + IMPORTED_LOCATION "${X11_xcb_damage_LIB}" + INTERFACE_LINK_LIBRARIES "X11::xcb") + endif () + + if (X11_xcb_dpms_FOUND AND NOT TARGET X11::xcb_dpms) + add_library(X11::xcb_dpms UNKNOWN IMPORTED) + set_target_properties(X11::xcb_dpms PROPERTIES + IMPORTED_LOCATION "${X11_xcb_dpms_LIB}" + INTERFACE_LINK_LIBRARIES "X11::xcb") + endif () + + if (X11_xcb_dri2_FOUND AND NOT TARGET X11::xcb_dri2) + add_library(X11::xcb_dri2 UNKNOWN IMPORTED) + set_target_properties(X11::xcb_dri2 PROPERTIES + IMPORTED_LOCATION "${X11_xcb_dri2_LIB}" + INTERFACE_LINK_LIBRARIES "X11::xcb") + endif () + + if (X11_xcb_dri3_FOUND AND NOT TARGET X11::xcb_dri3) + add_library(X11::xcb_dri3 UNKNOWN IMPORTED) + set_target_properties(X11::xcb_dri3 PROPERTIES + IMPORTED_LOCATION "${X11_xcb_dri3_LIB}" + INTERFACE_LINK_LIBRARIES "X11::xcb") + endif () + + if (X11_xcb_errors_FOUND AND NOT TARGET X11::xcb_errors) + add_library(X11::xcb_errors UNKNOWN IMPORTED) + set_target_properties(X11::xcb_errors PROPERTIES + IMPORTED_LOCATION "${X11_xcb_errors_LIB}" + INTERFACE_LINK_LIBRARIES "X11::xcb") + endif () + + if (X11_xcb_ewmh_FOUND AND NOT TARGET X11::xcb_ewmh) + add_library(X11::xcb_ewmh UNKNOWN IMPORTED) + set_target_properties(X11::xcb_ewmh PROPERTIES + IMPORTED_LOCATION "${X11_xcb_ewmh_LIB}" + INTERFACE_LINK_LIBRARIES "X11::xcb") + endif () + + if (X11_xcb_glx_FOUND AND NOT TARGET X11::xcb_glx) + add_library(X11::xcb_glx UNKNOWN IMPORTED) + set_target_properties(X11::xcb_glx PROPERTIES + IMPORTED_LOCATION "${X11_xcb_glx_LIB}" + INTERFACE_LINK_LIBRARIES "X11::xcb") + endif () + if (X11_xcb_icccm_FOUND AND NOT TARGET X11::xcb_icccm) add_library(X11::xcb_icccm UNKNOWN IMPORTED) set_target_properties(X11::xcb_icccm PROPERTIES @@ -624,6 +871,27 @@ if (UNIX) INTERFACE_LINK_LIBRARIES "X11::xcb") endif () + if (X11_xcb_image_FOUND AND NOT TARGET X11::xcb_image) + add_library(X11::xcb_image UNKNOWN IMPORTED) + set_target_properties(X11::xcb_image PROPERTIES + IMPORTED_LOCATION "${X11_xcb_image_LIB}" + INTERFACE_LINK_LIBRARIES "X11::xcb") + endif () + + if (X11_xcb_keysyms_FOUND AND NOT TARGET X11::xcb_keysyms) + add_library(X11::xcb_keysyms UNKNOWN IMPORTED) + set_target_properties(X11::xcb_keysyms PROPERTIES + IMPORTED_LOCATION "${X11_xcb_keysyms_LIB}" + INTERFACE_LINK_LIBRARIES "X11::xcb") + endif () + + if (X11_xcb_present_FOUND AND NOT TARGET X11::xcb_present) + add_library(X11::xcb_present UNKNOWN IMPORTED) + set_target_properties(X11::xcb_present PROPERTIES + IMPORTED_LOCATION "${X11_xcb_present_LIB}" + INTERFACE_LINK_LIBRARIES "X11::xcb") + endif () + if (X11_xcb_randr_FOUND AND NOT TARGET X11::xcb_randr) add_library(X11::xcb_randr UNKNOWN IMPORTED) set_target_properties(X11::xcb_randr PROPERTIES @@ -631,6 +899,62 @@ if (UNIX) INTERFACE_LINK_LIBRARIES "X11::xcb") endif () + if (X11_xcb_record_FOUND AND NOT TARGET X11::xcb_record) + add_library(X11::xcb_record UNKNOWN IMPORTED) + set_target_properties(X11::xcb_record PROPERTIES + IMPORTED_LOCATION "${X11_xcb_record_LIB}" + INTERFACE_LINK_LIBRARIES "X11::xcb") + endif () + + if (X11_xcb_render_FOUND AND NOT TARGET X11::xcb_render) + add_library(X11::xcb_render UNKNOWN IMPORTED) + set_target_properties(X11::xcb_render PROPERTIES + IMPORTED_LOCATION "${X11_xcb_render_LIB}" + INTERFACE_LINK_LIBRARIES "X11::xcb") + endif () + + if (X11_xcb_render_util_FOUND AND NOT TARGET X11::xcb_render_util) + add_library(X11::xcb_render_util UNKNOWN IMPORTED) + set_target_properties(X11::xcb_render_util PROPERTIES + IMPORTED_LOCATION "${X11_xcb_render_util_LIB}" + INTERFACE_LINK_LIBRARIES "X11::xcb") + endif () + + if (X11_xcb_res_FOUND AND NOT TARGET X11::xcb_res) + add_library(X11::xcb_res UNKNOWN IMPORTED) + set_target_properties(X11::xcb_res PROPERTIES + IMPORTED_LOCATION "${X11_xcb_res_LIB}" + INTERFACE_LINK_LIBRARIES "X11::xcb") + endif () + + if (X11_xcb_screensaver_FOUND AND NOT TARGET X11::xcb_screensaver) + add_library(X11::xcb_screensaver UNKNOWN IMPORTED) + set_target_properties(X11::xcb_screensaver PROPERTIES + IMPORTED_LOCATION "${X11_xcb_screensaver_LIB}" + INTERFACE_LINK_LIBRARIES "X11::xcb") + endif () + + if (X11_xcb_shape_FOUND AND NOT TARGET X11::xcb_shape) + add_library(X11::xcb_shape UNKNOWN IMPORTED) + set_target_properties(X11::xcb_shape PROPERTIES + IMPORTED_LOCATION "${X11_xcb_shape_LIB}" + INTERFACE_LINK_LIBRARIES "X11::xcb") + endif () + + if (X11_xcb_shm_FOUND AND NOT TARGET X11::xcb_shm) + add_library(X11::xcb_shm UNKNOWN IMPORTED) + set_target_properties(X11::xcb_shm PROPERTIES + IMPORTED_LOCATION "${X11_xcb_shm_LIB}" + INTERFACE_LINK_LIBRARIES "X11::xcb") + endif () + + if (X11_xcb_sync_FOUND AND NOT TARGET X11::xcb_sync) + add_library(X11::xcb_sync UNKNOWN IMPORTED) + set_target_properties(X11::xcb_sync PROPERTIES + IMPORTED_LOCATION "${X11_xcb_sync_LIB}" + INTERFACE_LINK_LIBRARIES "X11::xcb") + endif () + if (X11_xcb_util_FOUND AND NOT TARGET X11::xcb_util) add_library(X11::xcb_util UNKNOWN IMPORTED) set_target_properties(X11::xcb_util PROPERTIES @@ -638,6 +962,13 @@ if (UNIX) INTERFACE_LINK_LIBRARIES "X11::xcb") endif () + if (X11_xcb_xf86dri_FOUND AND NOT TARGET X11::xcb_xf86dri) + add_library(X11::xcb_xf86dri UNKNOWN IMPORTED) + set_target_properties(X11::xcb_xf86dri PROPERTIES + IMPORTED_LOCATION "${X11_xcb_xf86dri_LIB}" + INTERFACE_LINK_LIBRARIES "X11::xcb") + endif () + if (X11_xcb_xfixes_FOUND AND NOT TARGET X11::xcb_xfixes) add_library(X11::xcb_xfixes UNKNOWN IMPORTED) set_target_properties(X11::xcb_xfixes PROPERTIES @@ -645,6 +976,34 @@ if (UNIX) INTERFACE_LINK_LIBRARIES "X11::xcb") endif () + if (X11_xcb_xinerama_FOUND AND NOT TARGET X11::xcb_xinerama) + add_library(X11::xcb_xinerama UNKNOWN IMPORTED) + set_target_properties(X11::xcb_xinerama PROPERTIES + IMPORTED_LOCATION "${X11_xcb_xinerama_LIB}" + INTERFACE_LINK_LIBRARIES "X11::xcb") + endif () + + if (X11_xcb_xinput_FOUND AND NOT TARGET X11::xcb_xinput) + add_library(X11::xcb_xinput UNKNOWN IMPORTED) + set_target_properties(X11::xcb_xinput PROPERTIES + IMPORTED_LOCATION "${X11_xcb_xinput_LIB}" + INTERFACE_LINK_LIBRARIES "X11::xcb") + endif () + + if (X11_xcb_xkb_FOUND AND NOT TARGET X11::xcb_xkb) + add_library(X11::xcb_xkb UNKNOWN IMPORTED) + set_target_properties(X11::xcb_xkb PROPERTIES + IMPORTED_LOCATION "${X11_xcb_xkb_LIB}" + INTERFACE_LINK_LIBRARIES "X11::xcb") + endif () + + if (X11_xcb_xrm_FOUND AND NOT TARGET X11::xcb_xrm) + add_library(X11::xcb_xrm UNKNOWN IMPORTED) + set_target_properties(X11::xcb_xrm PROPERTIES + IMPORTED_LOCATION "${X11_xcb_xrm_LIB}" + INTERFACE_LINK_LIBRARIES "X11::xcb") + endif () + if (X11_xcb_xtest_FOUND AND NOT TARGET X11::xcb_xtest) add_library(X11::xcb_xtest UNKNOWN IMPORTED) set_target_properties(X11::xcb_xtest PROPERTIES @@ -652,17 +1011,17 @@ if (UNIX) INTERFACE_LINK_LIBRARIES "X11::xcb") endif () - if (X11_xcb_keysyms_FOUND AND NOT TARGET X11::xcb_keysyms) - add_library(X11::xcb_keysyms UNKNOWN IMPORTED) - set_target_properties(X11::xcb_keysyms PROPERTIES - IMPORTED_LOCATION "${X11_xcb_keysyms_LIB}" + if (X11_xcb_xvmc_FOUND AND NOT TARGET X11::xcb_xvmc) + add_library(X11::xcb_xvmc UNKNOWN IMPORTED) + set_target_properties(X11::xcb_xvmc PROPERTIES + IMPORTED_LOCATION "${X11_xcb_xvmc_LIB}" INTERFACE_LINK_LIBRARIES "X11::xcb") endif () - if (X11_xcb_xkb_FOUND AND NOT TARGET X11::xcb_xkb) - add_library(X11::xcb_xkb UNKNOWN IMPORTED) - set_target_properties(X11::xcb_xkb PROPERTIES - IMPORTED_LOCATION "${X11_xcb_xkb_LIB}" + if (X11_xcb_xv_FOUND AND NOT TARGET X11::xcb_xv) + add_library(X11::xcb_xv UNKNOWN IMPORTED) + set_target_properties(X11::xcb_xv PROPERTIES + IMPORTED_LOCATION "${X11_xcb_xv_LIB}" INTERFACE_LINK_LIBRARIES "X11::xcb") endif () @@ -873,20 +1232,70 @@ if (UNIX) X11_Xau_INCLUDE_PATH X11_xcb_LIB X11_xcb_INCLUDE_PATH + X11_xcb_composite_LIB + X11_xcb_composite_INCLUDE_PATH + X11_xcb_cursor_LIB + X11_xcb_cursor_INCLUDE_PATH + X11_xcb_damage_LIB + X11_xcb_damage_INCLUDE_PATH + X11_xcb_dpms_LIB + X11_xcb_dpms_INCLUDE_PATH + X11_xcb_dri2_LIB + X11_xcb_dri2_INCLUDE_PATH + X11_xcb_dri3_LIB + X11_xcb_dri3_INCLUDE_PATH + X11_xcb_errors_LIB + X11_xcb_errors_INCLUDE_PATH + X11_xcb_ewmh_LIB + X11_xcb_ewmh_INCLUDE_PATH + X11_xcb_glx_LIB + X11_xcb_glx_INCLUDE_PATH X11_xcb_icccm_LIB X11_xcb_icccm_INCLUDE_PATH + X11_xcb_image_LIB + X11_xcb_image_INCLUDE_PATH + X11_xcb_keysyms_LIB + X11_xcb_keysyms_INCLUDE_PATH + X11_xcb_present_LIB + X11_xcb_present_INCLUDE_PATH X11_xcb_randr_LIB X11_xcb_randr_INCLUDE_PATH + X11_xcb_record_LIB + X11_xcb_record_INCLUDE_PATH + X11_xcb_render_LIB + X11_xcb_render_INCLUDE_PATH + X11_xcb_render_util_LIB + X11_xcb_render_util_INCLUDE_PATH + X11_xcb_res_LIB + X11_xcb_res_INCLUDE_PATH + X11_xcb_screensaver_LIB + X11_xcb_screensaver_INCLUDE_PATH + X11_xcb_shape_LIB + X11_xcb_shape_INCLUDE_PATH + X11_xcb_shm_LIB + X11_xcb_shm_INCLUDE_PATH + X11_xcb_sync_LIB + X11_xcb_sync_INCLUDE_PATH X11_xcb_util_LIB X11_xcb_util_INCLUDE_PATH + X11_xcb_xf86dri_LIB + X11_xcb_xf86dri_INCLUDE_PATH X11_xcb_xfixes_LIB X11_xcb_xfixes_INCLUDE_PATH - X11_xcb_xtest_LIB - X11_xcb_xtest_INCLUDE_PATH - X11_xcb_keysyms_LIB - X11_xcb_keysyms_INCLUDE_PATH + X11_xcb_xinerama_LIB + X11_xcb_xinerama_INCLUDE_PATH + X11_xcb_xinput_LIB + X11_xcb_xinput_INCLUDE_PATH X11_xcb_xkb_LIB X11_X11_xcb_LIB + X11_xcb_xrm_LIB + X11_xcb_xrm_INCLUDE_PATH + X11_xcb_xtest_LIB + X11_xcb_xtest_INCLUDE_PATH + X11_xcb_xvmc_LIB + X11_xcb_xvmc_INCLUDE_PATH + X11_xcb_xv_LIB + X11_xcb_xv_INCLUDE_PATH X11_X11_xcb_INCLUDE_PATH X11_Xlib_INCLUDE_PATH X11_Xutil_INCLUDE_PATH diff --git a/Modules/FindXCTest.cmake b/Modules/FindXCTest.cmake index 7118df2..40e767b 100644 --- a/Modules/FindXCTest.cmake +++ b/Modules/FindXCTest.cmake @@ -13,7 +13,7 @@ An XCTest bundle is a CFBundle with a special product-type and bundle extension. The Mac Developer Library provides more information in the `Testing with Xcode`_ document. -.. _Testing with Xcode: https://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/testing_with_xcode/ +.. _Testing with Xcode: https://developer.apple.com/library/archive/documentation/DeveloperTools/Conceptual/testing_with_xcode/ Module Functions ^^^^^^^^^^^^^^^^ diff --git a/Modules/FindwxWidgets.cmake b/Modules/FindwxWidgets.cmake index 3159ff7..cc76b35 100644 --- a/Modules/FindwxWidgets.cmake +++ b/Modules/FindwxWidgets.cmake @@ -113,6 +113,16 @@ If wxWidgets is required (i.e., not an optional part): include(${wxWidgets_USE_FILE}) # and for each of your dependent executable/library targets: target_link_libraries(<YourTarget> ${wxWidgets_LIBRARIES}) + +Imported targets +^^^^^^^^^^^^^^^^ + +.. versionadded:: 3.27 + +This module defines the following :prop_tgt:`IMPORTED` targets: + +``wxWidgets::wxWidgets`` + An interface library providing usage requirements for the found components. #]=======================================================================] # @@ -981,6 +991,17 @@ find_package_handle_standard_args(wxWidgets ) unset(wxWidgets_HANDLE_COMPONENTS) +if(wxWidgets_FOUND AND NOT TARGET wxWidgets::wxWidgets) + add_library(wxWidgets::wxWidgets INTERFACE IMPORTED) + target_link_libraries(wxWidgets::wxWidgets INTERFACE ${wxWidgets_LIBRARIES}) + target_link_directories(wxWidgets::wxWidgets INTERFACE ${wxWidgets_LIBRARY_DIRS}) + target_include_directories(wxWidgets::wxWidgets INTERFACE ${wxWidgets_INCLUDE_DIRS}) + target_compile_options(wxWidgets::wxWidgets INTERFACE ${wxWidgets_CXX_FLAGS}) + target_compile_definitions(wxWidgets::wxWidgets INTERFACE ${wxWidgets_DEFINITIONS}) + # FIXME: Add "$<$<CONFIG:Debug>:${wxWidgets_DEFINITIONS_DEBUG}>" + # if the debug library variant is available. +endif() + #===================================================================== # Macros for use in wxWidgets apps. # - This module will not fail to find wxWidgets based on the code diff --git a/Modules/FindwxWindows.cmake b/Modules/FindwxWindows.cmake index 15dacbb..6e4be91 100644 --- a/Modules/FindwxWindows.cmake +++ b/Modules/FindwxWindows.cmake @@ -613,7 +613,7 @@ else() option(WXWINDOWS_USE_SHARED_LIBS "Use shared versions (.so) of wxWindows libraries" ON) mark_as_advanced(WXWINDOWS_USE_SHARED_LIBS) - # JW removed option and force the develper th SET it. + # JW removed option and force the developer to SET it. # option(WXWINDOWS_USE_GL "use wxWindows with GL support (use additional # --gl-libs for wx-config)?" OFF) diff --git a/Modules/FortranCInterface.cmake b/Modules/FortranCInterface.cmake index ed8830e..2c85029 100644 --- a/Modules/FortranCInterface.cmake +++ b/Modules/FortranCInterface.cmake @@ -373,6 +373,7 @@ function(FortranCInterface_VERIFY) "-DCMAKE_C_FLAGS_RELEASE:STRING=${CMAKE_C_FLAGS_RELEASE}" "-DCMAKE_CXX_FLAGS_RELEASE:STRING=${CMAKE_CXX_FLAGS_RELEASE}" "-DCMAKE_Fortran_FLAGS_RELEASE:STRING=${CMAKE_Fortran_FLAGS_RELEASE}" + "-DFortranCInterface_BINARY_DIR=${FortranCInterface_BINARY_DIR}" ${_FortranCInterface_OSX_ARCH} ${_FortranCInterface_EXE_LINKER_FLAGS} OUTPUT_VARIABLE _output) diff --git a/Modules/FortranCInterface/CMakeLists.txt b/Modules/FortranCInterface/CMakeLists.txt index 4bd7006..a0f1862 100644 --- a/Modules/FortranCInterface/CMakeLists.txt +++ b/Modules/FortranCInterface/CMakeLists.txt @@ -6,11 +6,11 @@ project(FortranCInterface C Fortran) include(${FortranCInterface_BINARY_DIR}/Input.cmake OPTIONAL) # Check if the C compiler supports '$' in identifiers. -include(CheckCSourceCompiles) -check_c_source_compiles(" -extern int dollar$(void); -int main() { return 0; } -" C_SUPPORTS_DOLLAR) +include(CheckSourceCompiles) +check_source_compiles(C +"extern int dollar$(void); +int main() { return 0; }" +C_SUPPORTS_DOLLAR) # List manglings of global symbol names to try. set(global_symbols diff --git a/Modules/GenerateExportHeader.cmake b/Modules/GenerateExportHeader.cmake index 7461a3e..9fdc783 100644 --- a/Modules/GenerateExportHeader.cmake +++ b/Modules/GenerateExportHeader.cmake @@ -198,19 +198,19 @@ that will be populated with the ``CXX_FLAGS`` required to enable visibility support for the compiler/architecture in use. #]=======================================================================] -include(CheckCCompilerFlag) -include(CheckCXXCompilerFlag) +include(CheckCompilerFlag) +include(CheckSourceCompiles) # TODO: Install this macro separately? macro(_check_cxx_compiler_attribute _ATTRIBUTE _RESULT) - check_cxx_source_compiles("${_ATTRIBUTE} int somefunc() { return 0; } + check_source_compiles(CXX "${_ATTRIBUTE} int somefunc() { return 0; } int main() { return somefunc();}" ${_RESULT} ) endmacro() # TODO: Install this macro separately? macro(_check_c_compiler_attribute _ATTRIBUTE _RESULT) - check_c_source_compiles("${_ATTRIBUTE} int somefunc() { return 0; } + check_source_compiles(C "${_ATTRIBUTE} int somefunc() { return 0; } int main() { return somefunc();}" ${_RESULT} ) endmacro() @@ -226,7 +226,7 @@ macro(_test_compiler_hidden_visibility) endif() # Exclude XL here because it misinterprets -fvisibility=hidden even though - # the check_cxx_compiler_flag passes + # the check_compiler_flag passes if(NOT GCC_TOO_OLD AND NOT _INTEL_TOO_OLD AND NOT WIN32 @@ -235,12 +235,12 @@ macro(_test_compiler_hidden_visibility) AND NOT CMAKE_CXX_COMPILER_ID MATCHES "^(PGI|NVHPC)$" AND NOT CMAKE_CXX_COMPILER_ID MATCHES Watcom) if (CMAKE_CXX_COMPILER_LOADED) - check_cxx_compiler_flag(-fvisibility=hidden COMPILER_HAS_HIDDEN_VISIBILITY) - check_cxx_compiler_flag(-fvisibility-inlines-hidden + check_compiler_flag(CXX -fvisibility=hidden COMPILER_HAS_HIDDEN_VISIBILITY) + check_compiler_flag(CXX -fvisibility-inlines-hidden COMPILER_HAS_HIDDEN_INLINE_VISIBILITY) else() - check_c_compiler_flag(-fvisibility=hidden COMPILER_HAS_HIDDEN_VISIBILITY) - check_c_compiler_flag(-fvisibility-inlines-hidden + check_compiler_flag(C -fvisibility=hidden COMPILER_HAS_HIDDEN_VISIBILITY) + check_compiler_flag(C -fvisibility-inlines-hidden COMPILER_HAS_HIDDEN_INLINE_VISIBILITY) endif() endif() @@ -293,7 +293,7 @@ macro(_DO_SET_MACRO_VALUES TARGET_LIBRARY) set(DEFINE_IMPORT) set(DEFINE_NO_EXPORT) - if (COMPILER_HAS_DEPRECATED_ATTR) + if (COMPILER_HAS_DEPRECATED_ATTR AND NOT WIN32) set(DEFINE_DEPRECATED "__attribute__ ((__deprecated__))") elseif(COMPILER_HAS_DEPRECATED) set(DEFINE_DEPRECATED "__declspec(deprecated)") @@ -453,3 +453,8 @@ function(add_compiler_export_flags) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" PARENT_SCOPE) endif() endfunction() + +# FIXME(#24994): The following module(s) are included only for compatibility +# with projects that accidentally relied on them with CMake 3.26 and below. +include(CheckCCompilerFlag) +include(CheckCXXCompilerFlag) diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake index 0ba35b6..0cd49ab 100644 --- a/Modules/GetPrerequisites.cmake +++ b/Modules/GetPrerequisites.cmake @@ -730,7 +730,7 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa if(gp_tool MATCHES "ldd$") set(gp_cmd_args "") - set(gp_regex "^[\t ]*[^\t ]+ =>[\t ]+([^\t\(]+)( \(.+\))?${eol_char}$") + set(gp_regex "^[\t ]*[^\t ]+ =>[\t ]+(/[^\t\(]+)( \(.+\))?${eol_char}$") set(gp_regex_error "not found${eol_char}$") set(gp_regex_fallback "^[\t ]*([^\t ]+) => ([^\t ]+).*${eol_char}$") set(gp_regex_cmp_count 1) diff --git a/Modules/Internal/CPack/CPackRPM.cmake b/Modules/Internal/CPack/CPackRPM.cmake index 8ac1f6b..36c0a3f 100644 --- a/Modules/Internal/CPack/CPackRPM.cmake +++ b/Modules/Internal/CPack/CPackRPM.cmake @@ -1150,7 +1150,7 @@ function(cpack_rpm_generate_package) endforeach() # CPACK_RPM_SPEC_INSTALL_POST - # May be used to define a RPM post intallation script + # May be used to define a RPM post installation script # for example setting it to "/bin/true" may prevent # rpmbuild from stripping binaries. if(CPACK_RPM_SPEC_INSTALL_POST) diff --git a/Modules/Internal/CPack/ISComponents.pas b/Modules/Internal/CPack/ISComponents.pas new file mode 100644 index 0000000..8b5c8b4 --- /dev/null +++ b/Modules/Internal/CPack/ISComponents.pas @@ -0,0 +1,88 @@ +{ Distributed under the OSI-approved BSD 3-Clause License. See accompanying +file Copyright.txt or https://cmake.org/licensing for details. } + +function CPackGetCustomInstallationMessage(Param: String): String; +begin + Result := SetupMessage(msgCustomInstallation); +end; + +{ Downloaded components } +#ifdef CPackDownloadCount +const + NO_PROGRESS_BOX = 4; + RESPOND_YES_TO_ALL = 16; +var + CPackDownloadPage: TDownloadWizardPage; + CPackShell: Variant; + +<event('InitializeWizard')> +procedure CPackInitializeWizard(); +begin + CPackDownloadPage := CreateDownloadPage(SetupMessage(msgWizardPreparing), SetupMessage(msgPreparingDesc), nil); + CPackShell := CreateOleObject('Shell.Application'); +end; + +<event('NextButtonClick')> +function CPackNextButtonClick(CurPageID: Integer): Boolean; +begin + if CurPageID = wpReady then + begin + CPackDownloadPage.Clear; + CPackDownloadPage.Show; + +#sub AddDownload + if WizardIsComponentSelected('{#CPackDownloadComponents[i]}') then + #emit "CPackDownloadPage.Add('" + CPackDownloadUrls[i] + "', '" + CPackDownloadArchives[i] + ".zip', '" + CPackDownloadHashes[i] + "');" +#endsub +#define i +#for {i = 0; i < CPackDownloadCount; i++} AddDownload +#undef i + + try + try + CPackDownloadPage.Download; + Result := True; + except + if not CPackDownloadPage.AbortedByUser then + SuppressibleMsgBox(AddPeriod(GetExceptionMessage), mbCriticalError, MB_OK, IDOK); + + Result := False; + end; + finally + CPackDownloadPage.Hide; + end; + end else + Result := True; +end; + +procedure CPackExtractFile(ArchiveName, FileName: String); +var + ZipFileName: String; + ZipFile: Variant; + Item: Variant; + TargetFolderName: String; + TargetFolder: Variant; +begin + TargetFolderName := RemoveBackslashUnlessRoot(ExpandConstant('{tmp}\' + ArchiveName + '\' + ExtractFileDir(FileName))); + ZipFileName := ExpandConstant('{tmp}\' + ArchiveName + '.zip'); + + if not DirExists(TargetFolderName) then + if not ForceDirectories(TargetFolderName) then + RaiseException(Format('Target path "%s" cannot be created', [TargetFolderName])); + + ZipFile := CPackShell.NameSpace(ZipFileName); + if VarIsClear(ZipFile) then + RaiseException(Format('Cannot open ZIP file "%s" or does not exist', [ZipFileName])); + + Item := ZipFile.ParseName(FileName); + if VarIsClear(Item) then + RaiseException(Format('Cannot find "%s" in "%s" ZIP file', [FileName, ZipFileName])); + + TargetFolder := CPackShell.NameSpace(TargetFolderName); + if VarIsClear(TargetFolder) then + RaiseException(Format('Target path "%s" does not exist', [TargetFolderName])); + + TargetFolder.CopyHere(Item, NO_PROGRESS_BOX or RESPOND_YES_TO_ALL); +end; + +#endif diff --git a/Modules/Internal/CPack/ISScript.template.in b/Modules/Internal/CPack/ISScript.template.in new file mode 100644 index 0000000..1171058 --- /dev/null +++ b/Modules/Internal/CPack/ISScript.template.in @@ -0,0 +1,34 @@ +; Script generated by the CPack Inno Setup generator. +; All changes made in this file will be lost when CPack is run again. + +@CPACK_INNOSETUP_INCLUDES_INTERNAL@ + +[Setup] +@CPACK_INNOSETUP_SETUP_INTERNAL@ + +[Languages] +@CPACK_INNOSETUP_LANGUAGES_INTERNAL@ + +[Dirs] +@CPACK_INNOSETUP_DIRS_INTERNAL@ + +[Files] +@CPACK_INNOSETUP_FILES_INTERNAL@ + +[Types] +@CPACK_INNOSETUP_TYPES_INTERNAL@ + +[Components] +@CPACK_INNOSETUP_COMPONENTS_INTERNAL@ + +[Tasks] +@CPACK_INNOSETUP_TASKS_INTERNAL@ + +[Icons] +@CPACK_INNOSETUP_ICONS_INTERNAL@ + +[Run] +@CPACK_INNOSETUP_RUN_INTERNAL@ + +[Code] +@CPACK_INNOSETUP_CODE_INTERNAL@ diff --git a/Modules/Internal/CheckFlagCommonConfig.cmake b/Modules/Internal/CheckFlagCommonConfig.cmake index f8481cd..8c5703d 100644 --- a/Modules/Internal/CheckFlagCommonConfig.cmake +++ b/Modules/Internal/CheckFlagCommonConfig.cmake @@ -7,7 +7,8 @@ # It's content may change in any way between releases. include_guard(GLOBAL) -cmake_policy(PUSH) + +block(SCOPE_FOR POLICIES) cmake_policy(SET CMP0054 NEW) # if() quoted variables not dereferenced cmake_policy(SET CMP0057 NEW) # if() supports IN_LIST @@ -74,4 +75,4 @@ macro(CMAKE_CHECK_FLAG_COMMON_FINISH) endforeach() endmacro() -cmake_policy(POP) +endblock() diff --git a/Modules/Internal/CheckLinkerFlag.cmake b/Modules/Internal/CheckLinkerFlag.cmake index 7613105..b872b51 100644 --- a/Modules/Internal/CheckLinkerFlag.cmake +++ b/Modules/Internal/CheckLinkerFlag.cmake @@ -6,7 +6,7 @@ include(Internal/CheckFlagCommonConfig) include(Internal/CheckSourceCompiles) include(CMakeCheckCompilerFlagCommonPatterns) -cmake_policy(PUSH) +block(SCOPE_FOR POLICIES) cmake_policy(SET CMP0054 NEW) # if() quoted variables not dereferenced function(CMAKE_CHECK_LINKER_FLAG _lang _flag _var) @@ -49,4 +49,4 @@ function(CMAKE_CHECK_LINKER_FLAG _lang _flag _var) cmake_check_flag_common_finish() endfunction() -cmake_policy(POP) +endblock() diff --git a/Modules/Internal/CheckSourceCompiles.cmake b/Modules/Internal/CheckSourceCompiles.cmake index 83d7020..14a9a61 100644 --- a/Modules/Internal/CheckSourceCompiles.cmake +++ b/Modules/Internal/CheckSourceCompiles.cmake @@ -3,7 +3,7 @@ include_guard(GLOBAL) -cmake_policy(PUSH) +block(SCOPE_FOR POLICIES) cmake_policy(SET CMP0054 NEW) # if() quoted variables not dereferenced cmake_policy(SET CMP0057 NEW) # if() supports IN_LIST @@ -131,4 +131,4 @@ function(CMAKE_CHECK_SOURCE_COMPILES _lang _source _var) endif() endfunction() -cmake_policy(POP) +endblock() diff --git a/Modules/Internal/CheckSourceRuns.cmake b/Modules/Internal/CheckSourceRuns.cmake index 805d98d..c01081e 100644 --- a/Modules/Internal/CheckSourceRuns.cmake +++ b/Modules/Internal/CheckSourceRuns.cmake @@ -3,7 +3,7 @@ include_guard(GLOBAL) -cmake_policy(PUSH) +block(SCOPE_FOR POLICIES) cmake_policy(SET CMP0054 NEW) # if() quoted variables not dereferenced cmake_policy(SET CMP0057 NEW) # if() supports IN_LIST @@ -124,4 +124,4 @@ function(CMAKE_CHECK_SOURCE_RUNS _lang _source _var) endif() endfunction() -cmake_policy(POP) +endblock() diff --git a/Modules/Internal/HeaderpadWorkaround.cmake b/Modules/Internal/HeaderpadWorkaround.cmake index 9a7f9f5..fccfaae 100644 --- a/Modules/Internal/HeaderpadWorkaround.cmake +++ b/Modules/Internal/HeaderpadWorkaround.cmake @@ -9,7 +9,7 @@ if(NOT APPLE) return() endif() -cmake_policy(PUSH) +block(SCOPE_FOR POLICIES) cmake_policy(SET CMP0054 NEW) # if() quoted variables not dereferenced function(__cmake_internal_workaround_headerpad_flag_conflict _LANG) @@ -66,4 +66,4 @@ endforeach() unset(__lang) unset(__enabled_languages) -cmake_policy(POP) +endblock() diff --git a/Modules/MatlabTestsRedirect.cmake b/Modules/MatlabTestsRedirect.cmake index d651cdd..8973231 100644 --- a/Modules/MatlabTestsRedirect.cmake +++ b/Modules/MatlabTestsRedirect.cmake @@ -19,8 +19,8 @@ # -P FindMatlab_TestsRedirect.cmake set(Matlab_UNIT_TESTS_CMD -nosplash -nodesktop -nodisplay ${Matlab_ADDITIONAL_STARTUP_OPTIONS}) -if(WIN32) - set(Matlab_UNIT_TESTS_CMD ${Matlab_UNIT_TESTS_CMD} -wait) +if(WIN32 AND maut_BATCH_OPTION STREQUAL "-r") + list(APPEND Matlab_UNIT_TESTS_CMD -wait) endif() if(NOT test_timeout) diff --git a/Modules/Platform/AIX-Initialize.cmake b/Modules/Platform/AIX-Initialize.cmake new file mode 100644 index 0000000..0b117a7 --- /dev/null +++ b/Modules/Platform/AIX-Initialize.cmake @@ -0,0 +1 @@ +set(UNIX 1) diff --git a/Modules/Platform/Android-Determine.cmake b/Modules/Platform/Android-Determine.cmake index 715f68b..307e4c9 100644 --- a/Modules/Platform/Android-Determine.cmake +++ b/Modules/Platform/Android-Determine.cmake @@ -34,18 +34,26 @@ cmake_policy(PUSH) cmake_policy(SET CMP0057 NEW) # if IN_LIST # If using Android tools for Visual Studio, compile a sample project to get the -# sysroot. +# NDK path and set the processor from the generator platform. if(CMAKE_GENERATOR MATCHES "Visual Studio") - if(NOT CMAKE_SYSROOT) - set(vcx_platform ${CMAKE_GENERATOR_PLATFORM}) - if(CMAKE_GENERATOR MATCHES "Visual Studio 1[45]") - set(vcx_sysroot_var "Sysroot") + if(NOT CMAKE_ANDROID_ARCH_ABI AND NOT CMAKE_SYSTEM_PROCESSOR) + if(CMAKE_GENERATOR_PLATFORM STREQUAL "ARM") + set(CMAKE_SYSTEM_PROCESSOR "armv7-a") + elseif(CMAKE_GENERATOR_PLATFORM STREQUAL "ARM64") + set(CMAKE_SYSTEM_PROCESSOR "aarch64") + elseif(CMAKE_GENERATOR_PLATFORM STREQUAL "x86") + set(CMAKE_SYSTEM_PROCESSOR "i686") + elseif(CMAKE_GENERATOR_PLATFORM STREQUAL "x64") + set(CMAKE_SYSTEM_PROCESSOR "x86_64") else() - set(vcx_sysroot_var "SysrootLink") + message(FATAL_ERROR "Unhandled generator platform, please choose ARM, ARM64, x86 or x86_64 using -A") endif() + endif() + if(NOT CMAKE_ANDROID_NDK) + set(vcx_platform ${CMAKE_GENERATOR_PLATFORM}) if(CMAKE_GENERATOR MATCHES "Visual Studio 14") set(vcx_revision "2.0") - elseif(CMAKE_GENERATOR MATCHES "Visual Studio 1[56]") + elseif(CMAKE_GENERATOR MATCHES "Visual Studio 1[567]") set(vcx_revision "3.0") else() set(vcx_revision "") @@ -62,16 +70,16 @@ if(CMAKE_GENERATOR MATCHES "Visual Studio") RESULT_VARIABLE VCXPROJ_INSPECT_RESULT ) unset(_msbuild) - if(NOT CMAKE_SYSROOT AND VCXPROJ_INSPECT_OUTPUT MATCHES "CMAKE_SYSROOT=([^%\r\n]+)[\r\n]") + if(VCXPROJ_INSPECT_OUTPUT MATCHES "CMAKE_ANDROID_NDK=([^%\r\n]+)[\r\n]") # Strip VS diagnostic output from the end of the line. - string(REGEX REPLACE " \\(TaskId:[0-9]*\\)$" "" _sysroot "${CMAKE_MATCH_1}") - if(EXISTS "${_sysroot}") - file(TO_CMAKE_PATH "${_sysroot}" CMAKE_SYSROOT) + string(REGEX REPLACE " \\(TaskId:[0-9]*\\)$" "" _ndk "${CMAKE_MATCH_1}") + if(EXISTS "${_ndk}") + file(TO_CMAKE_PATH "${_ndk}" CMAKE_ANDROID_NDK) endif() endif() if(VCXPROJ_INSPECT_RESULT) message(CONFIGURE_LOG - "Determining the sysroot for the Android NDK failed. + "Determining the Android NDK failed from msbuild failed. The output was: ${VCXPROJ_INSPECT_RESULT} ${VCXPROJ_INSPECT_OUTPUT} @@ -79,7 +87,7 @@ ${VCXPROJ_INSPECT_OUTPUT} ") else() message(CONFIGURE_LOG - "Determining the sysroot for the Android NDK succeeded. + "Determining the Android NDK succeeded. The output was: ${VCXPROJ_INSPECT_RESULT} ${VCXPROJ_INSPECT_OUTPUT} diff --git a/Modules/Platform/Android-Initialize.cmake b/Modules/Platform/Android-Initialize.cmake index 63bc949..e2b2bd5 100644 --- a/Modules/Platform/Android-Initialize.cmake +++ b/Modules/Platform/Android-Initialize.cmake @@ -10,6 +10,11 @@ if(CMAKE_ANDROID_NDK) include(${CMAKE_ANDROID_NDK}/build/cmake/hooks/pre/Android-Initialize.cmake OPTIONAL) endif() +include(Platform/Linux-Initialize) +unset(LINUX) + +set(ANDROID 1) + # Support for NVIDIA Nsight Tegra Visual Studio Edition was previously # implemented in the CMake VS IDE generators. Avoid interfering with # that functionality for now. diff --git a/Modules/Platform/Android.cmake b/Modules/Platform/Android.cmake index 0530988..a240aff 100644 --- a/Modules/Platform/Android.cmake +++ b/Modules/Platform/Android.cmake @@ -5,9 +5,6 @@ if(CMAKE_ANDROID_NDK) endif() include(Platform/Linux) -unset(LINUX) - -set(ANDROID 1) # Natively compiling on an Android host doesn't need these flags to be reset. if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Android") diff --git a/Modules/Platform/Android/VCXProjInspect.vcxproj.in b/Modules/Platform/Android/VCXProjInspect.vcxproj.in index 6919d2c..f87d59b 100644 --- a/Modules/Platform/Android/VCXProjInspect.vcxproj.in +++ b/Modules/Platform/Android/VCXProjInspect.vcxproj.in @@ -19,6 +19,7 @@ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|@vcx_platform@'" Label="Configuration"> <ConfigurationType>DynamicLibrary</ConfigurationType> <CharacterSet>MultiByte</CharacterSet> + <AndroidAPILevel>android-21</AndroidAPILevel> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <ImportGroup Label="ExtensionSettings"> @@ -29,7 +30,7 @@ </PropertyGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|@vcx_platform@'"> <PostBuildEvent> - <Command>%40echo CMAKE_SYSROOT=$(@vcx_sysroot_var@)</Command> + <Command>%40echo CMAKE_ANDROID_NDK=$(VS_NdkRoot)</Command> </PostBuildEvent> </ItemDefinitionGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> diff --git a/Modules/Platform/Apple-AppleClang-ASM.cmake b/Modules/Platform/Apple-AppleClang-ASM.cmake new file mode 100644 index 0000000..c8ff470 --- /dev/null +++ b/Modules/Platform/Apple-AppleClang-ASM.cmake @@ -0,0 +1 @@ +include(Platform/Apple-Clang-ASM) diff --git a/Modules/Platform/Apple-Clang.cmake b/Modules/Platform/Apple-Clang.cmake index 0681bfb..4d7546a 100644 --- a/Modules/Platform/Apple-Clang.cmake +++ b/Modules/Platform/Apple-Clang.cmake @@ -22,6 +22,10 @@ macro(__apple_compiler_clang lang) set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "-mtvos-version-min=") elseif(_CMAKE_OSX_SYSROOT_PATH MATCHES "/AppleTVSimulator") set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "-mtvos-simulator-version-min=") + elseif(_CMAKE_OSX_SYSROOT_PATH MATCHES "/XROS") + set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "-mtargetos=xros") + elseif(_CMAKE_OSX_SYSROOT_PATH MATCHES "/XRSimulator") + set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "-mtargetos=xros") elseif(_CMAKE_OSX_SYSROOT_PATH MATCHES "/WatchOS") set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "-mwatchos-version-min=") elseif(_CMAKE_OSX_SYSROOT_PATH MATCHES "/WatchSimulator") diff --git a/Modules/Platform/BSDOS-Initialize.cmake b/Modules/Platform/BSDOS-Initialize.cmake new file mode 100644 index 0000000..0b117a7 --- /dev/null +++ b/Modules/Platform/BSDOS-Initialize.cmake @@ -0,0 +1 @@ +set(UNIX 1) diff --git a/Modules/Platform/BeOS-Initialize.cmake b/Modules/Platform/BeOS-Initialize.cmake new file mode 100644 index 0000000..ccdac64 --- /dev/null +++ b/Modules/Platform/BeOS-Initialize.cmake @@ -0,0 +1,2 @@ +set(BEOS 1) +set(UNIX 1) diff --git a/Modules/Platform/BeOS.cmake b/Modules/Platform/BeOS.cmake index ef811bd..e8573b9 100644 --- a/Modules/Platform/BeOS.cmake +++ b/Modules/Platform/BeOS.cmake @@ -1,5 +1,3 @@ -set(BEOS 1) - set(CMAKE_DL_LIBS root be) set(CMAKE_C_COMPILE_OPTIONS_PIC "-fPIC") set(CMAKE_C_COMPILE_OPTIONS_PIE "-fPIE") diff --git a/Modules/Platform/BlueGeneL-Initialize.cmake b/Modules/Platform/BlueGeneL-Initialize.cmake new file mode 100644 index 0000000..0b117a7 --- /dev/null +++ b/Modules/Platform/BlueGeneL-Initialize.cmake @@ -0,0 +1 @@ +set(UNIX 1) diff --git a/Modules/Platform/BlueGeneP-base.cmake b/Modules/Platform/BlueGeneP-base.cmake index 7095dd8..3c06215 100644 --- a/Modules/Platform/BlueGeneP-base.cmake +++ b/Modules/Platform/BlueGeneP-base.cmake @@ -50,11 +50,6 @@ set(CMAKE_SYSTEM_IGNORE_PATH ) # -# Indicate that this is a unix-like system -# -set(UNIX 1) - -# # Library prefixes, suffixes, extra libs. # set(CMAKE_LINK_LIBRARY_SUFFIX "") diff --git a/Modules/Platform/BlueGeneP-dynamic-Initialize.cmake b/Modules/Platform/BlueGeneP-dynamic-Initialize.cmake new file mode 100644 index 0000000..0b117a7 --- /dev/null +++ b/Modules/Platform/BlueGeneP-dynamic-Initialize.cmake @@ -0,0 +1 @@ +set(UNIX 1) diff --git a/Modules/Platform/BlueGeneP-static-Initialize.cmake b/Modules/Platform/BlueGeneP-static-Initialize.cmake new file mode 100644 index 0000000..0b117a7 --- /dev/null +++ b/Modules/Platform/BlueGeneP-static-Initialize.cmake @@ -0,0 +1 @@ +set(UNIX 1) diff --git a/Modules/Platform/BlueGeneQ-base.cmake b/Modules/Platform/BlueGeneQ-base.cmake index 94cb0a8..ea4b789 100644 --- a/Modules/Platform/BlueGeneQ-base.cmake +++ b/Modules/Platform/BlueGeneQ-base.cmake @@ -40,11 +40,6 @@ set(CMAKE_SYSTEM_IGNORE_PATH ) # -# Indicate that this is a unix-like system -# -set(UNIX 1) - -# # Library prefixes, suffixes, extra libs. # set(CMAKE_LINK_LIBRARY_SUFFIX "") diff --git a/Modules/Platform/BlueGeneQ-dynamic-Initialize.cmake b/Modules/Platform/BlueGeneQ-dynamic-Initialize.cmake new file mode 100644 index 0000000..0b117a7 --- /dev/null +++ b/Modules/Platform/BlueGeneQ-dynamic-Initialize.cmake @@ -0,0 +1 @@ +set(UNIX 1) diff --git a/Modules/Platform/BlueGeneQ-static-Initialize.cmake b/Modules/Platform/BlueGeneQ-static-Initialize.cmake new file mode 100644 index 0000000..0b117a7 --- /dev/null +++ b/Modules/Platform/BlueGeneQ-static-Initialize.cmake @@ -0,0 +1 @@ +set(UNIX 1) diff --git a/Modules/Platform/CYGWIN-Initialize.cmake b/Modules/Platform/CYGWIN-Initialize.cmake new file mode 100644 index 0000000..c90c51e --- /dev/null +++ b/Modules/Platform/CYGWIN-Initialize.cmake @@ -0,0 +1,2 @@ +set(CYGWIN 1) +set(UNIX 1) diff --git a/Modules/Platform/CYGWIN.cmake b/Modules/Platform/CYGWIN.cmake index 0b64496..cf5e732 100644 --- a/Modules/Platform/CYGWIN.cmake +++ b/Modules/Platform/CYGWIN.cmake @@ -1,5 +1,3 @@ -set(CYGWIN 1) - set(CMAKE_SHARED_LIBRARY_PREFIX "cyg") set(CMAKE_SHARED_LIBRARY_SUFFIX ".dll") set(CMAKE_SHARED_MODULE_PREFIX "cyg") diff --git a/Modules/Platform/Catamount-Initialize.cmake b/Modules/Platform/Catamount-Initialize.cmake new file mode 100644 index 0000000..0b117a7 --- /dev/null +++ b/Modules/Platform/Catamount-Initialize.cmake @@ -0,0 +1 @@ +set(UNIX 1) diff --git a/Modules/Platform/CrayLinuxEnvironment-Initialize.cmake b/Modules/Platform/CrayLinuxEnvironment-Initialize.cmake new file mode 100644 index 0000000..32cd009 --- /dev/null +++ b/Modules/Platform/CrayLinuxEnvironment-Initialize.cmake @@ -0,0 +1,4 @@ +# CrayLinuxEnvironment: loaded by users cross-compiling on a Cray front-end +# node by specifying "-DCMAKE_SYSTEM_NAME=CrayLinuxEnvironment" to cmake + +set(UNIX 1) diff --git a/Modules/Platform/CrayLinuxEnvironment.cmake b/Modules/Platform/CrayLinuxEnvironment.cmake index b982b3f..648806f 100644 --- a/Modules/Platform/CrayLinuxEnvironment.cmake +++ b/Modules/Platform/CrayLinuxEnvironment.cmake @@ -1,8 +1,6 @@ # CrayLinuxEnvironment: loaded by users cross-compiling on a Cray front-end # node by specifying "-DCMAKE_SYSTEM_NAME=CrayLinuxEnvironment" to cmake -set(UNIX 1) - if(DEFINED ENV{CRAYOS_VERSION}) set(CMAKE_SYSTEM_VERSION "$ENV{CRAYOS_VERSION}") elseif(DEFINED ENV{XTOS_VERSION}) diff --git a/Modules/Platform/DOS-Initialize.cmake b/Modules/Platform/DOS-Initialize.cmake new file mode 100644 index 0000000..10b0cbf --- /dev/null +++ b/Modules/Platform/DOS-Initialize.cmake @@ -0,0 +1 @@ +set(DOS 1) diff --git a/Modules/Platform/DOS.cmake b/Modules/Platform/DOS.cmake index fc95936..856f4b1 100644 --- a/Modules/Platform/DOS.cmake +++ b/Modules/Platform/DOS.cmake @@ -1,5 +1,3 @@ -set(DOS 1) - set(CMAKE_STATIC_LIBRARY_PREFIX "") set(CMAKE_STATIC_LIBRARY_SUFFIX ".lib") set(CMAKE_SHARED_LIBRARY_PREFIX "") diff --git a/Modules/Platform/Darwin-Initialize.cmake b/Modules/Platform/Darwin-Initialize.cmake index c2f1851..8d5bf8c 100644 --- a/Modules/Platform/Darwin-Initialize.cmake +++ b/Modules/Platform/Darwin-Initialize.cmake @@ -1,3 +1,6 @@ +set(APPLE 1) +set(UNIX 1) + # Ask xcode-select where to find /Developer or fall back to ancient location. execute_process(COMMAND xcode-select -print-path OUTPUT_VARIABLE _stdout @@ -40,7 +43,7 @@ if(NOT CMAKE_CROSSCOMPILING AND unset(_sysctl_stdout) endif() -# macOS, iOS, tvOS, and watchOS should lookup compilers from +# macOS, iOS, tvOS, visionOS, and watchOS should lookup compilers from # Platform/Apple-${CMAKE_CXX_COMPILER_ID}-<LANG> set(CMAKE_EFFECTIVE_SYSTEM_NAME "Apple") @@ -73,6 +76,8 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL iOS) set(_CMAKE_OSX_SYSROOT_DEFAULT "iphoneos") elseif(CMAKE_SYSTEM_NAME STREQUAL tvOS) set(_CMAKE_OSX_SYSROOT_DEFAULT "appletvos") +elseif(CMAKE_SYSTEM_NAME STREQUAL visionOS) + set(_CMAKE_OSX_SYSROOT_DEFAULT "xros") elseif(CMAKE_SYSTEM_NAME STREQUAL watchOS) set(_CMAKE_OSX_SYSROOT_DEFAULT "watchos") elseif("${CMAKE_GENERATOR}" MATCHES Xcode diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake index ac2478b..d614182 100644 --- a/Modules/Platform/Darwin.cmake +++ b/Modules/Platform/Darwin.cmake @@ -1,6 +1,4 @@ -set(APPLE 1) - -if(CMAKE_SYSTEM_NAME STREQUAL "iOS" OR CMAKE_SYSTEM_NAME STREQUAL "tvOS" OR CMAKE_SYSTEM_NAME STREQUAL "watchOS") +if(CMAKE_SYSTEM_NAME STREQUAL "iOS" OR CMAKE_SYSTEM_NAME STREQUAL "tvOS" OR CMAKE_SYSTEM_NAME STREQUAL "visionOS" OR CMAKE_SYSTEM_NAME STREQUAL "watchOS") if(NOT DEFINED CMAKE_MACOSX_BUNDLE) set(CMAKE_MACOSX_BUNDLE ON) endif() @@ -45,6 +43,8 @@ set(CMAKE_SHARED_LIBRARY_SUFFIX ".dylib") set(CMAKE_EXTRA_SHARED_LIBRARY_SUFFIXES ".tbd" ".so") set(CMAKE_SHARED_MODULE_PREFIX "lib") set(CMAKE_SHARED_MODULE_SUFFIX ".so") +set(CMAKE_APPLE_IMPORT_FILE_PREFIX "lib") +set(CMAKE_APPLE_IMPORT_FILE_SUFFIX ".tbd") set(CMAKE_MODULE_EXISTS 1) set(CMAKE_DL_LIBS "") if(NOT "${_CURRENT_OSX_VERSION}" VERSION_LESS "10.5") @@ -108,6 +108,9 @@ foreach(lang C CXX Fortran OBJC OBJCXX) set(CMAKE_${lang}_FRAMEWORK_SEARCH_FLAG -F) endforeach() +# To generate text-based stubs +set(CMAKE_CREATE_TEXT_STUBS "<CMAKE_TAPI> stubify -isysroot <CMAKE_OSX_SYSROOT> -o <TARGET_IMPLIB> <TARGET>") + # Defines LINK_LIBRARY features for frameworks set(CMAKE_LINK_LIBRARY_USING_FRAMEWORK "LINKER:-framework,<LIBRARY>") set(CMAKE_LINK_LIBRARY_USING_FRAMEWORK_SUPPORTED TRUE) diff --git a/Modules/Platform/DragonFly-Initialize.cmake b/Modules/Platform/DragonFly-Initialize.cmake new file mode 100644 index 0000000..ded94a9 --- /dev/null +++ b/Modules/Platform/DragonFly-Initialize.cmake @@ -0,0 +1,2 @@ +include(Platform/FreeBSD-Initialize) +set(BSD "DragonFlyBSD") diff --git a/Modules/Platform/DragonFly.cmake b/Modules/Platform/DragonFly.cmake index 994ba79..12e5f3c 100644 --- a/Modules/Platform/DragonFly.cmake +++ b/Modules/Platform/DragonFly.cmake @@ -3,7 +3,6 @@ # see http://archive.netbsd.se/?ml=dfbsd-users&a=2007-07&m=4678361 include(Platform/FreeBSD) -set(BSD "DragonFlyBSD") # DragonFly BSD requires -z origin to enable $ORIGIN expansion in RPATH. # This is not required for FreeBSD since 10.2-RELEASE. diff --git a/Modules/Platform/FreeBSD-Initialize.cmake b/Modules/Platform/FreeBSD-Initialize.cmake new file mode 100644 index 0000000..8c62a04 --- /dev/null +++ b/Modules/Platform/FreeBSD-Initialize.cmake @@ -0,0 +1,2 @@ +set(BSD "FreeBSD") +set(UNIX 1) diff --git a/Modules/Platform/FreeBSD.cmake b/Modules/Platform/FreeBSD.cmake index 9cd9399..bd5a786 100644 --- a/Modules/Platform/FreeBSD.cmake +++ b/Modules/Platform/FreeBSD.cmake @@ -1,4 +1,3 @@ -set(BSD "FreeBSD") set(CMAKE_DL_LIBS "") set(CMAKE_C_COMPILE_OPTIONS_PIC "-fPIC") set(CMAKE_C_COMPILE_OPTIONS_PIE "-fPIE") diff --git a/Modules/Platform/Fuchsia-Initialize.cmake b/Modules/Platform/Fuchsia-Initialize.cmake new file mode 100644 index 0000000..74b880a --- /dev/null +++ b/Modules/Platform/Fuchsia-Initialize.cmake @@ -0,0 +1 @@ +set(FUCHSIA 1) diff --git a/Modules/Platform/Fuchsia.cmake b/Modules/Platform/Fuchsia.cmake index 4b13805..ad3a365 100644 --- a/Modules/Platform/Fuchsia.cmake +++ b/Modules/Platform/Fuchsia.cmake @@ -1,5 +1,3 @@ -set(FUCHSIA 1) - set(CMAKE_DL_LIBS "") set(CMAKE_C_COMPILE_OPTIONS_PIC "-fPIC") set(CMAKE_C_COMPILE_OPTIONS_PIE "-fPIE") diff --git a/Modules/Platform/GNU-Initialize.cmake b/Modules/Platform/GNU-Initialize.cmake new file mode 100644 index 0000000..3db6cff18 --- /dev/null +++ b/Modules/Platform/GNU-Initialize.cmake @@ -0,0 +1,3 @@ +set(UNIX 1) + +set(CMAKE_LIBRARY_ARCHITECTURE_REGEX "[a-z0-9_]+(-[a-z0-9_]+)?-gnu[a-z0-9_]*") diff --git a/Modules/Platform/GNU.cmake b/Modules/Platform/GNU.cmake index fac29a8..188135b 100644 --- a/Modules/Platform/GNU.cmake +++ b/Modules/Platform/GNU.cmake @@ -35,6 +35,4 @@ else() endif() endif() -set(CMAKE_LIBRARY_ARCHITECTURE_REGEX "[a-z0-9_]+(-[a-z0-9_]+)?-gnu[a-z0-9_]*") - include(Platform/UnixPaths) diff --git a/Modules/Platform/HP-UX-Initialize.cmake b/Modules/Platform/HP-UX-Initialize.cmake new file mode 100644 index 0000000..0b117a7 --- /dev/null +++ b/Modules/Platform/HP-UX-Initialize.cmake @@ -0,0 +1 @@ +set(UNIX 1) diff --git a/Modules/Platform/Haiku-Initialize.cmake b/Modules/Platform/Haiku-Initialize.cmake new file mode 100644 index 0000000..fa9d456 --- /dev/null +++ b/Modules/Platform/Haiku-Initialize.cmake @@ -0,0 +1,2 @@ +set(HAIKU 1) +set(UNIX 1) diff --git a/Modules/Platform/Haiku.cmake b/Modules/Platform/Haiku.cmake index b8e3ba6..7d9a737 100644 --- a/Modules/Platform/Haiku.cmake +++ b/Modules/Platform/Haiku.cmake @@ -1,6 +1,3 @@ -set(HAIKU 1) -set(UNIX 1) - set(CMAKE_DL_LIBS "") set(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") diff --git a/Modules/Platform/Linux-Initialize.cmake b/Modules/Platform/Linux-Initialize.cmake new file mode 100644 index 0000000..7166b20 --- /dev/null +++ b/Modules/Platform/Linux-Initialize.cmake @@ -0,0 +1,5 @@ +set(LINUX 1) +set(UNIX 1) + +# Match multiarch library directory names. +set(CMAKE_LIBRARY_ARCHITECTURE_REGEX "[a-z0-9_]+(-[a-z0-9_]+)?-linux-gnu[a-z0-9_]*") diff --git a/Modules/Platform/Linux-LCC-Fortran.cmake b/Modules/Platform/Linux-LCC-Fortran.cmake index bf2a1c2..308c771 100644 --- a/Modules/Platform/Linux-LCC-Fortran.cmake +++ b/Modules/Platform/Linux-LCC-Fortran.cmake @@ -1,7 +1,9 @@ include(Platform/Linux-LCC) __linux_compiler_lcc(Fortran) -if (CMAKE_Fortran_COMPILER_VERSION VERSION_LESS "1.26.03") +if (CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER_EQUAL "1.26.03") + set(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS "-lgfortran") +elseif (CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER_EQUAL "1.24.01") set(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS "-llfortran") else() - set(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS "-lgfortran") + unset(CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE) endif() diff --git a/Modules/Platform/Linux.cmake b/Modules/Platform/Linux.cmake index 3dc3ca3..97a116f 100644 --- a/Modules/Platform/Linux.cmake +++ b/Modules/Platform/Linux.cmake @@ -1,4 +1,3 @@ -set(LINUX 1) set(CMAKE_DL_LIBS "dl") set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") @@ -80,9 +79,6 @@ else() endif() endif() -# Match multiarch library directory names. -set(CMAKE_LIBRARY_ARCHITECTURE_REGEX "[a-z0-9_]+(-[a-z0-9_]+)?-linux-gnu[a-z0-9_]*") - include(Platform/UnixPaths) # Debian has lib32 and lib64 paths only for compatibility so they should not be diff --git a/Modules/Platform/MP-RAS-Initialize.cmake b/Modules/Platform/MP-RAS-Initialize.cmake new file mode 100644 index 0000000..0b117a7 --- /dev/null +++ b/Modules/Platform/MP-RAS-Initialize.cmake @@ -0,0 +1 @@ +set(UNIX 1) diff --git a/Modules/Platform/MSYS-Initialize.cmake b/Modules/Platform/MSYS-Initialize.cmake new file mode 100644 index 0000000..cc33f87 --- /dev/null +++ b/Modules/Platform/MSYS-Initialize.cmake @@ -0,0 +1,2 @@ +set(MSYS 1) +include(Platform/CYGWIN-Initialize) diff --git a/Modules/Platform/MSYS.cmake b/Modules/Platform/MSYS.cmake index 96fa36f..468718d 100644 --- a/Modules/Platform/MSYS.cmake +++ b/Modules/Platform/MSYS.cmake @@ -1,4 +1,3 @@ -set(MSYS 1) include(Platform/CYGWIN) set(CMAKE_SHARED_LIBRARY_PREFIX "msys-") set(CMAKE_SHARED_MODULE_PREFIX "msys-") diff --git a/Modules/Platform/Midipix-Initialize.cmake b/Modules/Platform/Midipix-Initialize.cmake new file mode 100644 index 0000000..0b117a7 --- /dev/null +++ b/Modules/Platform/Midipix-Initialize.cmake @@ -0,0 +1 @@ +set(UNIX 1) diff --git a/Modules/Platform/NetBSD-Initialize.cmake b/Modules/Platform/NetBSD-Initialize.cmake new file mode 100644 index 0000000..055216d --- /dev/null +++ b/Modules/Platform/NetBSD-Initialize.cmake @@ -0,0 +1,2 @@ +set(BSD "NetBSD") +set(UNIX 1) diff --git a/Modules/Platform/NetBSD.cmake b/Modules/Platform/NetBSD.cmake index 52c6594..ab85923 100644 --- a/Modules/Platform/NetBSD.cmake +++ b/Modules/Platform/NetBSD.cmake @@ -1,4 +1,3 @@ -set(BSD "NetBSD") set(CMAKE_DL_LIBS "") set(CMAKE_C_COMPILE_OPTIONS_PIC "-fPIC") set(CMAKE_C_COMPILE_OPTIONS_PIE "-fPIE") diff --git a/Modules/Platform/OSF1-Initialize.cmake b/Modules/Platform/OSF1-Initialize.cmake new file mode 100644 index 0000000..0b117a7 --- /dev/null +++ b/Modules/Platform/OSF1-Initialize.cmake @@ -0,0 +1 @@ +set(UNIX 1) diff --git a/Modules/Platform/OpenBSD-Initialize.cmake b/Modules/Platform/OpenBSD-Initialize.cmake new file mode 100644 index 0000000..dee9a87 --- /dev/null +++ b/Modules/Platform/OpenBSD-Initialize.cmake @@ -0,0 +1,2 @@ +include(Platform/NetBSD-Initialize) +set(BSD "OpenBSD") diff --git a/Modules/Platform/OpenBSD.cmake b/Modules/Platform/OpenBSD.cmake index 51ea60d..97e2a6a 100644 --- a/Modules/Platform/OpenBSD.cmake +++ b/Modules/Platform/OpenBSD.cmake @@ -1,5 +1,4 @@ include(Platform/NetBSD) -set(BSD "OpenBSD") # On OpenBSD, the compile time linker does not share it's configuration with # the runtime linker. This will extract the library search paths from the diff --git a/Modules/Platform/OpenVMS-Initialize.cmake b/Modules/Platform/OpenVMS-Initialize.cmake new file mode 100644 index 0000000..0b117a7 --- /dev/null +++ b/Modules/Platform/OpenVMS-Initialize.cmake @@ -0,0 +1 @@ +set(UNIX 1) diff --git a/Modules/Platform/QNX-Initialize.cmake b/Modules/Platform/QNX-Initialize.cmake new file mode 100644 index 0000000..c74ff04 --- /dev/null +++ b/Modules/Platform/QNX-Initialize.cmake @@ -0,0 +1,3 @@ +set(QNXNTO 1) +include(Platform/GNU-Initialize) +unset(CMAKE_LIBRARY_ARCHITECTURE_REGEX) diff --git a/Modules/Platform/QNX.cmake b/Modules/Platform/QNX.cmake index ebc4609..be105a0 100644 --- a/Modules/Platform/QNX.cmake +++ b/Modules/Platform/QNX.cmake @@ -1,7 +1,4 @@ -set(QNXNTO 1) - include(Platform/GNU) -unset(CMAKE_LIBRARY_ARCHITECTURE_REGEX) set(CMAKE_DL_LIBS "") diff --git a/Modules/Platform/RISCos-Initialize.cmake b/Modules/Platform/RISCos-Initialize.cmake new file mode 100644 index 0000000..0b117a7 --- /dev/null +++ b/Modules/Platform/RISCos-Initialize.cmake @@ -0,0 +1 @@ +set(UNIX 1) diff --git a/Modules/Platform/SCO_SV-Initialize.cmake b/Modules/Platform/SCO_SV-Initialize.cmake new file mode 100644 index 0000000..0b117a7 --- /dev/null +++ b/Modules/Platform/SCO_SV-Initialize.cmake @@ -0,0 +1 @@ +set(UNIX 1) diff --git a/Modules/Platform/SINIX-Initialize.cmake b/Modules/Platform/SINIX-Initialize.cmake new file mode 100644 index 0000000..0b117a7 --- /dev/null +++ b/Modules/Platform/SINIX-Initialize.cmake @@ -0,0 +1 @@ +set(UNIX 1) diff --git a/Modules/Platform/SerenityOS-Initialize.cmake b/Modules/Platform/SerenityOS-Initialize.cmake new file mode 100644 index 0000000..e6ad610 --- /dev/null +++ b/Modules/Platform/SerenityOS-Initialize.cmake @@ -0,0 +1,2 @@ +set(SERENITYOS 1) +set(UNIX 1) diff --git a/Modules/Platform/SerenityOS.cmake b/Modules/Platform/SerenityOS.cmake index dc4f369..fa3d3ce 100644 --- a/Modules/Platform/SerenityOS.cmake +++ b/Modules/Platform/SerenityOS.cmake @@ -1,6 +1,3 @@ - -set(SERENITYOS 1) - set(CMAKE_DL_LIBS "") set(CMAKE_SHARED_LIBRARY_RPATH_ORIGIN_TOKEN "\$ORIGIN") set(CMAKE_SHARED_LIBRARY_SUFFIX ".so") diff --git a/Modules/Platform/SunOS-Initialize.cmake b/Modules/Platform/SunOS-Initialize.cmake new file mode 100644 index 0000000..0b117a7 --- /dev/null +++ b/Modules/Platform/SunOS-Initialize.cmake @@ -0,0 +1 @@ +set(UNIX 1) diff --git a/Modules/Platform/Tru64-Initialize.cmake b/Modules/Platform/Tru64-Initialize.cmake new file mode 100644 index 0000000..0b117a7 --- /dev/null +++ b/Modules/Platform/Tru64-Initialize.cmake @@ -0,0 +1 @@ +set(UNIX 1) diff --git a/Modules/Platform/ULTRIX-Initialize.cmake b/Modules/Platform/ULTRIX-Initialize.cmake new file mode 100644 index 0000000..0b117a7 --- /dev/null +++ b/Modules/Platform/ULTRIX-Initialize.cmake @@ -0,0 +1 @@ +set(UNIX 1) diff --git a/Modules/Platform/UNIX_SV-Initialize.cmake b/Modules/Platform/UNIX_SV-Initialize.cmake new file mode 100644 index 0000000..0b117a7 --- /dev/null +++ b/Modules/Platform/UNIX_SV-Initialize.cmake @@ -0,0 +1 @@ +set(UNIX 1) diff --git a/Modules/Platform/UnixPaths.cmake b/Modules/Platform/UnixPaths.cmake index 8a0ad23..32bc7bd 100644 --- a/Modules/Platform/UnixPaths.cmake +++ b/Modules/Platform/UnixPaths.cmake @@ -12,6 +12,9 @@ if(__UNIX_PATHS_INCLUDED) endif() set(__UNIX_PATHS_INCLUDED 1) +# Since CMake 3.27, the Platform/<os>-Initialize modules set UNIX +# if the corresponding Platform/<os> modules includes UnixPaths. +# Retain the setting here to support externally-maintained platform modules. set(UNIX 1) # also add the install directory of the running cmake to the search directories diff --git a/Modules/Platform/UnixWare-Initialize.cmake b/Modules/Platform/UnixWare-Initialize.cmake new file mode 100644 index 0000000..0b117a7 --- /dev/null +++ b/Modules/Platform/UnixWare-Initialize.cmake @@ -0,0 +1 @@ +set(UNIX 1) diff --git a/Modules/Platform/Windows-Apple-Swift.cmake b/Modules/Platform/Windows-Apple-Swift.cmake index 1177755..3f754fd 100644 --- a/Modules/Platform/Windows-Apple-Swift.cmake +++ b/Modules/Platform/Windows-Apple-Swift.cmake @@ -1 +1,3 @@ set(CMAKE_Swift_IMPLIB_LINKER_FLAGS "-Xlinker -implib:<TARGET_IMPLIB>") +set(CMAKE_Swift_FLAGS_DEBUG_LINKER_FLAGS "-Xlinker -debug") +set(CMAKE_Swift_FLAGS_RELWITHDEBINFO_LINKER_FLAGS "-Xlinker -debug") diff --git a/Modules/Platform/Windows-Initialize.cmake b/Modules/Platform/Windows-Initialize.cmake new file mode 100644 index 0000000..ecb2cf0 --- /dev/null +++ b/Modules/Platform/Windows-Initialize.cmake @@ -0,0 +1 @@ +set(WIN32 1) diff --git a/Modules/Platform/Windows-IntelLLVM.cmake b/Modules/Platform/Windows-IntelLLVM.cmake index 43f5874..eac3f0a 100644 --- a/Modules/Platform/Windows-IntelLLVM.cmake +++ b/Modules/Platform/Windows-IntelLLVM.cmake @@ -54,6 +54,7 @@ macro(__windows_compiler_intel lang) "${_CMAKE_VS_LINK_EXE}<CMAKE_${lang}_COMPILER> ${CMAKE_CL_NOLOGO} <CMAKE_${lang}_LINK_FLAGS> <OBJECTS> ${CMAKE_START_TEMP_FILE} <LINK_FLAGS> <LINK_LIBRARIES> /link /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR>${_PLATFORM_LINK_FLAGS} ${CMAKE_END_TEMP_FILE}") set(CMAKE_${lang}_CREATE_SHARED_LIBRARY "${_CMAKE_VS_LINK_DLL}<CMAKE_${lang}_COMPILER> ${CMAKE_CL_NOLOGO} <CMAKE_${lang}_LINK_FLAGS> <OBJECTS> ${CMAKE_START_TEMP_FILE} -LD <LINK_FLAGS> <LINK_LIBRARIES> -link /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR>${_PLATFORM_LINK_FLAGS} ${CMAKE_END_TEMP_FILE}") + set(CMAKE_${lang}_CREATE_SHARED_MODULE ${CMAKE_${lang}_CREATE_SHARED_LIBRARY}) if (NOT "${lang}" STREQUAL "Fortran" OR CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL 2022.1) # The Fortran driver does not support -fuse-ld=llvm-lib before compiler version 2022.1 set(CMAKE_${lang}_CREATE_STATIC_LIBRARY diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake index 8e96bf4..829ab9b 100644 --- a/Modules/Platform/Windows-MSVC.cmake +++ b/Modules/Platform/Windows-MSVC.cmake @@ -28,6 +28,8 @@ endif() if(CMAKE_SYSTEM_NAME STREQUAL "WindowsCE") set(_PLATFORM_LINK_FLAGS " /subsystem:windowsce") +elseif(CMAKE_SYSTEM_NAME STREQUAL "WindowsKernelModeDriver") + set(_PLATFORM_LINK_FLAGS " -subsystem:native -kernel -MANIFEST:NO") else() set(_PLATFORM_LINK_FLAGS "") endif() @@ -223,6 +225,18 @@ elseif(WINDOWS_PHONE OR WINDOWS_STORE) else() set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib") endif() +elseif(CMAKE_SYSTEM_NAME STREQUAL "WindowsKernelModeDriver") + set(CMAKE_C_STANDARD_LIBRARIES_INIT "") + set(_FLAGS_C " -kernel") + set(_FLAGS_CXX " -kernel") + foreach(t EXE SHARED MODULE) + string(APPEND CMAKE_${t}_LINKER_FLAGS_INIT " -NODEFAULTLIB") + endforeach() + if((_MSVC_C_ARCHITECTURE_FAMILY STREQUAL "x64") OR (_MSVC_CXX_ARCHITECTURE_FAMILY STREQUAL "x64")) + set(_PLATFORM_DEFINES "${_PLATFORM_DEFINES} -D_AMD64_ -DAMD64") + elseif((_MSVC_C_ARCHITECTURE_FAMILY STREQUAL "ARM64") OR (_MSVC_CXX_ARCHITECTURE_FAMILY STREQUAL "ARM64")) + set(_PLATFORM_DEFINES "${_PLATFORM_DEFINES} -D_ARM64_ -DARM64") + endif() else() set(_PLATFORM_DEFINES "/DWIN32") if((_MSVC_C_ARCHITECTURE_FAMILY STREQUAL "ARM64EC") OR (_MSVC_CXX_ARCHITECTURE_FAMILY STREQUAL "ARM64EC")) @@ -294,7 +308,7 @@ endif() # add /debug and /INCREMENTAL:YES to DEBUG and RELWITHDEBINFO also add pdbtype # on versions that support it set( MSVC_INCREMENTAL_YES_FLAG "") -if(NOT WINDOWS_PHONE AND NOT WINDOWS_STORE) +if(NOT WINDOWS_PHONE AND NOT WINDOWS_STORE AND NOT CMAKE_SYSTEM_NAME STREQUAL "WindowsKernelModeDriver") if(NOT MSVC_INCREMENTAL_DEFAULT) set( MSVC_INCREMENTAL_YES_FLAG "/INCREMENTAL:YES") else() @@ -353,8 +367,14 @@ macro(__windows_compiler_msvc lang) set(_CMAKE_VS_LINK_DLL "<CMAKE_COMMAND> -E vs_link_dll --intdir=<OBJECT_DIR> --rc=<CMAKE_RC_COMPILER> --mt=<CMAKE_MT> --manifests <MANIFESTS> -- ") set(_CMAKE_VS_LINK_EXE "<CMAKE_COMMAND> -E vs_link_exe --intdir=<OBJECT_DIR> --rc=<CMAKE_RC_COMPILER> --mt=<CMAKE_MT> --manifests <MANIFESTS> -- ") endif() + if(CMAKE_SYSTEM_NAME STREQUAL "WindowsKernelModeDriver") + set(_DLL_DRIVER "-driver") + else() + set(_DLL_DRIVER "/dll") + endif() set(CMAKE_${lang}_CREATE_SHARED_LIBRARY - "${_CMAKE_VS_LINK_DLL}<CMAKE_LINKER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /dll /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR>${_PLATFORM_LINK_FLAGS} <LINK_FLAGS> <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}") + "${_CMAKE_VS_LINK_DLL}<CMAKE_LINKER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> ${_DLL_DRIVER} /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR>${_PLATFORM_LINK_FLAGS} <LINK_FLAGS> <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}") + unset(_DLL_DRIVER) set(CMAKE_${lang}_CREATE_SHARED_MODULE ${CMAKE_${lang}_CREATE_SHARED_LIBRARY}) set(CMAKE_${lang}_CREATE_STATIC_LIBRARY "<CMAKE_AR> ${CMAKE_CL_NOLOGO} <LINK_FLAGS> /out:<TARGET> <OBJECTS> ") diff --git a/Modules/Platform/Windows.cmake b/Modules/Platform/Windows.cmake index d8b3957..1bf39cf 100644 --- a/Modules/Platform/Windows.cmake +++ b/Modules/Platform/Windows.cmake @@ -1,17 +1,11 @@ -set(WIN32 1) - -if(CMAKE_SYSTEM_NAME STREQUAL "WindowsCE") - set(WINCE 1) -elseif(CMAKE_SYSTEM_NAME STREQUAL "WindowsPhone") - set(WINDOWS_PHONE 1) -elseif(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") - set(WINDOWS_STORE 1) -endif() - set(CMAKE_STATIC_LIBRARY_PREFIX "") set(CMAKE_STATIC_LIBRARY_SUFFIX ".lib") set(CMAKE_SHARED_LIBRARY_PREFIX "") # lib -set(CMAKE_SHARED_LIBRARY_SUFFIX ".dll") # .so +if(CMAKE_SYSTEM_NAME STREQUAL "WindowsKernelModeDriver") + set(CMAKE_SHARED_LIBRARY_SUFFIX ".sys") # .so +else() + set(CMAKE_SHARED_LIBRARY_SUFFIX ".dll") # .so +endif() set(CMAKE_IMPORT_LIBRARY_PREFIX "") set(CMAKE_IMPORT_LIBRARY_SUFFIX ".lib") set(CMAKE_EXECUTABLE_SUFFIX ".exe") # .exe diff --git a/Modules/Platform/WindowsCE-Initialize.cmake b/Modules/Platform/WindowsCE-Initialize.cmake new file mode 100644 index 0000000..32351a9 --- /dev/null +++ b/Modules/Platform/WindowsCE-Initialize.cmake @@ -0,0 +1,2 @@ +include(Platform/Windows-Initialize) +set(WINCE 1) diff --git a/Modules/Platform/WindowsKernelModeDriver-Initialize.cmake b/Modules/Platform/WindowsKernelModeDriver-Initialize.cmake new file mode 100644 index 0000000..6f0ef33 --- /dev/null +++ b/Modules/Platform/WindowsKernelModeDriver-Initialize.cmake @@ -0,0 +1,11 @@ +# undocumented, do not use outside of CMake +cmake_language(GET_EXPERIMENTAL_FEATURE_ENABLED "WindowsKernelModeDriver" _cmake_windows_kernel_mode_driver_enabled) +if(NOT _cmake_windows_kernel_mode_driver_enabled) + message(FATAL_ERROR "Windows kernel-mode driver experimental support is not enabled.") +endif() + +if(CMAKE_GENERATOR MATCHES "Visual Studio") + message(FATAL_ERROR "Visual Studio generators do not yet support CMAKE_SYSTEM_NAME=WindowsKernelModeDriver.") +endif() + +set(_CMAKE_FEATURE_DETECTION_TARGET_TYPE STATIC_LIBRARY) diff --git a/Modules/Platform/WindowsKernelModeDriver-MSVC-C.cmake b/Modules/Platform/WindowsKernelModeDriver-MSVC-C.cmake new file mode 100644 index 0000000..ce8060b --- /dev/null +++ b/Modules/Platform/WindowsKernelModeDriver-MSVC-C.cmake @@ -0,0 +1 @@ +include(Platform/Windows-MSVC-C) diff --git a/Modules/Platform/WindowsKernelModeDriver-MSVC-CXX.cmake b/Modules/Platform/WindowsKernelModeDriver-MSVC-CXX.cmake new file mode 100644 index 0000000..281eadc --- /dev/null +++ b/Modules/Platform/WindowsKernelModeDriver-MSVC-CXX.cmake @@ -0,0 +1 @@ +include(Platform/Windows-MSVC-CXX) diff --git a/Modules/Platform/WindowsKernelModeDriver.cmake b/Modules/Platform/WindowsKernelModeDriver.cmake new file mode 100644 index 0000000..65b2eae --- /dev/null +++ b/Modules/Platform/WindowsKernelModeDriver.cmake @@ -0,0 +1 @@ +include(Platform/Windows) diff --git a/Modules/Platform/WindowsPhone-Initialize.cmake b/Modules/Platform/WindowsPhone-Initialize.cmake new file mode 100644 index 0000000..c591881 --- /dev/null +++ b/Modules/Platform/WindowsPhone-Initialize.cmake @@ -0,0 +1,2 @@ +include(Platform/Windows-Initialize) +set(WINDOWS_PHONE 1) diff --git a/Modules/Platform/WindowsStore-Initialize.cmake b/Modules/Platform/WindowsStore-Initialize.cmake new file mode 100644 index 0000000..43374c2 --- /dev/null +++ b/Modules/Platform/WindowsStore-Initialize.cmake @@ -0,0 +1,2 @@ +include(Platform/Windows-Initialize) +set(WINDOWS_STORE 1) diff --git a/Modules/Platform/Xenix-Initialize.cmake b/Modules/Platform/Xenix-Initialize.cmake new file mode 100644 index 0000000..0b117a7 --- /dev/null +++ b/Modules/Platform/Xenix-Initialize.cmake @@ -0,0 +1 @@ +set(UNIX 1) diff --git a/Modules/Platform/eCos-Initialize.cmake b/Modules/Platform/eCos-Initialize.cmake new file mode 100644 index 0000000..0b117a7 --- /dev/null +++ b/Modules/Platform/eCos-Initialize.cmake @@ -0,0 +1 @@ +set(UNIX 1) diff --git a/Modules/Platform/kFreeBSD-Initialize.cmake b/Modules/Platform/kFreeBSD-Initialize.cmake new file mode 100644 index 0000000..f5d7b0a --- /dev/null +++ b/Modules/Platform/kFreeBSD-Initialize.cmake @@ -0,0 +1,5 @@ +# kFreeBSD is a Debian GNU distribution with a kernel from FreeBSD, +# and should be marked as LINUX +include(Platform/Linux-Initialize) + +set(CMAKE_LIBRARY_ARCHITECTURE_REGEX "[a-z0-9_]+(-[a-z0-9_]+)?-kfreebsd-gnu[a-z0-9_]*") diff --git a/Modules/Platform/kFreeBSD.cmake b/Modules/Platform/kFreeBSD.cmake index 09c240d..171c1ac 100644 --- a/Modules/Platform/kFreeBSD.cmake +++ b/Modules/Platform/kFreeBSD.cmake @@ -1,5 +1,2 @@ -# kFreeBSD is a Debian GNU distribution with a kernel from FreeBSD, -# and should be marked as LINUX +# kFreeBSD is a Debian GNU distribution with a kernel from FreeBSD. include(Platform/Linux) - -set(CMAKE_LIBRARY_ARCHITECTURE_REGEX "[a-z0-9_]+(-[a-z0-9_]+)?-kfreebsd-gnu[a-z0-9_]*") diff --git a/Modules/Platform/syllable-Initialize.cmake b/Modules/Platform/syllable-Initialize.cmake new file mode 100644 index 0000000..0b117a7 --- /dev/null +++ b/Modules/Platform/syllable-Initialize.cmake @@ -0,0 +1 @@ +set(UNIX 1) diff --git a/Modules/Platform/visionOS-Determine-CXX.cmake b/Modules/Platform/visionOS-Determine-CXX.cmake new file mode 100644 index 0000000..ac80fa6 --- /dev/null +++ b/Modules/Platform/visionOS-Determine-CXX.cmake @@ -0,0 +1 @@ +include(Platform/Darwin-Determine-CXX) diff --git a/Modules/Platform/visionOS-Initialize.cmake b/Modules/Platform/visionOS-Initialize.cmake new file mode 100644 index 0000000..e8431bc --- /dev/null +++ b/Modules/Platform/visionOS-Initialize.cmake @@ -0,0 +1,7 @@ +include(Platform/Darwin-Initialize) + +if(NOT _CMAKE_OSX_SYSROOT_PATH MATCHES "/XR(OS|Simulator)") + message(FATAL_ERROR "${CMAKE_OSX_SYSROOT} is not an visionOS SDK") +endif() + +set(_CMAKE_FEATURE_DETECTION_TARGET_TYPE STATIC_LIBRARY) diff --git a/Modules/Platform/visionOS.cmake b/Modules/Platform/visionOS.cmake new file mode 100644 index 0000000..850ddc2 --- /dev/null +++ b/Modules/Platform/visionOS.cmake @@ -0,0 +1 @@ +include(Platform/Darwin) diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake index 54a8cf7..99fd617 100644 --- a/Modules/UseJava.cmake +++ b/Modules/UseJava.cmake @@ -294,7 +294,7 @@ Header Generation .. deprecated:: 3.11 This command will no longer be supported starting with version 10 of the JDK - due to the `suppression of javah tool <https://openjdk.java.net/jeps/313>`_. + due to the `suppression of javah tool <https://openjdk.org/jeps/313>`_. The :ref:`add_jar(GENERATE_NATIVE_HEADERS) <add_jar>` command should be used instead. diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake index ca16bc2..cece973 100644 --- a/Modules/UseSWIG.cmake +++ b/Modules/UseSWIG.cmake @@ -189,7 +189,7 @@ ensure generated files will receive the required settings. :ref:`Makefile <Makefile Generators>`, :ref:`Ninja <Ninja Generators>`, :generator:`Xcode`, and :ref:`Visual Studio <Visual Studio Generators>` - (:generator:`Visual Studio 11 2012` and above) generators. Default value is + (:generator:`Visual Studio 12 2013` and above) generators. Default value is ``FALSE``. .. versionadded:: 3.21 @@ -353,7 +353,7 @@ as well as ``SWIG``: :ref:`Makefile <Makefile Generators>`, :ref:`Ninja <Ninja Generators>`, :generator:`Xcode`, and :ref:`Visual Studio <Visual Studio Generators>` - (:generator:`Visual Studio 11 2012` and above) generators. Default value is + (:generator:`Visual Studio 12 2013` and above) generators. Default value is ``FALSE``. Source file property ``USE_SWIG_DEPENDENCIES``, if not defined, will be |