diff options
Diffstat (limited to 'Modules')
105 files changed, 2368 insertions, 1147 deletions
diff --git a/Modules/CMakeASMCompiler.cmake.in b/Modules/CMakeASMCompiler.cmake.in index 3953b304b0..8a1718bb48 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 2b24ff2aad..cf3a242a64 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 57d595af30..3d7d55201b 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 dea721ebb9..e774088811 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 534e96055f..2052e7f903 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/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake index c4ddf75e3f..9e38566755 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)?$") 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/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index f79e8b8d39..403766e561 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 "") diff --git a/Modules/CMakeDetermineSystem.cmake b/Modules/CMakeDetermineSystem.cmake index d4dcc62f99..386be73f68 100644 --- a/Modules/CMakeDetermineSystem.cmake +++ b/Modules/CMakeDetermineSystem.cmake @@ -176,6 +176,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 2ac8879923..10e8ff347f 100644 --- a/Modules/CMakeFindBinUtils.cmake +++ b/Modules/CMakeFindBinUtils.cmake @@ -165,6 +165,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) @@ -185,7 +186,15 @@ else() list(PREPEND _CMAKE_RANLIB_NAMES "llvm-ranlib") 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") + if(APPLE) + # llvm-strip does not seem to support chained fixup format correctly. + # FIXME(#23333): We still need to consider 'llvm-strip' as a fallback + # because the 'APPLE' definition may be based on the host in this context, + # and a cross-compiling toolchain may not have 'strip'. + list(APPEND _CMAKE_STRIP_NAMES "llvm-strip") + else() + 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 +210,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 +234,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 9aaf6e5716..521bc5caf8 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 f52ad02bb2..a7caf2be8a 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 ce4e2cf656..32c122366e 100644 --- a/Modules/CMakeHIPCompiler.cmake.in +++ b/Modules/CMakeHIPCompiler.cmake.in @@ -26,6 +26,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 +59,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/CMakeOBJCCompiler.cmake.in b/Modules/CMakeOBJCCompiler.cmake.in index 36f6ec1505..0ceb80468c 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 4f271003a5..f087ec3f52 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/CMakeSwiftInformation.cmake b/Modules/CMakeSwiftInformation.cmake index f524955861..777c6807c5 100644 --- a/Modules/CMakeSwiftInformation.cmake +++ b/Modules/CMakeSwiftInformation.cmake @@ -72,9 +72,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/CPack.cmake b/Modules/CPack.cmake index f9cf33fa9a..ff1cb7e6fd 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/CPackIFW.cmake b/Modules/CPackIFW.cmake index d4e02f1227..2338b79f35 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 b91b48eec4..99ef8e50c3 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 335b437133..cd89a55a92 100644 --- a/Modules/CheckCCompilerFlag.cmake +++ b/Modules/CheckCCompilerFlag.cmake @@ -11,29 +11,40 @@ 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) diff --git a/Modules/CheckCSourceCompiles.cmake b/Modules/CheckCSourceCompiles.cmake index b24da49bc0..ce4719a30a 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 a6081ff46e..d5a8fda423 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 3bc346362d..a6884f5b83 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,7 +28,6 @@ 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) diff --git a/Modules/CheckCXXSourceCompiles.cmake b/Modules/CheckCXXSourceCompiles.cmake index 502bfa76e6..4b33aa8ae4 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 af03453d98..34027150e9 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 1fa0898286..569dafdc44 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 77c07b95da..a18435b3b1 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 5b1cd02779..c3cd088873 100644 --- a/Modules/CheckFortranCompilerFlag.cmake +++ b/Modules/CheckFortranCompilerFlag.cmake @@ -13,29 +13,40 @@ 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) diff --git a/Modules/CheckFortranSourceCompiles.cmake b/Modules/CheckFortranSourceCompiles.cmake index 8dcc1d54a5..5158b7eed4 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 985c765599..f9967498c4 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 e2939ed97d..e7c47a4e7a 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 577130725d..1d8c9f766d 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 d27b485e57..53d9a456e0 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 2f50c61d47..071df0c601 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 2e56a195a5..69913a334c 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 5f1a914b3c..8340500803 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 d8d874175f..ceb7e1738f 100644 --- a/Modules/CheckOBJCCompilerFlag.cmake +++ b/Modules/CheckOBJCCompilerFlag.cmake @@ -13,29 +13,40 @@ 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) diff --git a/Modules/CheckOBJCSourceCompiles.cmake b/Modules/CheckOBJCSourceCompiles.cmake index c268ef9050..7663054b62 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 dd03309936..a23a0c724e 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 3f3f8fe38b..47dacc2a11 100644 --- a/Modules/CheckOBJCXXCompilerFlag.cmake +++ b/Modules/CheckOBJCXXCompilerFlag.cmake @@ -13,29 +13,40 @@ 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) diff --git a/Modules/CheckOBJCXXSourceCompiles.cmake b/Modules/CheckOBJCXXSourceCompiles.cmake index 11869343a4..cfbda3a3c3 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 05a5e4cf59..b2831b6ed3 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 3d53b930a7..c1a7a1c579 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 978879815d..041b59c457 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 e2fa579253..822ee07a82 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 8217c84c2a..81ea9fd48b 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,9 +74,9 @@ 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() diff --git a/Modules/CheckSymbolExists.cmake b/Modules/CheckSymbolExists.cmake index c4a15744f4..931ed4a05c 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 579d189dab..01ce1d202a 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 3a7a431fdf..9e5d710f33 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-HIP.cmake b/Modules/Compiler/Clang-HIP.cmake index 4dbe2e8c01..7e3c99c905 100644 --- a/Modules/Compiler/Clang-HIP.cmake +++ b/Modules/Compiler/Clang-HIP.cmake @@ -1,4 +1,13 @@ include(Compiler/Clang) + +# +# For now, deactivate globally linker dependency file support because +# HIP compiler is based on Clang which provides support of other languages +# +foreach (lang IN ITEMS "C" "CXX" "OBJC" "OBJCXX" "Fortran" "ASM") + set(CMAKE_${lang}_LINKER_DEPFILE_SUPPORTED FALSE) +endforeach() + __compiler_clang(HIP) __compiler_clang_cxx_standards(HIP) diff --git a/Modules/Compiler/GNU.cmake b/Modules/Compiler/GNU.cmake index 5930e377cb..f14020876f 100644 --- a/Modules/Compiler/GNU.cmake +++ b/Modules/Compiler/GNU.cmake @@ -52,6 +52,44 @@ macro(__compiler_gnu lang) set(CMAKE_DEPFILE_FLAGS_${lang} "-MD -MT <DEP_TARGET> -MF <DEP_FILE>") endif() + # define flags for linker depfile generation + 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_LINKER}" --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}_LINKER_DEPFILE_FLAGS "LINKER:--dependency-file,<DEP_FILE>") + set(CMAKE_${lang}_LINKER_DEPFILE_FORMAT gcc) + set(CMAKE_${lang}_LINK_DEPENDS_USE_LINKER TRUE) + else() + unset(CMAKE_${lang}_LINK_DEPENDS_USE_LINKER) + 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 bae0fbd8ca..4c0025c7f9 100644 --- a/Modules/Compiler/IAR-ASM.cmake +++ b/Modules/Compiler/IAR-ASM.cmake @@ -2,44 +2,74 @@ 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) + +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) -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) + +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) + +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.cmake b/Modules/Compiler/IAR.cmake index 7908f962fd..32a7b3f5af 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") @@ -35,7 +35,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 +48,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 a9d760fa97..169a0f0382 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 8091b29949..2d82ea8063 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.cmake b/Modules/Compiler/NVHPC.cmake index 474ac80efe..0593456ce7 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 0823954302..c839d1cbbb 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 3598fc7e20..fa324d8214 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 154fe9d7db..361001205e 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 b34a35b23b..e2cc497a65 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -278,6 +278,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`` @@ -1188,6 +1195,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 @@ -2090,13 +2099,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() @@ -4165,6 +4168,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/download.cmake.in b/Modules/ExternalProject/download.cmake.in index ff8c659082..bf7f209723 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/shared_internal_commands.cmake b/Modules/ExternalProject/shared_internal_commands.cmake new file mode 100644 index 0000000000..ca3cd9fec7 --- /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 8afb9bce72..74ac8aab2a 100644 --- a/Modules/FetchContent.cmake +++ b/Modules/FetchContent.cmake @@ -1076,6 +1076,8 @@ current working directory. #]=======================================================================] +include(${CMAKE_CURRENT_LIST_DIR}/ExternalProject/shared_internal_commands.cmake) + #======================================================================= # Recording and retrieving content details for later population #======================================================================= @@ -1223,6 +1225,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 +1245,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 @@ -1536,7 +1563,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 +1625,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 d94b0f415a..8adb533500 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 7af1017006..39a1163533 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/FindCUDA.cmake b/Modules/FindCUDA.cmake index c9281574ba..220b9ab2ae 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() diff --git a/Modules/FindCUDAToolkit.cmake b/Modules/FindCUDAToolkit.cmake index 724fdf154c..107ced7f83 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,7 +250,7 @@ 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: @@ -330,7 +344,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 +388,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 +430,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 +622,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 +1105,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,6 +1153,7 @@ 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) _CUDAToolkit_find_and_add_import_lib(cupti diff --git a/Modules/FindDart.cmake b/Modules/FindDart.cmake index 04925783b8..fed50e178c 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 ef9801eb24..76f47590c3 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 f9cb432078..3bedc73cfc 100644 --- a/Modules/FindEXPAT.cmake +++ b/Modules/FindEXPAT.cmake @@ -39,27 +39,62 @@ 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) + list(APPEND EXPAT_NAMES expatMT expatMD expatwMT expatwMD) + list(APPEND EXPAT_NAMES_DEBUG expatdMT expatdMD expatwdMT expatwdMD) +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 +103,36 @@ 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_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 6fab08ffb2..a44c6f99b9 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 1eecb1cbd2..4d3ab5a0f3 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/FindMatlab.cmake b/Modules/FindMatlab.cmake index 34b1c5bf01..e111b790b4 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. @@ -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/FindOpenAL.cmake b/Modules/FindOpenAL.cmake index 53aafdc0c3..3d585694de 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 2b700ffd37..55be667a86 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 a9a1b2aec2..a7736015ad 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``. @@ -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/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake index 4e8374c68e..45dc9ac809 100644 --- a/Modules/FindOpenSSL.cmake +++ b/Modules/FindOpenSSL.cmake @@ -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,7 +230,7 @@ else() set(_OPENSSL_FIND_PATH_SUFFIX "include") endif() -if (WIN32) +if (MSVC) # http://www.slproweb.com/products/Win32OpenSSL.html set(_OPENSSL_ROOT_HINTS ${OPENSSL_ROOT_DIR} diff --git a/Modules/FindPNG.cmake b/Modules/FindPNG.cmake index 94d15db5fc..043b69ca02 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/FindPython.cmake b/Modules/FindPython.cmake index 31ef1c7d53..e6f44e0cad 100644 --- a/Modules/FindPython.cmake +++ b/Modules/FindPython.cmake @@ -335,6 +335,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 +444,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 517ac21eb7..60d229645e 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) @@ -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() @@ -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() diff --git a/Modules/FindPython2.cmake b/Modules/FindPython2.cmake index 41d9b689ac..0575ea5a45 100644 --- a/Modules/FindPython2.cmake +++ b/Modules/FindPython2.cmake @@ -234,6 +234,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 +343,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 ae086e8546..18929b2d92 100644 --- a/Modules/FindPython3.cmake +++ b/Modules/FindPython3.cmake @@ -333,6 +333,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 +442,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 7ad358782f..b5e759de43 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 43a84dd735..06004ee468 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 38179878c2..581763de00 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 8e5a5f1709..1047e4fb87 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 7118df200f..40e767b54d 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 3159ff7654..cc76b350c9 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/FortranCInterface.cmake b/Modules/FortranCInterface.cmake index ed8830ebcd..2c85029ed4 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 4bd7006efb..a0f186250b 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 7461a3e5d0..01a6e4f5f0 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)") diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake index 0ba35b6b79..0cd49ab4ba 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/ISComponents.pas b/Modules/Internal/CPack/ISComponents.pas new file mode 100644 index 0000000000..8b5c8b4fc2 --- /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 0000000000..1171058939 --- /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 f8481cdd2b..8c5703db19 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 7613105500..b872b5121e 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 83d7020df5..14a9a61a87 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 805d98d89c..c01081eb98 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 9a7f9f57e4..fccfaae4a6 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 d651cddd53..8973231317 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/Android-Determine.cmake b/Modules/Platform/Android-Determine.cmake index 715f68bb4e..307e4c9a53 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/VCXProjInspect.vcxproj.in b/Modules/Platform/Android/VCXProjInspect.vcxproj.in index 6919d2cd85..f87d59bca2 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/Darwin.cmake b/Modules/Platform/Darwin.cmake index ac2478bc77..a6c86f1303 100644 --- a/Modules/Platform/Darwin.cmake +++ b/Modules/Platform/Darwin.cmake @@ -45,6 +45,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 +110,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/Linux-LCC-Fortran.cmake b/Modules/Platform/Linux-LCC-Fortran.cmake index bf2a1c2d68..308c771c54 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/Windows-Apple-Swift.cmake b/Modules/Platform/Windows-Apple-Swift.cmake index 1177755474..3f754fda09 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/UseJava.cmake b/Modules/UseJava.cmake index 54a8cf741c..99fd6176b0 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. |