summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'Modules')
-rw-r--r--Modules/CMakeDetermineCUDACompiler.cmake43
-rw-r--r--Modules/CMakeGenericSystem.cmake6
-rw-r--r--Modules/CPack.cmake23
-rw-r--r--Modules/Compiler/Clang-CUDA.cmake15
-rw-r--r--Modules/Compiler/SunPro-C.cmake9
-rw-r--r--Modules/ExternalProject.cmake4
-rw-r--r--Modules/ExternalProject/gitupdate.cmake.in2
-rw-r--r--Modules/FindThreads.cmake19
-rw-r--r--Modules/Internal/CPack/CPackRPM.cmake2
-rw-r--r--Modules/Platform/Apple-Apple-Swift.cmake14
-rw-r--r--Modules/Platform/Apple-NVIDIA-CUDA.cmake14
-rw-r--r--Modules/Platform/Darwin.cmake13
-rw-r--r--Modules/Platform/GHS-MULTI-Determine.cmake4
13 files changed, 124 insertions, 44 deletions
diff --git a/Modules/CMakeDetermineCUDACompiler.cmake b/Modules/CMakeDetermineCUDACompiler.cmake
index c21d622..f491c79 100644
--- a/Modules/CMakeDetermineCUDACompiler.cmake
+++ b/Modules/CMakeDetermineCUDACompiler.cmake
@@ -272,26 +272,25 @@ if(NOT CMAKE_CUDA_COMPILER_ID_RUN)
endif()
endif()
- # Detect explicit architectures and add them during detection.
- if(DEFINED CMAKE_CUDA_ARCHITECTURES AND NOT "${CMAKE_CUDA_ARCHITECTURES}" STREQUAL "all" AND NOT "${CMAKE_CUDA_ARCHITECTURES}" STREQUAL "all-major")
- set(architectures_explicit TRUE)
- set(architectures_test ${CMAKE_CUDA_ARCHITECTURES})
- endif()
-
- # For sufficiently new NVCC we can just use the all and all-major flags.
- # For VS we don't test since we can't figure out the version this early (see #23161).
- # For others select based on version.
- if(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA" AND CMAKE_CUDA_COMPILER_TOOLKIT_VERSION VERSION_GREATER_EQUAL 11.5)
- if("${CMAKE_CUDA_ARCHITECTURES}" STREQUAL "all")
- string(APPEND nvcc_test_flags " -arch=all")
- elseif("${CMAKE_CUDA_ARCHITECTURES}" STREQUAL "all-major")
- string(APPEND nvcc_test_flags " -arch=all-major")
- endif()
- elseif(NOT CMAKE_GENERATOR MATCHES "Visual Studio")
- if("${CMAKE_CUDA_ARCHITECTURES}" STREQUAL "all")
- set(architectures_test ${CMAKE_CUDA_ARCHITECTURES_ALL})
- elseif("${CMAKE_CUDA_ARCHITECTURES}" STREQUAL "all-major")
- set(architectures_test ${CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR})
+ if(DEFINED CMAKE_CUDA_ARCHITECTURES)
+ if(CMAKE_CUDA_ARCHITECTURES MATCHES "^(all|all-major)$")
+ # For sufficiently new NVCC we can just use the all and all-major flags.
+ # For VS we don't test since we can't figure out the version this early (see #23161).
+ # For others select based on version.
+ if(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA" AND CMAKE_CUDA_COMPILER_TOOLKIT_VERSION VERSION_GREATER_EQUAL 11.5)
+ string(APPEND nvcc_test_flags " -arch=${CMAKE_CUDA_ARCHITECTURES}")
+ set(architectures_tested "${CMAKE_CUDA_ARCHITECTURES}")
+ elseif(NOT CMAKE_GENERATOR MATCHES "Visual Studio")
+ if(CMAKE_CUDA_ARCHITECTURES STREQUAL "all")
+ set(architectures_test ${CMAKE_CUDA_ARCHITECTURES_ALL})
+ elseif(CMAKE_CUDA_ARCHITECTURES STREQUAL "all-major")
+ set(architectures_test ${CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR})
+ endif()
+ endif()
+ else()
+ # Explicit architectures. Test them during detection.
+ set(architectures_explicit TRUE)
+ set(architectures_test ${CMAKE_CUDA_ARCHITECTURES})
endif()
endif()
@@ -632,7 +631,7 @@ if("${CMAKE_CUDA_ARCHITECTURES}" STREQUAL "")
message(FATAL_ERROR "Failed to detect a default CUDA architecture.\n\nCompiler output:\n${CMAKE_CUDA_COMPILER_PRODUCED_OUTPUT}")
endif()
endif()
-else()
+elseif(NOT "${architectures_tested}" MATCHES "^(all|all-major)$")
# Sort since order mustn't matter.
list(SORT architectures_detected)
list(SORT architectures_tested)
@@ -673,6 +672,8 @@ unset(_CUDA_TARGET_DIR)
unset(_CUDA_TARGET_NAME)
unset(architectures_explicit)
+unset(architectures_detected)
+unset(architectures_tested)
set(CMAKE_CUDA_COMPILER_ENV_VAR "CUDACXX")
set(CMAKE_CUDA_HOST_COMPILER_ENV_VAR "CUDAHOSTCXX")
diff --git a/Modules/CMakeGenericSystem.cmake b/Modules/CMakeGenericSystem.cmake
index 649b6f7..6e75fac 100644
--- a/Modules/CMakeGenericSystem.cmake
+++ b/Modules/CMakeGenericSystem.cmake
@@ -24,6 +24,12 @@ set(CMAKE_DL_LIBS "dl")
set(CMAKE_FIND_LIBRARY_PREFIXES "lib")
set(CMAKE_FIND_LIBRARY_SUFFIXES ".so" ".a")
+# Define feature "DEFAULT" as supported. This special feature generates the
+# default option to link a library
+# This feature is intended to be used in LINK_LIBRARY_OVERRIDE and
+# LINK_LIBRARY_OVERRIDE_<LIBRARY> target properties
+set(CMAKE_LINK_LIBRARY_USING_DEFAULT_SUPPORTED TRUE)
+
set(CMAKE_AUTOGEN_ORIGIN_DEPENDS ON)
set(CMAKE_AUTOMOC_COMPILER_PREDEFINES ON)
if(NOT DEFINED CMAKE_AUTOMOC_PATH_PREFIX)
diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake
index 6650f7c..5a22be5 100644
--- a/Modules/CPack.cmake
+++ b/Modules/CPack.cmake
@@ -304,14 +304,25 @@ installers. The most commonly-used variables are:
By default ``CPACK_THREADS`` is set to ``1``.
- Currently only ``xz`` compression *may* take advantage of multiple cores.
- Other compression methods ignore this value and use only one thread.
+ The following compression methods may take advantage of multiple cores:
+
+ ``xz``
+ Supported if CMake is built with a ``liblzma`` that supports
+ parallel compression.
+
+ .. versionadded:: 3.21
- .. versionadded:: 3.21
+ Official CMake binaries available on ``cmake.org`` now ship
+ with a ``liblzma`` that supports parallel compression.
+ Older versions did not.
- Official CMake binaries available on ``cmake.org`` now ship
- with a ``liblzma`` that supports parallel compression.
- Older versions did not.
+ ``zstd``
+ .. versionadded:: 3.24
+
+ Supported if CMake is built with libarchive 3.6 or higher.
+ Official CMake binaries available on ``cmake.org`` support it.
+
+ Other compression methods ignore this value and use only one thread.
Variables for Source Package Generators
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/Modules/Compiler/Clang-CUDA.cmake b/Modules/Compiler/Clang-CUDA.cmake
index 219897e..e85ec67 100644
--- a/Modules/Compiler/Clang-CUDA.cmake
+++ b/Modules/Compiler/Clang-CUDA.cmake
@@ -38,3 +38,18 @@ set(CMAKE_CUDA_RUNTIME_LIBRARY_LINK_OPTIONS_NONE "")
if(UNIX)
list(APPEND CMAKE_CUDA_RUNTIME_LIBRARY_LINK_OPTIONS_STATIC "rt" "pthread" "dl")
endif()
+
+if(APPLE)
+ # Defines host link features for frameworks
+ set(CMAKE_CUDA_LINK_LIBRARY_USING_FRAMEWORK "LINKER:-framework,<LIBRARY>")
+ set(CMAKE_CUDA_LINK_LIBRARY_USING_FRAMEWORK_SUPPORTED TRUE)
+
+ set(CMAKE_CUDA_LINK_LIBRARY_USING_NEEDED_FRAMEWORK "LINKER:-needed_framework,<LIBRARY>")
+ set(CMAKE_CUDA_LINK_LIBRARY_USING_NEEDED_FRAMEWORK_SUPPORTED TRUE)
+
+ set(CMAKE_CUDA_LINK_LIBRARY_USING_REEXPORT_FRAMEWORK "LINKER:-reexport_framework,<LIBRARY>")
+ set(CMAKE_CUDA_LINK_LIBRARY_USING_REEXPORT_FRAMEWORK_SUPPORTED TRUE)
+
+ set(CMAKE_CUDA_LINK_LIBRARY_USING_WEAK_FRAMEWORK "LINKER:-weak_framework,<LIBRARY>")
+ set(CMAKE_CUDA_LINK_LIBRARY_USING_WEAK_FRAMEWORK_SUPPORTED TRUE)
+endif()
diff --git a/Modules/Compiler/SunPro-C.cmake b/Modules/Compiler/SunPro-C.cmake
index c98656f..7a406ac 100644
--- a/Modules/Compiler/SunPro-C.cmake
+++ b/Modules/Compiler/SunPro-C.cmake
@@ -33,8 +33,13 @@ foreach(type SHARED_LIBRARY SHARED_MODULE EXE)
set(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Bdynamic")
endforeach()
-set(CMAKE_C_LINKER_WRAPPER_FLAG "-Qoption" "ld" " ")
-set(CMAKE_C_LINKER_WRAPPER_FLAG_SEP ",")
+if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "5.12")
+ set(CMAKE_C_LINKER_WRAPPER_FLAG "-Qoption" "ld" " ")
+ set(CMAKE_C_LINKER_WRAPPER_FLAG_SEP ",")
+else()
+ set(CMAKE_C_LINKER_WRAPPER_FLAG "-Wl,")
+ set(CMAKE_C_LINKER_WRAPPER_FLAG_SEP ",")
+endif()
if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 5.13)
set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c89")
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index 14864d5..292333d 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -353,6 +353,10 @@ External Project Definition
When ``GIT_REMOTE_UPDATE_STRATEGY`` is not present, this is the
default strategy unless the default has been overridden with
``CMAKE_EP_GIT_REMOTE_UPDATE_STRATEGY`` (see below).
+ Note that if the branch specified in ``GIT_TAG`` is different to
+ the upstream branch currently being tracked, it is not safe to
+ perform a rebase. In that situation, ``REBASE`` will silently be
+ treated as ``CHECKOUT`` instead.
``REBASE_CHECKOUT``
Same as ``REBASE`` except if the rebase fails, an annotated tag will
diff --git a/Modules/ExternalProject/gitupdate.cmake.in b/Modules/ExternalProject/gitupdate.cmake.in
index 0de2372..7896f62 100644
--- a/Modules/ExternalProject/gitupdate.cmake.in
+++ b/Modules/ExternalProject/gitupdate.cmake.in
@@ -128,7 +128,7 @@ if(git_update_strategy MATCHES "^REBASE(_CHECKOUT)?$")
else()
execute_process(
- COMMAND "@git_EXECUTABLE@" for-each-ref "--format='%(upstream:short)'" "${current_branch}"
+ COMMAND "@git_EXECUTABLE@" for-each-ref "--format=%(upstream:short)" "${current_branch}"
WORKING_DIRECTORY "@work_dir@"
OUTPUT_VARIABLE upstream_branch
OUTPUT_STRIP_TRAILING_WHITESPACE
diff --git a/Modules/FindThreads.cmake b/Modules/FindThreads.cmake
index 4198374..e4d6cf3 100644
--- a/Modules/FindThreads.cmake
+++ b/Modules/FindThreads.cmake
@@ -164,21 +164,18 @@ if(CMAKE_HAVE_PTHREAD_H)
elseif(CMAKE_CXX_COMPILER_LOADED)
CHECK_CXX_SOURCE_COMPILES("${PTHREAD_C_CXX_TEST_SOURCE}" CMAKE_HAVE_LIBC_PTHREAD)
endif()
-
- # Check for -pthread first if enabled. This is the recommended
- # way, but not backwards compatible as one must also pass -pthread
- # as compiler flag then.
- if(THREADS_PREFER_PTHREAD_FLAG)
- _check_pthreads_flag()
- endif()
-
- if(Threads_FOUND)
- # do nothing, we are done
- elseif(CMAKE_HAVE_LIBC_PTHREAD)
+ if(CMAKE_HAVE_LIBC_PTHREAD)
set(CMAKE_THREAD_LIBS_INIT "")
set(CMAKE_HAVE_THREADS_LIBRARY 1)
set(Threads_FOUND TRUE)
else()
+ # Check for -pthread first if enabled. This is the recommended
+ # way, but not backwards compatible as one must also pass -pthread
+ # as compiler flag then.
+ if (THREADS_PREFER_PTHREAD_FLAG)
+ _check_pthreads_flag()
+ endif ()
+
if(CMAKE_SYSTEM MATCHES "GHS-MULTI")
_check_threads_lib(posix pthread_create CMAKE_HAVE_PTHREADS_CREATE)
endif()
diff --git a/Modules/Internal/CPack/CPackRPM.cmake b/Modules/Internal/CPack/CPackRPM.cmake
index c72bf6d..cd631b8 100644
--- a/Modules/Internal/CPack/CPackRPM.cmake
+++ b/Modules/Internal/CPack/CPackRPM.cmake
@@ -790,7 +790,7 @@ function(cpack_rpm_variable_fallback OUTPUT_VAR_NAME)
set(FALLBACK_VAR_NAMES ${ARGN})
foreach(variable_name IN LISTS FALLBACK_VAR_NAMES)
- if(${variable_name})
+ if(DEFINED ${variable_name})
set(${OUTPUT_VAR_NAME} "${${variable_name}}" PARENT_SCOPE)
break()
endif()
diff --git a/Modules/Platform/Apple-Apple-Swift.cmake b/Modules/Platform/Apple-Apple-Swift.cmake
index 7ca3e36..9f604e8 100644
--- a/Modules/Platform/Apple-Apple-Swift.cmake
+++ b/Modules/Platform/Apple-Apple-Swift.cmake
@@ -1 +1,15 @@
set(CMAKE_Swift_SYSROOT_FLAG "-sdk")
+
+
+# Defines host link features for frameworks
+set(CMAKE_Swift_LINK_LIBRARY_USING_FRAMEWORK "LINKER:-framework,<LIBRARY>")
+set(CMAKE_Swift_LINK_LIBRARY_USING_FRAMEWORK_SUPPORTED TRUE)
+
+set(CMAKE_Swift_LINK_LIBRARY_USING_NEEDED_FRAMEWORK "LINKER:-needed_framework,<LIBRARY>")
+set(CMAKE_Swift_LINK_LIBRARY_USING_NEEDED_FRAMEWORK_SUPPORTED TRUE)
+
+set(CMAKE_Swift_LINK_LIBRARY_USING_REEXPORT_FRAMEWORK "LINKER:-reexport_framework,<LIBRARY>")
+set(CMAKE_Swift_LINK_LIBRARY_USING_REEXPORT_FRAMEWORK_SUPPORTED TRUE)
+
+set(CMAKE_Swift_LINK_LIBRARY_USING_WEAK_FRAMEWORK "LINKER:-weak_framework,<LIBRARY>")
+set(CMAKE_Swift_LINK_LIBRARY_USING_WEAK_FRAMEWORK_SUPPORTED TRUE)
diff --git a/Modules/Platform/Apple-NVIDIA-CUDA.cmake b/Modules/Platform/Apple-NVIDIA-CUDA.cmake
index 35e759a..0b8bbd9 100644
--- a/Modules/Platform/Apple-NVIDIA-CUDA.cmake
+++ b/Modules/Platform/Apple-NVIDIA-CUDA.cmake
@@ -17,3 +17,17 @@ set(CMAKE_SHARED_MODULE_CREATE_CUDA_FLAGS "-shared -Wl,-headerpad_max_install_na
set(CMAKE_CUDA_CREATE_SHARED_LIBRARY "<CMAKE_CUDA_HOST_LINK_LAUNCHER> <CMAKE_SHARED_LIBRARY_CUDA_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CUDA_FLAGS> -o <TARGET> <SONAME_FLAG> <TARGET_INSTALLNAME_DIR><TARGET_SONAME> <OBJECTS> <LINK_LIBRARIES>${__IMPLICIT_LINKS}")
set(CMAKE_CUDA_CREATE_SHARED_MODULE "<CMAKE_CUDA_HOST_LINK_LAUNCHER> <CMAKE_SHARED_LIBRARY_CUDA_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CUDA_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>${__IMPLICIT_LINKS}")
+
+
+# Defines host link features for frameworks
+set(CMAKE_CUDA_LINK_LIBRARY_USING_FRAMEWORK "LINKER:-framework,<LIBRARY>")
+set(CMAKE_CUDA_LINK_LIBRARY_USING_FRAMEWORK_SUPPORTED TRUE)
+
+set(CMAKE_CUDA_LINK_LIBRARY_USING_NEEDED_FRAMEWORK "LINKER:-needed_framework,<LIBRARY>")
+set(CMAKE_CUDA_LINK_LIBRARY_USING_NEEDED_FRAMEWORK_SUPPORTED TRUE)
+
+set(CMAKE_CUDA_LINK_LIBRARY_USING_REEXPORT_FRAMEWORK "LINKER:-reexport_framework,<LIBRARY>")
+set(CMAKE_CUDA_LINK_LIBRARY_USING_REEXPORT_FRAMEWORK_SUPPORTED TRUE)
+
+set(CMAKE_CUDA_LINK_LIBRARY_USING_WEAK_FRAMEWORK "LINKER:-weak_framework,<LIBRARY>")
+set(CMAKE_CUDA_LINK_LIBRARY_USING_WEAK_FRAMEWORK_SUPPORTED TRUE)
diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake
index 839dc81..74411e9 100644
--- a/Modules/Platform/Darwin.cmake
+++ b/Modules/Platform/Darwin.cmake
@@ -106,6 +106,19 @@ foreach(lang C CXX Fortran OBJC OBJCXX)
# Set default framework search path flag for languages known to use a
# preprocessor that may find headers in frameworks.
set(CMAKE_${lang}_FRAMEWORK_SEARCH_FLAG -F)
+
+ # Defines link features for frameworks
+ set(CMAKE_${lang}_LINK_LIBRARY_USING_FRAMEWORK "LINKER:-framework,<LIBRARY>")
+ set(CMAKE_${lang}_LINK_LIBRARY_USING_FRAMEWORK_SUPPORTED TRUE)
+
+ set(CMAKE_${lang}_LINK_LIBRARY_USING_NEEDED_FRAMEWORK "LINKER:-needed_framework,<LIBRARY>")
+ set(CMAKE_${lang}_LINK_LIBRARY_USING_NEEDED_FRAMEWORK_SUPPORTED TRUE)
+
+ set(CMAKE_${lang}_LINK_LIBRARY_USING_REEXPORT_FRAMEWORK "LINKER:-reexport_framework,<LIBRARY>")
+ set(CMAKE_${lang}_LINK_LIBRARY_USING_REEXPORT_FRAMEWORK_SUPPORTED TRUE)
+
+ set(CMAKE_${lang}_LINK_LIBRARY_USING_WEAK_FRAMEWORK "LINKER:-weak_framework,<LIBRARY>")
+ set(CMAKE_${lang}_LINK_LIBRARY_USING_WEAK_FRAMEWORK_SUPPORTED TRUE)
endforeach()
# default to searching for frameworks first
diff --git a/Modules/Platform/GHS-MULTI-Determine.cmake b/Modules/Platform/GHS-MULTI-Determine.cmake
index 96f0162..67464f7 100644
--- a/Modules/Platform/GHS-MULTI-Determine.cmake
+++ b/Modules/Platform/GHS-MULTI-Determine.cmake
@@ -88,8 +88,8 @@ if(_ghs_os_dir AND NOT DEFINED GHS_OS_DIR)
# Select latest? of matching candidates
if(GHS_CANDIDATE_OS_DIRS)
list(SORT GHS_CANDIDATE_OS_DIRS)
- list(GET GHS_CANDIDATE_OS_DIRS -1 GHS_OS_DIR)
- string(CONCAT _ghs_os_dir ${GHS_OS_ROOT} "/" ${GHS_OS_DIR})
+ list(GET GHS_CANDIDATE_OS_DIRS -1 _ghs_os_dir)
+ string(CONCAT _ghs_os_dir ${GHS_OS_ROOT} "/" ${_ghs_os_dir})
endif()
endif()
endif()