summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'Modules')
-rw-r--r--Modules/CMakeCCompiler.cmake.in1
-rw-r--r--Modules/CMakeCCompilerABI.c2
-rw-r--r--Modules/CMakeCUDACompiler.cmake.in1
-rw-r--r--Modules/CMakeCUDACompilerABI.cu2
-rw-r--r--Modules/CMakeCXXCompiler.cmake.in1
-rw-r--r--Modules/CMakeCXXCompilerABI.cpp2
-rw-r--r--Modules/CMakeCompilerABI.h12
-rw-r--r--Modules/CMakeDetermineCCompiler.cmake2
-rw-r--r--Modules/CMakeDetermineCXXCompiler.cmake2
-rw-r--r--Modules/CMakeDetermineCompilerABI.cmake23
-rw-r--r--Modules/CMakeDetermineCompilerId.cmake9
-rw-r--r--Modules/CMakeDetermineOBJCCompiler.cmake2
-rw-r--r--Modules/CMakeDetermineOBJCXXCompiler.cmake2
-rw-r--r--Modules/CMakeOBJCCompiler.cmake.in1
-rw-r--r--Modules/CMakeOBJCCompilerABI.m2
-rw-r--r--Modules/CMakeOBJCXXCompiler.cmake.in1
-rw-r--r--Modules/CMakeOBJCXXCompilerABI.mm2
-rw-r--r--Modules/CTest.cmake17
-rw-r--r--Modules/CheckLanguage.cmake6
-rw-r--r--Modules/CompilerId/Xcode-3.pbxproj.in2
-rw-r--r--Modules/DartConfiguration.tcl.in4
-rw-r--r--Modules/ExternalData.cmake40
-rw-r--r--Modules/FindBLAS.cmake8
-rw-r--r--Modules/FindGTest.cmake93
-rw-r--r--Modules/FindICU.cmake35
-rw-r--r--Modules/FindIntl.cmake44
-rw-r--r--Modules/FindProtobuf.cmake2
-rw-r--r--Modules/FindPython.cmake16
-rw-r--r--Modules/FindPython/Support.cmake25
-rw-r--r--Modules/FindPython2.cmake16
-rw-r--r--Modules/FindPython3.cmake16
-rw-r--r--Modules/FindPythonInterp.cmake2
-rw-r--r--Modules/FindPythonLibs.cmake2
-rw-r--r--Modules/FindRuby.cmake20
-rw-r--r--Modules/FortranCInterface.cmake8
-rw-r--r--Modules/FortranCInterface/Detect.cmake10
-rw-r--r--Modules/GNUInstallDirs.cmake29
-rw-r--r--Modules/Internal/CPack/CPack.NuGet.nuspec.in5
-rw-r--r--Modules/Internal/CPack/CPackNuGet.cmake78
-rw-r--r--Modules/Internal/CPack/NSIS.template.in2
-rw-r--r--Modules/Platform/Android-Clang.cmake48
-rw-r--r--Modules/Platform/Android-Common.cmake12
-rw-r--r--Modules/Platform/Android-Determine.cmake88
-rw-r--r--Modules/Platform/Android-Initialize.cmake14
-rw-r--r--Modules/Platform/Android.cmake68
-rw-r--r--Modules/Platform/Android/Determine-Compiler.cmake12
-rw-r--r--Modules/Platform/Android/abi-arm64-v8a-Clang.cmake3
-rw-r--r--Modules/Platform/Android/abi-armeabi-Clang.cmake3
-rw-r--r--Modules/Platform/Android/abi-armeabi-v6-Clang.cmake3
-rw-r--r--Modules/Platform/Android/abi-armeabi-v7a-Clang.cmake3
-rw-r--r--Modules/Platform/Android/abi-mips-Clang.cmake3
-rw-r--r--Modules/Platform/Android/abi-mips64-Clang.cmake3
-rw-r--r--Modules/Platform/Android/abi-x86-Clang.cmake3
-rw-r--r--Modules/Platform/Android/abi-x86_64-Clang.cmake3
-rw-r--r--Modules/Platform/Windows-Clang.cmake4
-rw-r--r--Modules/TestBigEndian.cmake36
56 files changed, 677 insertions, 176 deletions
diff --git a/Modules/CMakeCCompiler.cmake.in b/Modules/CMakeCCompiler.cmake.in
index eea3f5d..7f73891 100644
--- a/Modules/CMakeCCompiler.cmake.in
+++ b/Modules/CMakeCCompiler.cmake.in
@@ -48,6 +48,7 @@ set(CMAKE_C_LINKER_PREFERENCE 10)
# Save compiler ABI information.
set(CMAKE_C_SIZEOF_DATA_PTR "@CMAKE_C_SIZEOF_DATA_PTR@")
set(CMAKE_C_COMPILER_ABI "@CMAKE_C_COMPILER_ABI@")
+set(CMAKE_C_BYTE_ORDER "@CMAKE_C_BYTE_ORDER@")
set(CMAKE_C_LIBRARY_ARCHITECTURE "@CMAKE_C_LIBRARY_ARCHITECTURE@")
if(CMAKE_C_SIZEOF_DATA_PTR)
diff --git a/Modules/CMakeCCompilerABI.c b/Modules/CMakeCCompilerABI.c
index 08cf39b..f0ee21a 100644
--- a/Modules/CMakeCCompilerABI.c
+++ b/Modules/CMakeCCompilerABI.c
@@ -17,6 +17,8 @@ int main(int argc, char* argv[])
{
int require = 0;
require += info_sizeof_dptr[argc];
+ require += info_byte_order_big_endian[argc];
+ require += info_byte_order_little_endian[argc];
#if defined(ABI_ID)
require += info_abi[argc];
#endif
diff --git a/Modules/CMakeCUDACompiler.cmake.in b/Modules/CMakeCUDACompiler.cmake.in
index 871e18e..d4e6e2e 100644
--- a/Modules/CMakeCUDACompiler.cmake.in
+++ b/Modules/CMakeCUDACompiler.cmake.in
@@ -31,6 +31,7 @@ set(CMAKE_CUDA_LINKER_PREFERENCE_PROPAGATES 1)
set(CMAKE_CUDA_SIZEOF_DATA_PTR "@CMAKE_CUDA_SIZEOF_DATA_PTR@")
set(CMAKE_CUDA_COMPILER_ABI "@CMAKE_CUDA_COMPILER_ABI@")
+set(CMAKE_CUDA_BYTE_ORDER "@CMAKE_CUDA_BYTE_ORDER@")
set(CMAKE_CUDA_LIBRARY_ARCHITECTURE "@CMAKE_CUDA_LIBRARY_ARCHITECTURE@")
if(CMAKE_CUDA_SIZEOF_DATA_PTR)
diff --git a/Modules/CMakeCUDACompilerABI.cu b/Modules/CMakeCUDACompilerABI.cu
index 702a7c5..449a079 100644
--- a/Modules/CMakeCUDACompilerABI.cu
+++ b/Modules/CMakeCUDACompilerABI.cu
@@ -8,6 +8,8 @@ int main(int argc, char* argv[])
{
int require = 0;
require += info_sizeof_dptr[argc];
+ require += info_byte_order_big_endian[argc];
+ require += info_byte_order_little_endian[argc];
#if defined(ABI_ID)
require += info_abi[argc];
#endif
diff --git a/Modules/CMakeCXXCompiler.cmake.in b/Modules/CMakeCXXCompiler.cmake.in
index 09bdc23..a235ebb 100644
--- a/Modules/CMakeCXXCompiler.cmake.in
+++ b/Modules/CMakeCXXCompiler.cmake.in
@@ -60,6 +60,7 @@ set(CMAKE_CXX_LINKER_PREFERENCE_PROPAGATES 1)
# Save compiler ABI information.
set(CMAKE_CXX_SIZEOF_DATA_PTR "@CMAKE_CXX_SIZEOF_DATA_PTR@")
set(CMAKE_CXX_COMPILER_ABI "@CMAKE_CXX_COMPILER_ABI@")
+set(CMAKE_CXX_BYTE_ORDER "@CMAKE_CXX_BYTE_ORDER@")
set(CMAKE_CXX_LIBRARY_ARCHITECTURE "@CMAKE_CXX_LIBRARY_ARCHITECTURE@")
if(CMAKE_CXX_SIZEOF_DATA_PTR)
diff --git a/Modules/CMakeCXXCompilerABI.cpp b/Modules/CMakeCXXCompilerABI.cpp
index 2360534..036b96e 100644
--- a/Modules/CMakeCXXCompilerABI.cpp
+++ b/Modules/CMakeCXXCompilerABI.cpp
@@ -8,6 +8,8 @@ int main(int argc, char* argv[])
{
int require = 0;
require += info_sizeof_dptr[argc];
+ require += info_byte_order_big_endian[argc];
+ require += info_byte_order_little_endian[argc];
#if defined(ABI_ID)
require += info_abi[argc];
#endif
diff --git a/Modules/CMakeCompilerABI.h b/Modules/CMakeCompilerABI.h
index 45532af..c5ce4dd 100644
--- a/Modules/CMakeCompilerABI.h
+++ b/Modules/CMakeCompilerABI.h
@@ -9,6 +9,18 @@ const char info_sizeof_dptr[] = {
/* clang-format on */
};
+/* Byte order. Only one of these will have bytes in the right order. */
+static unsigned short const info_byte_order_big_endian[] = {
+ /* INFO:byte_order string for BIG_ENDIAN */
+ 0x494E, 0x464F, 0x3A62, 0x7974, 0x655F, 0x6F72, 0x6465, 0x725B,
+ 0x4249, 0x475F, 0x454E, 0x4449, 0x414E, 0x5D00, 0x0000
+};
+static unsigned short const info_byte_order_little_endian[] = {
+ /* INFO:byte_order string for LITTLE_ENDIAN */
+ 0x4E49, 0x4F46, 0x623A, 0x7479, 0x5F65, 0x726F, 0x6564, 0x5B72,
+ 0x494C, 0x5454, 0x454C, 0x455F, 0x444E, 0x4149, 0x5D4E, 0x0000
+};
+
/* Application Binary Interface. */
/* Check for (some) ARM ABIs.
diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake
index 2f1b0a3..ae3abe9 100644
--- a/Modules/CMakeDetermineCCompiler.cmake
+++ b/Modules/CMakeDetermineCCompiler.cmake
@@ -111,7 +111,7 @@ if(NOT CMAKE_C_COMPILER_ID_RUN)
# ...
# /path/to/cc ...CompilerIdC/...
# to extract the compiler front-end for the language.
- set(CMAKE_C_COMPILER_ID_TOOL_MATCH_REGEX "\nLd[^\n]*(\n[ \t]+[^\n]*)*\n[ \t]+([^ \t\r\n]+)[^\r\n]*-o[^\r\n]*CompilerIdC/(\\./)?(CompilerIdC.(framework|xctest)/)?CompilerIdC[ \t\n\\\"]")
+ set(CMAKE_C_COMPILER_ID_TOOL_MATCH_REGEX "\nLd[^\n]*(\n[ \t]+[^\n]*)*\n[ \t]+([^ \t\r\n]+)[^\r\n]*-o[^\r\n]*CompilerIdC/(\\./)?(CompilerIdC.(framework|xctest|build/[^ \t\r\n]+)/)?CompilerIdC[ \t\n\\\"]")
set(CMAKE_C_COMPILER_ID_TOOL_MATCH_INDEX 2)
include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake)
diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake
index 2b27476..905eb25 100644
--- a/Modules/CMakeDetermineCXXCompiler.cmake
+++ b/Modules/CMakeDetermineCXXCompiler.cmake
@@ -108,7 +108,7 @@ if(NOT CMAKE_CXX_COMPILER_ID_RUN)
# ...
# /path/to/cc ...CompilerIdCXX/...
# to extract the compiler front-end for the language.
- set(CMAKE_CXX_COMPILER_ID_TOOL_MATCH_REGEX "\nLd[^\n]*(\n[ \t]+[^\n]*)*\n[ \t]+([^ \t\r\n]+)[^\r\n]*-o[^\r\n]*CompilerIdCXX/(\\./)?(CompilerIdCXX.(framework|xctest)/)?CompilerIdCXX[ \t\n\\\"]")
+ set(CMAKE_CXX_COMPILER_ID_TOOL_MATCH_REGEX "\nLd[^\n]*(\n[ \t]+[^\n]*)*\n[ \t]+([^ \t\r\n]+)[^\r\n]*-o[^\r\n]*CompilerIdCXX/(\\./)?(CompilerIdCXX.(framework|xctest|build/[^ \t\r\n]+)/)?CompilerIdCXX[ \t\n\\\"]")
set(CMAKE_CXX_COMPILER_ID_TOOL_MATCH_INDEX 2)
include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake)
diff --git a/Modules/CMakeDetermineCompilerABI.cmake b/Modules/CMakeDetermineCompilerABI.cmake
index 7e5b375..67c42a2a 100644
--- a/Modules/CMakeDetermineCompilerABI.cmake
+++ b/Modules/CMakeDetermineCompilerABI.cmake
@@ -75,12 +75,25 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src)
message(CHECK_PASS "done")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Detecting ${lang} compiler ABI info compiled with the following output:\n${OUTPUT}\n\n")
- file(STRINGS "${BIN}" ABI_STRINGS LIMIT_COUNT 2 REGEX "INFO:[A-Za-z0-9_]+\\[[^]]*\\]")
+ file(STRINGS "${BIN}" ABI_STRINGS LIMIT_COUNT 32 REGEX "INFO:[A-Za-z0-9_]+\\[[^]]*\\]")
+ set(ABI_SIZEOF_DPTR "NOTFOUND")
+ set(ABI_BYTE_ORDER "NOTFOUND")
+ set(ABI_NAME "NOTFOUND")
foreach(info ${ABI_STRINGS})
- if("${info}" MATCHES "INFO:sizeof_dptr\\[0*([^]]*)\\]")
+ if("${info}" MATCHES "INFO:sizeof_dptr\\[0*([^]]*)\\]" AND NOT ABI_SIZEOF_DPTR)
set(ABI_SIZEOF_DPTR "${CMAKE_MATCH_1}")
endif()
- if("${info}" MATCHES "INFO:abi\\[([^]]*)\\]")
+ if("${info}" MATCHES "INFO:byte_order\\[(BIG_ENDIAN|LITTLE_ENDIAN)\\]")
+ set(byte_order "${CMAKE_MATCH_1}")
+ if(ABI_BYTE_ORDER STREQUAL "NOTFOUND")
+ # Tentatively use the value because this is the first occurrence.
+ set(ABI_BYTE_ORDER "${byte_order}")
+ elseif(NOT ABI_BYTE_ORDER STREQUAL "${byte_order}")
+ # Drop value because multiple occurrences do not match.
+ set(ABI_BYTE_ORDER "")
+ endif()
+ endif()
+ if("${info}" MATCHES "INFO:abi\\[([^]]*)\\]" AND NOT ABI_NAME)
set(ABI_NAME "${CMAKE_MATCH_1}")
endif()
endforeach()
@@ -91,6 +104,10 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src)
set(CMAKE_${lang}_SIZEOF_DATA_PTR "${CMAKE_${lang}_SIZEOF_DATA_PTR_DEFAULT}" PARENT_SCOPE)
endif()
+ if(ABI_BYTE_ORDER)
+ set(CMAKE_${lang}_BYTE_ORDER "${ABI_BYTE_ORDER}" PARENT_SCOPE)
+ endif()
+
if(ABI_NAME)
set(CMAKE_${lang}_COMPILER_ABI "${ABI_NAME}" PARENT_SCOPE)
endif()
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index 688e1d8..d907926 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -516,9 +516,16 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS}
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND CMAKE_OSX_SYSROOT MATCHES "^$|[Mm][Aa][Cc][Oo][Ss]")
# When targeting macOS, use only the host architecture.
- set(id_archs [[ARCHS = "$(NATIVE_ARCH_ACTUAL)";]])
+ if (_CMAKE_APPLE_ARCHS_DEFAULT)
+ set(id_archs "ARCHS = \"${_CMAKE_APPLE_ARCHS_DEFAULT}\";")
+ set(id_arch_active "ONLY_ACTIVE_ARCH = NO;")
+ else()
+ set(id_archs [[ARCHS = "$(NATIVE_ARCH_ACTUAL)";]])
+ set(id_arch_active "ONLY_ACTIVE_ARCH = YES;")
+ endif()
else()
set(id_archs "")
+ set(id_arch_active "ONLY_ACTIVE_ARCH = YES;")
endif()
configure_file(${CMAKE_ROOT}/Modules/CompilerId/Xcode-3.pbxproj.in
${id_dir}/CompilerId${lang}.xcodeproj/project.pbxproj @ONLY)
diff --git a/Modules/CMakeDetermineOBJCCompiler.cmake b/Modules/CMakeDetermineOBJCCompiler.cmake
index 709eb25..4b84c8a 100644
--- a/Modules/CMakeDetermineOBJCCompiler.cmake
+++ b/Modules/CMakeDetermineOBJCCompiler.cmake
@@ -112,7 +112,7 @@ if(NOT CMAKE_OBJC_COMPILER_ID_RUN)
# ...
# /path/to/cc ...CompilerIdOBJC/...
# to extract the compiler front-end for the language.
- set(CMAKE_OBJC_COMPILER_ID_TOOL_MATCH_REGEX "\nLd[^\n]*(\n[ \t]+[^\n]*)*\n[ \t]+([^ \t\r\n]+)[^\r\n]*-o[^\r\n]*CompilerIdOBJC/(\\./)?(CompilerIdOBJC.(framework|xctest)/)?CompilerIdOBJC[ \t\n\\\"]")
+ set(CMAKE_OBJC_COMPILER_ID_TOOL_MATCH_REGEX "\nLd[^\n]*(\n[ \t]+[^\n]*)*\n[ \t]+([^ \t\r\n]+)[^\r\n]*-o[^\r\n]*CompilerIdOBJC/(\\./)?(CompilerIdOBJC.(framework|xctest|build/[^ \t\r\n]+)/)?CompilerIdOBJC[ \t\n\\\"]")
set(CMAKE_OBJC_COMPILER_ID_TOOL_MATCH_INDEX 2)
include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake)
diff --git a/Modules/CMakeDetermineOBJCXXCompiler.cmake b/Modules/CMakeDetermineOBJCXXCompiler.cmake
index ffd0091..7403847 100644
--- a/Modules/CMakeDetermineOBJCXXCompiler.cmake
+++ b/Modules/CMakeDetermineOBJCXXCompiler.cmake
@@ -117,7 +117,7 @@ if(NOT CMAKE_OBJCXX_COMPILER_ID_RUN)
# ...
# /path/to/cc ...CompilerIdOBJCXX/...
# to extract the compiler front-end for the language.
- set(CMAKE_OBJCXX_COMPILER_ID_TOOL_MATCH_REGEX "\nLd[^\n]*(\n[ \t]+[^\n]*)*\n[ \t]+([^ \t\r\n]+)[^\r\n]*-o[^\r\n]*CompilerIdOBJCXX/(\\./)?(CompilerIdOBJCXX.(framework|xctest)/)?CompilerIdOBJCXX[ \t\n\\\"]")
+ set(CMAKE_OBJCXX_COMPILER_ID_TOOL_MATCH_REGEX "\nLd[^\n]*(\n[ \t]+[^\n]*)*\n[ \t]+([^ \t\r\n]+)[^\r\n]*-o[^\r\n]*CompilerIdOBJCXX/(\\./)?(CompilerIdOBJCXX.(framework|xctest|build/[^ \t\r\n]+)/)?CompilerIdOBJCXX[ \t\n\\\"]")
set(CMAKE_OBJCXX_COMPILER_ID_TOOL_MATCH_INDEX 2)
include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake)
diff --git a/Modules/CMakeOBJCCompiler.cmake.in b/Modules/CMakeOBJCCompiler.cmake.in
index 1555517..608adce 100644
--- a/Modules/CMakeOBJCCompiler.cmake.in
+++ b/Modules/CMakeOBJCCompiler.cmake.in
@@ -45,6 +45,7 @@ endforeach()
# Save compiler ABI information.
set(CMAKE_OBJC_SIZEOF_DATA_PTR "@CMAKE_OBJC_SIZEOF_DATA_PTR@")
set(CMAKE_OBJC_COMPILER_ABI "@CMAKE_OBJC_COMPILER_ABI@")
+set(CMAKE_OBJC_BYTE_ORDER "@CMAKE_OBJC_BYTE_ORDER@")
set(CMAKE_OBJC_LIBRARY_ARCHITECTURE "@CMAKE_OBJC_LIBRARY_ARCHITECTURE@")
if(CMAKE_OBJC_SIZEOF_DATA_PTR)
diff --git a/Modules/CMakeOBJCCompilerABI.m b/Modules/CMakeOBJCCompilerABI.m
index 8fa8511..0726cd3 100644
--- a/Modules/CMakeOBJCCompilerABI.m
+++ b/Modules/CMakeOBJCCompilerABI.m
@@ -12,6 +12,8 @@ int main(int argc, char *argv[])
{
int require = 0;
require += info_sizeof_dptr[argc];
+ require += info_byte_order_big_endian[argc];
+ require += info_byte_order_little_endian[argc];
#if defined(ABI_ID)
require += info_abi[argc];
#endif
diff --git a/Modules/CMakeOBJCXXCompiler.cmake.in b/Modules/CMakeOBJCXXCompiler.cmake.in
index b6452c4..18eb7ff 100644
--- a/Modules/CMakeOBJCXXCompiler.cmake.in
+++ b/Modules/CMakeOBJCXXCompiler.cmake.in
@@ -55,6 +55,7 @@ set(CMAKE_OBJCXX_LINKER_PREFERENCE_PROPAGATES 1)
# Save compiler ABI information.
set(CMAKE_OBJCXX_SIZEOF_DATA_PTR "@CMAKE_OBJCXX_SIZEOF_DATA_PTR@")
set(CMAKE_OBJCXX_COMPILER_ABI "@CMAKE_OBJCXX_COMPILER_ABI@")
+set(CMAKE_OBJCXX_BYTE_ORDER "@CMAKE_OBJCXX_BYTE_ORDER@")
set(CMAKE_OBJCXX_LIBRARY_ARCHITECTURE "@CMAKE_OBJCXX_LIBRARY_ARCHITECTURE@")
if(CMAKE_OBJCXX_SIZEOF_DATA_PTR)
diff --git a/Modules/CMakeOBJCXXCompilerABI.mm b/Modules/CMakeOBJCXXCompilerABI.mm
index 288a58c..7b9fefc 100644
--- a/Modules/CMakeOBJCXXCompilerABI.mm
+++ b/Modules/CMakeOBJCXXCompilerABI.mm
@@ -12,6 +12,8 @@ int main(int argc, char *argv[])
{
int require = 0;
require += info_sizeof_dptr[argc];
+ require += info_byte_order_big_endian[argc];
+ require += info_byte_order_little_endian[argc];
#if defined(ABI_ID)
require += info_abi[argc];
#endif
diff --git a/Modules/CTest.cmake b/Modules/CTest.cmake
index 8265bd2..a18e85b 100644
--- a/Modules/CTest.cmake
+++ b/Modules/CTest.cmake
@@ -179,12 +179,6 @@ if(BUILD_TESTING)
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Rational Software\\Purify\\Setup;InstallFolder]"
DOC "Path to the memory checking command, used for memory error detection."
)
- find_program(SLURM_SBATCH_COMMAND sbatch DOC
- "Path to the SLURM sbatch executable"
- )
- find_program(SLURM_SRUN_COMMAND srun DOC
- "Path to the SLURM srun executable"
- )
set(MEMORYCHECK_SUPPRESSIONS_FILE "" CACHE FILEPATH
"File that contains suppressions for the memory checker")
find_program(COVERAGE_COMMAND gcov DOC
@@ -194,7 +188,14 @@ if(BUILD_TESTING)
"Extra command line flags to pass to the coverage tool")
# set the site name
- site_name(SITE)
+ if(COMMAND cmake_host_system_information)
+ cmake_host_system_information(RESULT _ctest_hostname QUERY HOSTNAME)
+ set(SITE "${_ctest_hostname}" CACHE STRING "Name of the computer/site where compile is being run")
+ unset(_ctest_hostname)
+ else()
+ # This code path is needed for CMake itself during bootstrap.
+ site_name(SITE)
+ endif()
# set the build name
if(NOT BUILDNAME)
set(DART_COMPILER "${CMAKE_CXX_COMPILER}")
@@ -256,8 +257,6 @@ if(BUILD_TESTING)
MAKECOMMAND
MEMORYCHECK_COMMAND
MEMORYCHECK_SUPPRESSIONS_FILE
- SLURM_SBATCH_COMMAND
- SLURM_SRUN_COMMAND
SITE
SVNCOMMAND
)
diff --git a/Modules/CheckLanguage.cmake b/Modules/CheckLanguage.cmake
index 44387d4..928881c 100644
--- a/Modules/CheckLanguage.cmake
+++ b/Modules/CheckLanguage.cmake
@@ -68,6 +68,11 @@ file(WRITE \"\${CMAKE_CURRENT_BINARY_DIR}/result.cmake\"
else()
set(_D_CMAKE_MAKE_PROGRAM "-DCMAKE_MAKE_PROGRAM:FILEPATH=${CMAKE_MAKE_PROGRAM}")
endif()
+ if(CMAKE_TOOLCHAIN_FILE)
+ set(_D_CMAKE_TOOLCHAIN_FILE "-DCMAKE_TOOLCHAIN_FILE:FILEPATH=${CMAKE_TOOLCHAIN_FILE}")
+ else()
+ set(_D_CMAKE_TOOLCHAIN_FILE "")
+ endif()
execute_process(
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/Check${lang}
COMMAND ${CMAKE_COMMAND} . -G ${CMAKE_GENERATOR}
@@ -75,6 +80,7 @@ file(WRITE \"\${CMAKE_CURRENT_BINARY_DIR}/result.cmake\"
-T "${CMAKE_GENERATOR_TOOLSET}"
${_D_CMAKE_GENERATOR_INSTANCE}
${_D_CMAKE_MAKE_PROGRAM}
+ ${_D_CMAKE_TOOLCHAIN_FILE}
OUTPUT_VARIABLE _cl_output
ERROR_VARIABLE _cl_output
RESULT_VARIABLE _cl_result
diff --git a/Modules/CompilerId/Xcode-3.pbxproj.in b/Modules/CompilerId/Xcode-3.pbxproj.in
index 6fe17e5..aab357a 100644
--- a/Modules/CompilerId/Xcode-3.pbxproj.in
+++ b/Modules/CompilerId/Xcode-3.pbxproj.in
@@ -80,11 +80,11 @@
1DEB928A08733DD80010E9CD = {
isa = XCBuildConfiguration;
buildSettings = {
- ONLY_ACTIVE_ARCH = YES;
CODE_SIGNING_REQUIRED = NO;
CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)";
SYMROOT = .;
@id_archs@
+ @id_arch_active@
@id_toolset@
@id_lang_version@
@id_clang_cxx_library@
diff --git a/Modules/DartConfiguration.tcl.in b/Modules/DartConfiguration.tcl.in
index d318c26..41cb9b7 100644
--- a/Modules/DartConfiguration.tcl.in
+++ b/Modules/DartConfiguration.tcl.in
@@ -83,10 +83,6 @@ MemoryCheckSuppressionFile: @MEMORYCHECK_SUPPRESSIONS_FILE@
CoverageCommand: @COVERAGE_COMMAND@
CoverageExtraFlags: @COVERAGE_EXTRA_FLAGS@
-# Cluster commands
-SlurmBatchCommand: @SLURM_SBATCH_COMMAND@
-SlurmRunCommand: @SLURM_SRUN_COMMAND@
-
# Testing options
# TimeOut is the amount of time in seconds to wait for processes
# to complete during testing. After TimeOut seconds, the
diff --git a/Modules/ExternalData.cmake b/Modules/ExternalData.cmake
index 6fe8685..294167c 100644
--- a/Modules/ExternalData.cmake
+++ b/Modules/ExternalData.cmake
@@ -78,7 +78,8 @@ Module Functions
manage local instances of data files stored externally::
ExternalData_Add_Target(
- <target> # Name of data management target
+ <target> # Name of data management target
+ [SHOW_PROGRESS <ON|OFF>] # Show progress during the download
)
It creates custom commands in the target as necessary to make data
@@ -89,6 +90,11 @@ Module Functions
in one of the paths specified in the ``ExternalData_OBJECT_STORES``
variable.
+ The ``SHOW_PROGRESS`` argument may be passed to suppress progress information
+ during the download of objects. If not provided, it defaults to ``OFF`` for
+ :generator:`Ninja` and :generator:`Ninja Multi-Config` generators and ``ON``
+ otherwise.
+
Typically only one target is needed to manage all external data within
a project. Call this function once at the end of configuration after
all data references have been processed.
@@ -344,6 +350,30 @@ function(ExternalData_add_target target)
endif()
set(_ExternalData_CONFIG_CODE "")
+ cmake_parse_arguments(PARSE_ARGV 1 _ExternalData_add_target
+ ""
+ "SHOW_PROGRESS"
+ "")
+ if (_ExternalData_add_target_UNPARSED_ARGUMENTS)
+ message(AUTHOR_WARNING
+ "Ignoring unrecognized arguments passed to ExternalData_add_target: "
+ "`${_ExternalData_add_target_UNPARSED_ARGUMENTS}`")
+ endif ()
+
+ # Turn `SHOW_PROGRESS` into a boolean
+ if (NOT DEFINED _ExternalData_add_target_SHOW_PROGRESS)
+ # The default setting
+ if (CMAKE_GENERATOR MATCHES "Ninja")
+ set(_ExternalData_add_target_SHOW_PROGRESS OFF)
+ else ()
+ set(_ExternalData_add_target_SHOW_PROGRESS ON)
+ endif ()
+ elseif (_ExternalData_add_target_SHOW_PROGRESS)
+ set(_ExternalData_add_target_SHOW_PROGRESS ON)
+ else ()
+ set(_ExternalData_add_target_SHOW_PROGRESS OFF)
+ endif ()
+
# Store custom script configuration.
foreach(url_template IN LISTS ExternalData_URL_TEMPLATES)
if("${url_template}" MATCHES "^ExternalDataCustomScript://([^/]*)/(.*)$")
@@ -423,6 +453,7 @@ function(ExternalData_add_target target)
COMMAND ${CMAKE_COMMAND} -Drelative_top=${CMAKE_BINARY_DIR}
-Dfile=${file} -Dname=${name}
-DExternalData_ACTION=local
+ -DExternalData_SHOW_PROGRESS=${_ExternalData_add_target_SHOW_PROGRESS}
-DExternalData_CONFIG=${config}
-P ${_ExternalData_SELF}
MAIN_DEPENDENCY "${name}"
@@ -459,6 +490,7 @@ function(ExternalData_add_target target)
COMMAND ${CMAKE_COMMAND} -Drelative_top=${CMAKE_BINARY_DIR}
-Dfile=${file} -Dname=${name} -Dexts=${exts}
-DExternalData_ACTION=fetch
+ -DExternalData_SHOW_PROGRESS=${_ExternalData_add_target_SHOW_PROGRESS}
-DExternalData_CONFIG=${config}
-P ${_ExternalData_SELF}
# Update whenever the object hash changes.
@@ -925,7 +957,11 @@ function(_ExternalData_download_file url file err_var msg_var)
else()
set(absolute_timeout "")
endif()
- file(DOWNLOAD "${url}" "${file}" STATUS status LOG log ${inactivity_timeout} ${absolute_timeout} SHOW_PROGRESS)
+ set(show_progress_args)
+ if (ExternalData_SHOW_PROGRESS)
+ list(APPEND show_progress_args SHOW_PROGRESS)
+ endif ()
+ file(DOWNLOAD "${url}" "${file}" STATUS status LOG log ${inactivity_timeout} ${absolute_timeout} ${show_progress_args})
list(GET status 0 err)
list(GET status 1 msg)
if(err)
diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake
index e4353df..715049b 100644
--- a/Modules/FindBLAS.cmake
+++ b/Modules/FindBLAS.cmake
@@ -586,16 +586,22 @@ if(BLA_VENDOR STREQUAL "OpenBLAS" OR BLA_VENDOR STREQUAL "All")
else()
find_package(Threads REQUIRED)
endif()
+ set(_threadlibs "${CMAKE_THREAD_LIBS_INIT}")
+ if(BLA_STATIC)
+ find_package(OpenMP COMPONENTS C)
+ list(PREPEND _threadlibs "${OpenMP_C_LIBRARIES}")
+ endif()
check_blas_libraries(
BLAS_LIBRARIES
BLAS
sgemm
""
"openblas"
- "${CMAKE_THREAD_LIBS_INIT}"
+ "${_threadlibs}"
""
""
)
+ unset(_threadlibs)
endif()
endif()
diff --git a/Modules/FindGTest.cmake b/Modules/FindGTest.cmake
index 10e31b2..ff50869 100644
--- a/Modules/FindGTest.cmake
+++ b/Modules/FindGTest.cmake
@@ -12,6 +12,15 @@ Imported targets
This module defines the following :prop_tgt:`IMPORTED` targets:
+``GTest::gtest``
+ The Google Test ``gtest`` library, if found; adds Thread::Thread
+ automatically
+``GTest::gtest_main``
+ The Google Test ``gtest_main`` library, if found
+
+For backwards compatibility, this module defines additionally the
+following deprecated :prop_tgt:`IMPORTED` targets:
+
``GTest::GTest``
The Google Test ``gtest`` library, if found; adds Thread::Thread
automatically
@@ -24,7 +33,7 @@ Result variables
This module will set the following variables in your project:
-``GTEST_FOUND``
+``GTest_FOUND``
Found the Google Testing framework
``GTEST_INCLUDE_DIRS``
the directory containing the Google Test headers
@@ -62,7 +71,7 @@ Example usage
find_package(GTest REQUIRED)
add_executable(foo foo.cc)
- target_link_libraries(foo GTest::GTest GTest::Main)
+ target_link_libraries(foo GTest::gtest GTest::gtest_main)
add_test(AllTestsInFoo foo)
@@ -167,8 +176,41 @@ function(__gtest_import_library _target _var _config)
endif()
endfunction()
+function(__gtest_define_backwards_compatible_library_targets)
+ set(GTEST_BOTH_LIBRARIES ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES} PARENT_SCOPE)
+
+ # Add targets mapping the same library names as defined in
+ # older versions of CMake's FindGTest
+ if(NOT TARGET GTest::GTest)
+ add_library(GTest::GTest INTERFACE IMPORTED)
+ target_link_libraries(GTest::GTest INTERFACE GTest::gtest)
+ endif()
+ if(NOT TARGET GTest::Main)
+ add_library(GTest::Main INTERFACE IMPORTED)
+ target_link_libraries(GTest::Main INTERFACE GTest::gtest_main)
+ endif()
+endfunction()
+
#
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+
+# first specifically look for the CMake version of GTest
+find_package(GTest QUIET NO_MODULE)
+
+# if we found the GTest cmake package then we are done, and
+# can print what we found and return.
+if(GTest_FOUND)
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTest HANDLE_COMPONENTS CONFIG_MODE)
+
+ set(GTEST_LIBRARIES GTest::gtest)
+ set(GTEST_MAIN_LIBRARIES GTest::gtest_main)
+
+ __gtest_define_backwards_compatible_library_targets()
+
+ return()
+endif()
+
if(NOT DEFINED GTEST_MSVC_SEARCH)
set(GTEST_MSVC_SEARCH MD)
endif()
@@ -208,8 +250,6 @@ find_path(GTEST_INCLUDE_DIR gtest/gtest.h
)
mark_as_advanced(GTEST_INCLUDE_DIR)
-# Allow GTEST_LIBRARY and GTEST_MAIN_LIBRARY to be set manually, as the
-# locations of the gtest and gtest_main libraries, respectively.
if(NOT GTEST_LIBRARY)
__gtest_find_and_select_library_configurations(GTEST gtest)
endif()
@@ -217,54 +257,43 @@ if(NOT GTEST_MAIN_LIBRARY)
__gtest_find_and_select_library_configurations(GTEST_MAIN gtest_main)
endif()
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTest DEFAULT_MSG GTEST_LIBRARY GTEST_INCLUDE_DIR GTEST_MAIN_LIBRARY)
-if(GTEST_FOUND)
+if(GTest_FOUND)
set(GTEST_INCLUDE_DIRS ${GTEST_INCLUDE_DIR})
__gtest_append_debugs(GTEST_LIBRARIES GTEST_LIBRARY)
__gtest_append_debugs(GTEST_MAIN_LIBRARIES GTEST_MAIN_LIBRARY)
- set(GTEST_BOTH_LIBRARIES ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES})
find_package(Threads QUIET)
- if(NOT TARGET GTest::GTest)
+ if(NOT TARGET GTest::gtest)
__gtest_determine_library_type(GTEST_LIBRARY)
- add_library(GTest::GTest ${GTEST_LIBRARY_TYPE} IMPORTED)
+ add_library(GTest::gtest ${GTEST_LIBRARY_TYPE} IMPORTED)
if(TARGET Threads::Threads)
- set_target_properties(GTest::GTest PROPERTIES
+ set_target_properties(GTest::gtest PROPERTIES
INTERFACE_LINK_LIBRARIES Threads::Threads)
endif()
if(GTEST_LIBRARY_TYPE STREQUAL "SHARED")
- set_target_properties(GTest::GTest PROPERTIES
+ set_target_properties(GTest::gtest PROPERTIES
INTERFACE_COMPILE_DEFINITIONS "GTEST_LINKED_AS_SHARED_LIBRARY=1")
endif()
if(GTEST_INCLUDE_DIRS)
- set_target_properties(GTest::GTest PROPERTIES
+ set_target_properties(GTest::gtest PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${GTEST_INCLUDE_DIRS}")
endif()
- __gtest_import_library(GTest::GTest GTEST_LIBRARY "")
- __gtest_import_library(GTest::GTest GTEST_LIBRARY "RELEASE")
- __gtest_import_library(GTest::GTest GTEST_LIBRARY "DEBUG")
+ __gtest_import_library(GTest::gtest GTEST_LIBRARY "")
+ __gtest_import_library(GTest::gtest GTEST_LIBRARY "RELEASE")
+ __gtest_import_library(GTest::gtest GTEST_LIBRARY "DEBUG")
endif()
- if(NOT TARGET GTest::Main)
+ if(NOT TARGET GTest::gtest_main)
__gtest_determine_library_type(GTEST_MAIN_LIBRARY)
- add_library(GTest::Main ${GTEST_MAIN_LIBRARY_TYPE} IMPORTED)
- set_target_properties(GTest::Main PROPERTIES
- INTERFACE_LINK_LIBRARIES "GTest::GTest")
- __gtest_import_library(GTest::Main GTEST_MAIN_LIBRARY "")
- __gtest_import_library(GTest::Main GTEST_MAIN_LIBRARY "RELEASE")
- __gtest_import_library(GTest::Main GTEST_MAIN_LIBRARY "DEBUG")
+ add_library(GTest::gtest_main ${GTEST_MAIN_LIBRARY_TYPE} IMPORTED)
+ set_target_properties(GTest::gtest_main PROPERTIES
+ INTERFACE_LINK_LIBRARIES "GTest::gtest")
+ __gtest_import_library(GTest::gtest_main GTEST_MAIN_LIBRARY "")
+ __gtest_import_library(GTest::gtest_main GTEST_MAIN_LIBRARY "RELEASE")
+ __gtest_import_library(GTest::gtest_main GTEST_MAIN_LIBRARY "DEBUG")
endif()
- # Add targets mapping the same library names as defined in
- # GTest's CMake package config.
- if(NOT TARGET GTest::gtest)
- add_library(GTest::gtest INTERFACE IMPORTED)
- target_link_libraries(GTest::gtest INTERFACE GTest::GTest)
- endif()
- if(NOT TARGET GTest::gtest_main)
- add_library(GTest::gtest_main INTERFACE IMPORTED)
- target_link_libraries(GTest::gtest_main INTERFACE GTest::Main)
- endif()
+ __gtest_define_backwards_compatible_library_targets()
endif()
diff --git a/Modules/FindICU.cmake b/Modules/FindICU.cmake
index c8b3e1f..fa0cba3 100644
--- a/Modules/FindICU.cmake
+++ b/Modules/FindICU.cmake
@@ -31,7 +31,7 @@ Imported targets::
ICU::<C>
Where ``<C>`` is the name of an ICU component, for example
-``ICU::i18n``.
+``ICU::i18n``; ``<C>`` is lower-case.
ICU programs are reported in::
@@ -54,16 +54,14 @@ ICU programs are reported in::
ICU component libraries are reported in::
- ICU_<C>_FOUND - ON if component was found
- ICU_<C>_LIBRARIES - libraries for component
+ ICU_<C>_FOUND - ON if component was found; ``<C>`` is upper-case.
+ ICU_<C>_LIBRARIES - libraries for component; ``<C>`` is upper-case.
ICU datafiles are reported in::
ICU_MAKEFILE_INC - Makefile.inc
ICU_PKGDATA_INC - pkgdata.inc
-Note that ``<C>`` is the uppercased name of the component.
-
This module reads hints about search results from::
ICU_ROOT - the root of the ICU installation
@@ -73,9 +71,9 @@ ICU_ROOT variable takes precedence.
The following cache variables may also be set::
- ICU_<P>_EXECUTABLE - the path to executable <P>
+ ICU_<P>_EXECUTABLE - the path to executable <P>; ``<P>`` is upper-case.
ICU_INCLUDE_DIR - the directory containing the ICU headers
- ICU_<C>_LIBRARY - the library for component <C>
+ ICU_<C>_LIBRARY - the library for component <C>; ``<C>`` is upper-case.
.. note::
@@ -188,7 +186,8 @@ function(_ICU_FIND)
set(component_cache "ICU_${component_upcase}_LIBRARY")
set(component_cache_release "${component_cache}_RELEASE")
set(component_cache_debug "${component_cache}_DEBUG")
- set(component_found "${component_upcase}_FOUND")
+ set(component_found "ICU_${component_upcase}_FOUND")
+ set(component_found_compat "${component_upcase}_FOUND")
set(component_libnames "icu${component}")
set(component_debug_libnames "icu${component}d")
@@ -250,12 +249,15 @@ function(_ICU_FIND)
mark_as_advanced("${component_cache_release}" "${component_cache_debug}")
if(${component_cache})
set("${component_found}" ON)
+ set("${component_found_compat}" ON)
list(APPEND ICU_LIBRARY "${${component_cache}}")
endif()
mark_as_advanced("${component_found}")
+ mark_as_advanced("${component_found_compat}")
set("${component_cache}" "${${component_cache}}" PARENT_SCOPE)
set("${component_found}" "${${component_found}}" PARENT_SCOPE)
- if(${component_found})
+ set("${component_found_compat}" "${${component_found_compat}}" PARENT_SCOPE)
+ if(component_found OR component_found_compat)
if (ICU_FIND_REQUIRED_${component})
list(APPEND ICU_LIBS_FOUND "${component} (required)")
else()
@@ -346,7 +348,7 @@ if(ICU_FOUND)
set(_ICU_component_cache_release "ICU_${_ICU_component_upcase}_LIBRARY_RELEASE")
set(_ICU_component_cache_debug "ICU_${_ICU_component_upcase}_LIBRARY_DEBUG")
set(_ICU_component_lib "ICU_${_ICU_component_upcase}_LIBRARIES")
- set(_ICU_component_found "${_ICU_component_upcase}_FOUND")
+ set(_ICU_component_found "ICU_${_ICU_component_upcase}_FOUND")
set(_ICU_imported_target "ICU::${_ICU_component}")
if(${_ICU_component_found})
set("${_ICU_component_lib}" "${${_ICU_component_cache}}")
@@ -400,7 +402,7 @@ if(ICU_DEBUG)
foreach(program IN LISTS icu_programs)
string(TOUPPER "${program}" program_upcase)
set(program_lib "ICU_${program_upcase}_EXECUTABLE")
- message(STATUS "${program} program: ${${program_lib}}")
+ message(STATUS "${program} program: ${program_lib}=${${program_lib}}")
unset(program_upcase)
unset(program_lib)
endforeach()
@@ -409,7 +411,7 @@ if(ICU_DEBUG)
string(TOUPPER "${data}" data_upcase)
string(REPLACE "." "_" data_upcase "${data_upcase}")
set(data_lib "ICU_${data_upcase}")
- message(STATUS "${data} data: ${${data_lib}}")
+ message(STATUS "${data} data: ${data_lib}=${${data_lib}}")
unset(data_upcase)
unset(data_lib)
endforeach()
@@ -417,12 +419,15 @@ if(ICU_DEBUG)
foreach(component IN LISTS ICU_FIND_COMPONENTS)
string(TOUPPER "${component}" component_upcase)
set(component_lib "ICU_${component_upcase}_LIBRARIES")
- set(component_found "${component_upcase}_FOUND")
- message(STATUS "${component} library found: ${${component_found}}")
- message(STATUS "${component} library: ${${component_lib}}")
+ set(component_found "ICU_${component_upcase}_FOUND")
+ set(component_found_compat "${component_upcase}_FOUND")
+ message(STATUS "${component} library found: ${component_found}=${${component_found}}")
+ message(STATUS "${component} library found (compat name): ${component_found_compat}=${${component_found_compat}}")
+ message(STATUS "${component} library: ${component_lib}=${${component_lib}}")
unset(component_upcase)
unset(component_lib)
unset(component_found)
+ unset(component_found_compat)
endforeach()
message(STATUS "----------------")
endif()
diff --git a/Modules/FindIntl.cmake b/Modules/FindIntl.cmake
index 1a09a60..d29f554 100644
--- a/Modules/FindIntl.cmake
+++ b/Modules/FindIntl.cmake
@@ -15,11 +15,16 @@ installation in several variables. General variables::
Intl_FOUND - true if the libintl headers and libraries were found
Intl_INCLUDE_DIRS - the directory containing the libintl headers
Intl_LIBRARIES - libintl libraries to be linked
+ Intl::Intl - imported target for Intl
The following cache variables may also be set::
Intl_INCLUDE_DIR - the directory containing the libintl headers
Intl_LIBRARY - the libintl library (if any)
+ Intl_HAVE_GETTEXT_BUILTIN - check if gettext is in the C library
+ Intl_HAVE_DCGETTEXT_BUILTIN - check if dcgettext is in the C library
+ Intl_IS_BUILTIN - whether intl is a part of the C library determined
+ from the result of Intl_HAVE_GETTEXT_BUILTIN and Intl_HAVE_DCGETTEXT_BUILTIN
.. note::
On some platforms, such as Linux with GNU libc, the gettext
@@ -35,6 +40,22 @@ The following cache variables may also be set::
# Written by Roger Leigh <rleigh@codelibre.net>
+include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake)
+include(${CMAKE_CURRENT_LIST_DIR}/CheckSymbolExists.cmake)
+
+# Check if we have libintl is a part of libc
+cmake_push_check_state(RESET)
+set(CMAKE_REQUIRED_QUIET TRUE)
+check_symbol_exists(gettext libintl.h Intl_HAVE_GETTEXT_BUILTIN)
+check_symbol_exists(dcgettext libintl.h Intl_HAVE_DCGETTEXT_BUILTIN) # redundant check
+cmake_pop_check_state()
+
+if(Intl_HAVE_GETTEXT_BUILTIN AND Intl_HAVE_DCGETTEXT_BUILTIN)
+ set(Intl_IS_BUILTIN TRUE)
+else()
+ set(Intl_IS_BUILTIN FALSE)
+endif()
+
# Find include directory
find_path(Intl_INCLUDE_DIR
NAMES "libintl.h"
@@ -42,21 +63,28 @@ find_path(Intl_INCLUDE_DIR
mark_as_advanced(Intl_INCLUDE_DIR)
# Find all Intl libraries
-find_library(Intl_LIBRARY "intl" NAMES_PER_DIR
- DOC "libintl libraries (if not in the C library)")
-mark_as_advanced(Intl_LIBRARY)
+set(Intl_REQUIRED_VARS)
+if(NOT Intl_IS_BUILTIN)
+ find_library(Intl_LIBRARY "intl" "libintl" NAMES_PER_DIR
+ DOC "libintl libraries (if not in the C library)")
+ mark_as_advanced(Intl_LIBRARY)
+ list(APPEND Intl_REQUIRED_VARS Intl_LIBRARY)
+endif()
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Intl
FOUND_VAR Intl_FOUND
- REQUIRED_VARS Intl_INCLUDE_DIR
+ REQUIRED_VARS Intl_INCLUDE_DIR ${Intl_REQUIRED_VARS}
FAIL_MESSAGE "Failed to find Gettext libintl")
+unset(Intl_REQUIRED_VARS)
if(Intl_FOUND)
set(Intl_INCLUDE_DIRS "${Intl_INCLUDE_DIR}")
- if(Intl_LIBRARY)
- set(Intl_LIBRARIES "${Intl_LIBRARY}")
- else()
- unset(Intl_LIBRARIES)
+ set(Intl_LIBRARIES "${Intl_LIBRARY}")
+ if(NOT TARGET Intl::Intl)
+ add_library(Intl::Intl INTERFACE IMPORTED)
+ set_target_properties(Intl::Intl PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${Intl_INCLUDE_DIRS}"
+ INTERFACE_LINK_LIBRARIES "${Intl_LIBRARIES}")
endif()
endif()
diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake
index 4bf54ef..0c9d695 100644
--- a/Modules/FindProtobuf.cmake
+++ b/Modules/FindProtobuf.cmake
@@ -204,7 +204,7 @@ function(protobuf_generate)
foreach(_proto ${protobuf_generate_PROTOS})
get_filename_component(_abs_file ${_proto} ABSOLUTE)
get_filename_component(_abs_dir ${_abs_file} DIRECTORY)
- get_filename_component(_basename ${_proto} NAME_WE)
+ get_filename_component(_basename ${_proto} NAME_WLE)
file(RELATIVE_PATH _rel_dir ${CMAKE_CURRENT_SOURCE_DIR} ${_abs_dir})
set(_possible_rel_dir)
diff --git a/Modules/FindPython.cmake b/Modules/FindPython.cmake
index 5fc6a3b..e842e6b 100644
--- a/Modules/FindPython.cmake
+++ b/Modules/FindPython.cmake
@@ -318,6 +318,22 @@ Hints
``.Net`` interpreter (i.e. ``mono`` command) is expected to be available
through the ``PATH`` variable.
+``Python_FIND_UNVERSIONED_NAMES``
+
+ .. versionadded:: 3.20
+
+ This variable defines how the generic names will be searched. Currently, it
+ only applies to the generic names of the interpreter, namely, ``python3`` or
+ ``python2`` and ``python``.
+ The ``Python_FIND_UNVERSIONED_NAMES`` variable can be set to one of the
+ following values:
+
+ * ``FIRST``: The generic names are searched before the more specialized ones
+ (such as ``python2.5`` for example).
+ * ``LAST``: The generic names are searched after the more specialized ones.
+ This is the default.
+ * ``NEVER``: The generic name are not searched at all.
+
Artifacts Specification
^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/Modules/FindPython/Support.cmake b/Modules/FindPython/Support.cmake
index 028ce08..0e76468 100644
--- a/Modules/FindPython/Support.cmake
+++ b/Modules/FindPython/Support.cmake
@@ -337,6 +337,9 @@ function (_PYTHON_GET_NAMES _PYTHON_PGN_NAMES)
foreach (implementation IN LISTS _PGN_IMPLEMENTATIONS)
if (implementation STREQUAL "CPython")
+ if (_PGN_INTERPRETER AND _${_PYTHON_PREFIX}_FIND_UNVERSIONED_NAMES STREQUAL "FIRST")
+ list (APPEND names python${_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR} python)
+ endif()
foreach (version IN LISTS _PGN_VERSION)
if (_PGN_WIN32)
string (REPLACE "." "" version_no_dots ${version})
@@ -386,7 +389,7 @@ function (_PYTHON_GET_NAMES _PYTHON_PGN_NAMES)
endif()
endif()
endforeach()
- if (_PGN_INTERPRETER)
+ if (_PGN_INTERPRETER AND _${_PYTHON_PREFIX}_FIND_UNVERSIONED_NAMES STREQUAL "LAST")
list (APPEND names python${_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR} python)
endif()
elseif (implementation STREQUAL "IronPython")
@@ -1364,9 +1367,22 @@ else()
endif()
+# Python naming handling
+if (DEFINED ${_PYTHON_PREFIX}_FIND_UNVERSIONED_NAMES)
+ if (NOT ${_PYTHON_PREFIX}_FIND_UNVERSIONED_NAMES MATCHES "^(FIRST|LAST|NEVER)$")
+ message (AUTHOR_WARNING "Find${_PYTHON_PREFIX}: ${_${_PYTHON_PREFIX}_FIND_UNVERSIONED_NAMES}: invalid value for '${_PYTHON_PREFIX}_FIND_UNVERSIONED_NAMES'. 'FIRST', 'LAST' or 'NEVER' expected. 'LAST' will be used instead.")
+ set (_${_PYTHON_PREFIX}_FIND_UNVERSIONED_NAMES LAST)
+ else()
+ set (_${_PYTHON_PREFIX}_FIND_UNVERSIONED_NAMES ${${_PYTHON_PREFIX}_FIND_UNVERSIONED_NAMES})
+ endif()
+else()
+ set (_${_PYTHON_PREFIX}_FIND_UNVERSIONED_NAMES LAST)
+endif()
+
+
# Compute search signature
# This signature will be used to check validity of cached variables on new search
-set (_${_PYTHON_PREFIX}_SIGNATURE "${${_PYTHON_PREFIX}_ROOT_DIR}:${_${_PYTHON_PREFIX}_FIND_IMPLEMENTATIONS}:${_${_PYTHON_PREFIX}_FIND_STRATEGY}:${${_PYTHON_PREFIX}_FIND_VIRTUALENV}")
+set (_${_PYTHON_PREFIX}_SIGNATURE "${${_PYTHON_PREFIX}_ROOT_DIR}:${_${_PYTHON_PREFIX}_FIND_IMPLEMENTATIONS}:${_${_PYTHON_PREFIX}_FIND_STRATEGY}:${${_PYTHON_PREFIX}_FIND_VIRTUALENV}${_${_PYTHON_PREFIX}_FIND_UNVERSIONED_NAMES}")
if (NOT WIN32)
string (APPEND _${_PYTHON_PREFIX}_SIGNATURE ":${${_PYTHON_PREFIX}_USE_STATIC_LIBS}:")
endif()
@@ -2997,8 +3013,9 @@ if (("Development.Module" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
unset(_${_PYTHON_PREFIX}_is_prefix)
foreach (_${_PYTHON_PREFIX}_implementation IN LISTS _${_PYTHON_PREFIX}_FIND_IMPLEMENTATIONS)
foreach (_${_PYTHON_PREFIX}_framework IN LISTS _${_PYTHON_PREFIX}_${_${_PYTHON_PREFIX}_implementation}_FRAMEWORKS)
- if (${_PYTHON_PREFIX}_LIBRARY_RELEASE MATCHES "^${_${_PYTHON_PREFIX}_framework}")
- get_filename_component (_${_PYTHON_PREFIX}_framework "${_${_PYTHON_PREFIX}_framework}" DIRECTORY)
+ cmake_path (IS_PREFIX _${_PYTHON_PREFIX}_framework "${${_PYTHON_PREFIX}_LIBRARY_RELEASE}" _${_PYTHON_PREFIX}_is_prefix)
+ if (_${_PYTHON_PREFIX}_is_prefix)
+ cmake_path (GET _${_PYTHON_PREFIX}_framework PARENT_PATH _${_PYTHON_PREFIX}_framework)
set (${_PYTHON_PREFIX}_LINK_OPTIONS "LINKER:-rpath,${_${_PYTHON_PREFIX}_framework}")
break()
endif()
diff --git a/Modules/FindPython2.cmake b/Modules/FindPython2.cmake
index 9cd22e1..5277e33 100644
--- a/Modules/FindPython2.cmake
+++ b/Modules/FindPython2.cmake
@@ -265,6 +265,22 @@ Hints
``.Net`` interpreter (i.e. ``mono`` command) is expected to be available
through the ``PATH`` variable.
+``Python2_FIND_UNVERSIONED_NAMES``
+
+ .. versionadded:: 3.20
+
+ This variable defines how the generic names will be searched. Currently, it
+ only applies to the generic names of the interpreter, namely, ``python2`` and
+ ``python``.
+ The ``Python2_FIND_UNVERSIONED_NAMES`` variable can be set to one of the
+ following values:
+
+ * ``FIRST``: The generic names are searched before the more specialized ones
+ (such as ``python2.5`` for example).
+ * ``LAST``: The generic names are searched after the more specialized ones.
+ This is the default.
+ * ``NEVER``: The generic name are not searched at all.
+
Artifacts Specification
^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/Modules/FindPython3.cmake b/Modules/FindPython3.cmake
index c79d482..2bd4d76 100644
--- a/Modules/FindPython3.cmake
+++ b/Modules/FindPython3.cmake
@@ -315,6 +315,22 @@ Hints
``.Net`` interpreter (i.e. ``mono`` command) is expected to be available
through the ``PATH`` variable.
+``Python3_FIND_UNVERSIONED_NAMES``
+
+ .. versionadded:: 3.20
+
+ This variable defines how the generic names will be searched. Currently, it
+ only applies to the generic names of the interpreter, namely, ``python3`` and
+ ``python``.
+ The ``Python3_FIND_UNVERSIONED_NAMES`` variable can be set to one of the
+ following values:
+
+ * ``FIRST``: The generic names are searched before the more specialized ones
+ (such as ``python3.5`` for example).
+ * ``LAST``: The generic names are searched after the more specialized ones.
+ This is the default.
+ * ``NEVER``: The generic name are not searched at all.
+
Artifacts Specification
^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/Modules/FindPythonInterp.cmake b/Modules/FindPythonInterp.cmake
index 1e01a99..efe0f11 100644
--- a/Modules/FindPythonInterp.cmake
+++ b/Modules/FindPythonInterp.cmake
@@ -54,7 +54,7 @@ unset(_Python_NAMES)
set(_PYTHON1_VERSIONS 1.6 1.5)
set(_PYTHON2_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0)
-set(_PYTHON3_VERSIONS 3.9 3.8 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
+set(_PYTHON3_VERSIONS 3.10 3.9 3.8 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
if(PythonInterp_FIND_VERSION)
if(PythonInterp_FIND_VERSION_COUNT GREATER 1)
diff --git a/Modules/FindPythonLibs.cmake b/Modules/FindPythonLibs.cmake
index d3ec7be..396f0d2 100644
--- a/Modules/FindPythonLibs.cmake
+++ b/Modules/FindPythonLibs.cmake
@@ -79,7 +79,7 @@ set(CMAKE_FIND_FRAMEWORK LAST)
set(_PYTHON1_VERSIONS 1.6 1.5)
set(_PYTHON2_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0)
-set(_PYTHON3_VERSIONS 3.9 3.8 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
+set(_PYTHON3_VERSIONS 3.10 3.9 3.8 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
if(PythonLibs_FIND_VERSION)
if(PythonLibs_FIND_VERSION_COUNT GREATER 1)
diff --git a/Modules/FindRuby.cmake b/Modules/FindRuby.cmake
index a0cdf3b..d12f825 100644
--- a/Modules/FindRuby.cmake
+++ b/Modules/FindRuby.cmake
@@ -401,6 +401,7 @@ if(Ruby_VERSION_MAJOR)
set(_Ruby_VERSION_SHORT "${Ruby_VERSION_MAJOR}.${Ruby_VERSION_MINOR}")
set(_Ruby_VERSION_SHORT_NODOT "${Ruby_VERSION_MAJOR}${Ruby_VERSION_MINOR}")
set(_Ruby_NODOT_VERSION "${Ruby_VERSION_MAJOR}${Ruby_VERSION_MINOR}${Ruby_VERSION_PATCH}")
+ set(_Ruby_NODOT_VERSION_ZERO_PATCH "${Ruby_VERSION_MAJOR}${Ruby_VERSION_MINOR}0")
endif()
# FIXME: Currently we require both the interpreter and development components to be found
@@ -433,22 +434,27 @@ endif()
set(_Ruby_POSSIBLE_LIB_NAMES ruby ruby-static ruby${_Ruby_VERSION_SHORT} ruby${_Ruby_VERSION_SHORT_NODOT} ruby-${_Ruby_VERSION_SHORT} ruby-${Ruby_VERSION})
if(WIN32)
+ set(_Ruby_POSSIBLE_MSVC_RUNTIMES "msvcrt;vcruntime140;vcruntime140_1")
if(MSVC_TOOLSET_VERSION)
- set(_Ruby_MSVC_RUNTIME "${MSVC_TOOLSET_VERSION}")
+ list(APPEND _Ruby_POSSIBLE_MSVC_RUNTIMES "msvcr${MSVC_TOOLSET_VERSION}")
else()
- set(_Ruby_MSVC_RUNTIME "")
+ list(APPEND _Ruby_POSSIBLE_MSVC_RUNTIMES "msvcr")
endif()
+ set(_Ruby_POSSIBLE_VERSION_SUFFICES "${_Ruby_NODOT_VERSION};${_Ruby_NODOT_VERSION_ZERO_PATCH}")
+
set(_Ruby_ARCH_PREFIX "")
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(_Ruby_ARCH_PREFIX "x64-")
endif()
- list(APPEND _Ruby_POSSIBLE_LIB_NAMES
- "${_Ruby_ARCH_PREFIX}msvcr${_Ruby_MSVC_RUNTIME}-ruby${_Ruby_NODOT_VERSION}"
- "${_Ruby_ARCH_PREFIX}msvcr${_Ruby_MSVC_RUNTIME}-ruby${_Ruby_NODOT_VERSION}-static"
- "${_Ruby_ARCH_PREFIX}msvcrt-ruby${_Ruby_NODOT_VERSION}"
- "${_Ruby_ARCH_PREFIX}msvcrt-ruby${_Ruby_NODOT_VERSION}-static" )
+ foreach(_Ruby_MSVC_RUNTIME ${_Ruby_POSSIBLE_MSVC_RUNTIMES})
+ foreach(_Ruby_VERSION_SUFFIX ${_Ruby_POSSIBLE_VERSION_SUFFICES})
+ list(APPEND _Ruby_POSSIBLE_LIB_NAMES
+ "${_Ruby_ARCH_PREFIX}${_Ruby_MSVC_RUNTIME}-ruby${_Ruby_VERSION_SUFFIX}"
+ "${_Ruby_ARCH_PREFIX}${_Ruby_MSVC_RUNTIME}-ruby${_Ruby_VERSION_SUFFIX}-static")
+ endforeach()
+ endforeach()
endif()
find_library(Ruby_LIBRARY NAMES ${_Ruby_POSSIBLE_LIB_NAMES} HINTS ${Ruby_POSSIBLE_LIB_DIR} )
diff --git a/Modules/FortranCInterface.cmake b/Modules/FortranCInterface.cmake
index 547346b..733c723 100644
--- a/Modules/FortranCInterface.cmake
+++ b/Modules/FortranCInterface.cmake
@@ -343,6 +343,13 @@ function(FortranCInterface_VERIFY)
set(_desc "Verifying Fortran/${lang} Compiler Compatibility")
message(CHECK_START "${_desc}")
+ cmake_policy(GET CMP0056 _FortranCInterface_CMP0056)
+ if(_FortranCInterface_CMP0056 STREQUAL "NEW")
+ set(_FortranCInterface_EXE_LINKER_FLAGS "-DCMAKE_EXE_LINKER_FLAGS:STRING=${CMAKE_EXE_LINKER_FLAGS}")
+ else()
+ set(_FortranCInterface_EXE_LINKER_FLAGS "")
+ endif()
+
# Build a sample project which reports symbols.
set(CMAKE_TRY_COMPILE_CONFIGURATION Release)
try_compile(FortranCInterface_VERIFY_${lang}_COMPILED
@@ -358,6 +365,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}"
+ ${_FortranCInterface_EXE_LINKER_FLAGS}
OUTPUT_VARIABLE _output)
file(WRITE "${FortranCInterface_BINARY_DIR}/Verify${lang}/output.txt" "${_output}")
diff --git a/Modules/FortranCInterface/Detect.cmake b/Modules/FortranCInterface/Detect.cmake
index c75067b..998faf1 100644
--- a/Modules/FortranCInterface/Detect.cmake
+++ b/Modules/FortranCInterface/Detect.cmake
@@ -26,6 +26,14 @@ unset(FortranCInterface_VERIFIED_CXX CACHE)
set(_result)
+cmake_policy(GET CMP0056 _FortranCInterface_CMP0056)
+if(_FortranCInterface_CMP0056 STREQUAL "NEW")
+ set(_FortranCInterface_EXE_LINKER_FLAGS "-DCMAKE_EXE_LINKER_FLAGS:STRING=${CMAKE_EXE_LINKER_FLAGS}")
+else()
+ set(_FortranCInterface_EXE_LINKER_FLAGS "")
+endif()
+unset(_FortranCInterface_CMP0056)
+
# Build a sample project which reports symbols.
set(CMAKE_TRY_COMPILE_CONFIGURATION Release)
try_compile(FortranCInterface_COMPILED
@@ -38,9 +46,11 @@ try_compile(FortranCInterface_COMPILED
"-DCMAKE_Fortran_FLAGS:STRING=${CMAKE_Fortran_FLAGS}"
"-DCMAKE_C_FLAGS_RELEASE:STRING=${CMAKE_C_FLAGS_RELEASE}"
"-DCMAKE_Fortran_FLAGS_RELEASE:STRING=${CMAKE_Fortran_FLAGS_RELEASE}"
+ ${_FortranCInterface_EXE_LINKER_FLAGS}
OUTPUT_VARIABLE FortranCInterface_OUTPUT)
set(FortranCInterface_COMPILED ${FortranCInterface_COMPILED})
unset(FortranCInterface_COMPILED CACHE)
+unset(_FortranCInterface_EXE_LINKER_FLAGS)
# Locate the sample project executable.
set(FortranCInterface_EXE)
diff --git a/Modules/GNUInstallDirs.cmake b/Modules/GNUInstallDirs.cmake
index 13d067a..888f7b1 100644
--- a/Modules/GNUInstallDirs.cmake
+++ b/Modules/GNUInstallDirs.cmake
@@ -113,7 +113,7 @@ Macros
::
- GNUInstallDirs_get_absolute_install_dir(absvar var)
+ GNUInstallDirs_get_absolute_install_dir(absvar var dirname)
Set the given variable ``absvar`` to the absolute path contained
within the variable ``var``. This is to allow the computation of an
@@ -121,7 +121,8 @@ Macros
above. While this macro is used to compute the various
``CMAKE_INSTALL_FULL_<dir>`` variables, it is exposed publicly to
allow users who create additional path variables to also compute
- absolute paths where necessary, using the same logic.
+ absolute paths where necessary, using the same logic. ``dirname`` is
+ the directory name to get, e.g. ``BINDIR``.
#]=======================================================================]
cmake_policy(PUSH)
@@ -334,13 +335,25 @@ mark_as_advanced(
)
macro(GNUInstallDirs_get_absolute_install_dir absvar var)
+ set(GGAID_extra_args ${ARGN})
+ list(LENGTH GGAID_extra_args GGAID_extra_arg_count)
+ if(GGAID_extra_arg_count GREATER 0)
+ list(GET GGAID_extra_args 0 GGAID_dir)
+ else()
+ # Historical behaviour: use ${dir} from caller's scope
+ set(GGAID_dir "${dir}")
+ message(AUTHOR_WARNING
+ "GNUInstallDirs_get_absolute_install_dir called without third argument. "
+ "Using \${dir} from the caller's scope for compatibility with CMake 3.19 and below.")
+ endif()
+
if(NOT IS_ABSOLUTE "${${var}}")
# Handle special cases:
# - CMAKE_INSTALL_PREFIX == /
# - CMAKE_INSTALL_PREFIX == /usr
# - CMAKE_INSTALL_PREFIX == /opt/...
if("${CMAKE_INSTALL_PREFIX}" STREQUAL "/")
- if("${dir}" STREQUAL "SYSCONFDIR" OR "${dir}" STREQUAL "LOCALSTATEDIR" OR "${dir}" STREQUAL "RUNSTATEDIR")
+ if("${GGAID_dir}" STREQUAL "SYSCONFDIR" OR "${GGAID_dir}" STREQUAL "LOCALSTATEDIR" OR "${GGAID_dir}" STREQUAL "RUNSTATEDIR")
set(${absvar} "/${${var}}")
else()
if (NOT "${${var}}" MATCHES "^usr/")
@@ -349,13 +362,13 @@ macro(GNUInstallDirs_get_absolute_install_dir absvar var)
set(${absvar} "/${${var}}")
endif()
elseif("${CMAKE_INSTALL_PREFIX}" MATCHES "^/usr/?$")
- if("${dir}" STREQUAL "SYSCONFDIR" OR "${dir}" STREQUAL "LOCALSTATEDIR" OR "${dir}" STREQUAL "RUNSTATEDIR")
+ if("${GGAID_dir}" STREQUAL "SYSCONFDIR" OR "${GGAID_dir}" STREQUAL "LOCALSTATEDIR" OR "${GGAID_dir}" STREQUAL "RUNSTATEDIR")
set(${absvar} "/${${var}}")
else()
set(${absvar} "${CMAKE_INSTALL_PREFIX}/${${var}}")
endif()
elseif("${CMAKE_INSTALL_PREFIX}" MATCHES "^/opt/.*")
- if("${dir}" STREQUAL "SYSCONFDIR" OR "${dir}" STREQUAL "LOCALSTATEDIR" OR "${dir}" STREQUAL "RUNSTATEDIR")
+ if("${GGAID_dir}" STREQUAL "SYSCONFDIR" OR "${GGAID_dir}" STREQUAL "LOCALSTATEDIR" OR "${GGAID_dir}" STREQUAL "RUNSTATEDIR")
set(${absvar} "/${${var}}${CMAKE_INSTALL_PREFIX}")
else()
set(${absvar} "${CMAKE_INSTALL_PREFIX}/${${var}}")
@@ -366,6 +379,10 @@ macro(GNUInstallDirs_get_absolute_install_dir absvar var)
else()
set(${absvar} "${${var}}")
endif()
+
+ unset(GGAID_dir)
+ unset(GGAID_extra_arg_count)
+ unset(GGAID_extra_args)
endmacro()
# Result directories
@@ -388,7 +405,7 @@ foreach(dir
MANDIR
DOCDIR
)
- GNUInstallDirs_get_absolute_install_dir(CMAKE_INSTALL_FULL_${dir} CMAKE_INSTALL_${dir})
+ GNUInstallDirs_get_absolute_install_dir(CMAKE_INSTALL_FULL_${dir} CMAKE_INSTALL_${dir} ${dir})
endforeach()
cmake_policy(POP)
diff --git a/Modules/Internal/CPack/CPack.NuGet.nuspec.in b/Modules/Internal/CPack/CPack.NuGet.nuspec.in
index b7beb5d..d89d69f 100644
--- a/Modules/Internal/CPack/CPack.NuGet.nuspec.in
+++ b/Modules/Internal/CPack/CPack.NuGet.nuspec.in
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
+<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<!-- Required elements-->
<id>@CPACK_NUGET_PACKAGE_NAME@</id>
@@ -12,11 +12,14 @@
@_CPACK_NUGET_OWNERS_TAG@
@_CPACK_NUGET_PROJECTURL_TAG@
@_CPACK_NUGET_LICENSEURL_TAG@
+ @_CPACK_NUGET_LICENSE_TAG@
@_CPACK_NUGET_ICONURL_TAG@
+ @_CPACK_NUGET_ICON_TAG@
@_CPACK_NUGET_REQUIRELICENSEACCEPTANCE_TAG@
@_CPACK_NUGET_SUMMARY_TAG@
@_CPACK_NUGET_RELEASENOTES_TAG@
@_CPACK_NUGET_COPYRIGHT_TAG@
+ @_CPACK_NUGET_LANGUAGE_TAG@
@_CPACK_NUGET_TAGS_TAG@
@_CPACK_NUGET_DEPENDENCIES_TAG@
</metadata>
diff --git a/Modules/Internal/CPack/CPackNuGet.cmake b/Modules/Internal/CPack/CPackNuGet.cmake
index 20eed2e..56bbffd 100644
--- a/Modules/Internal/CPack/CPackNuGet.cmake
+++ b/Modules/Internal/CPack/CPackNuGet.cmake
@@ -107,21 +107,44 @@ endfunction()
function(_cpack_nuget_variable_fallback_and_wrap_into_element ELEMENT NUGET_VAR_NAME)
set(_options)
set(_one_value_args)
- set(_multi_value_args FALLBACK_VARS)
- cmake_parse_arguments(PARSE_ARGV 0 _args "${_options}" "${_one_value_args}" "${_multi_value_args}")
+ set(_multi_value_args FALLBACK_VARS ATTRIBUTES)
+ cmake_parse_arguments(PARSE_ARGV 2 _args "${_options}" "${_one_value_args}" "${_multi_value_args}")
+
+ if(_args_ATTRIBUTES)
+ list(JOIN _args_ATTRIBUTES " " _attributes)
+ string(PREPEND _attributes " ")
+ endif()
_cpack_nuget_variable_fallback(_value ${NUGET_VAR_NAME} ${ARGN} USE_CDATA)
+ string(TOUPPER "${ELEMENT}" _ELEMENT_UP)
if(_value)
- string(TOUPPER "${ELEMENT}" _ELEMENT_UP)
set(
_CPACK_NUGET_${_ELEMENT_UP}_TAG
- "<${ELEMENT}>${_value}</${ELEMENT}>"
+ "<${ELEMENT}${_attributes}>${_value}</${ELEMENT}>"
+ PARENT_SCOPE
+ )
+ elseif(_attributes)
+ set(
+ _CPACK_NUGET_${_ELEMENT_UP}_TAG
+ "<${ELEMENT}${_attributes} />"
PARENT_SCOPE
)
endif()
endfunction()
+# Warn of obsolete nuspec fields, referencing CMake variables and suggested
+# replacement, if any
+function(_cpack_nuget_deprecation_warning NUGET_ELEMENT VARNAME REPLACEMENT)
+ if(${VARNAME})
+ if(REPLACEMENT)
+ message(DEPRECATION "nuspec element `${NUGET_ELEMENT}` is deprecated in NuGet; consider replacing `${VARNAME}` with `${REPLACEMENT}`")
+ else()
+ message(DEPRECATION "nuspec element `${NUGET_ELEMENT}` is deprecated in NuGet; consider removing `${VARNAME}`")
+ endif()
+ endif()
+endfunction()
+
# Print some debug info
_cpack_nuget_debug("---[CPack NuGet Input Variables]---")
_cpack_nuget_debug_var(CPACK_PACKAGE_NAME)
@@ -168,6 +191,21 @@ function(_cpack_nuget_render_spec)
set(CPACK_NUGET_PACKAGE_NAME "${CPACK_PACKAGE_NAME}")
endif()
+ # Warn about deprecated nuspec elements; warnings only display if
+ # variable is set
+ # Note that while nuspec's "summary" element is deprecated, there
+ # is no suggested replacement so (for now) no deprecation warning
+ # is shown for `CPACK_NUGET_*_DESCRIPTION_SUMMARY`
+ _cpack_nuget_deprecation_warning("licenseUrl" CPACK_NUGET_PACKAGE_LICENSEURL
+ "CPACK_NUGET_PACKAGE_LICENSE_FILE_NAME or CPACK_NUGET_PACKAGE_LICENSE_EXPRESSION")
+ _cpack_nuget_deprecation_warning("licenseUrl" CPACK_NUGET_${CPACK_NUGET_PACKAGE_COMPONENT}_LICENSEURL
+ "CPACK_NUGET_${CPACK_NUGET_PACKAGE_COMPONENT}_LICENSE_FILE_NAME or CPACK_NUGET_${CPACK_NUGET_PACKAGE_COMPONENT}_LICENSE_EXPRESSION")
+ _cpack_nuget_deprecation_warning("iconUrl" CPACK_NUGET_PACKAGE_ICONURL
+ "CPACK_NUGET_PACKAGE_ICON")
+ _cpack_nuget_deprecation_warning("iconUrl" CPACK_NUGET_${CPACK_NUGET_PACKAGE_COMPONENT}_ICONURL
+ "CPACK_NUGET_${CPACK_NUGET_PACKAGE_COMPONENT}_ICON")
+
+ # Set nuspec fields
_cpack_nuget_variable_fallback(
CPACK_NUGET_PACKAGE_VERSION VERSION
FALLBACK_VARS
@@ -207,8 +245,35 @@ function(_cpack_nuget_render_spec)
FALLBACK_VARS
CPACK_PACKAGE_HOMEPAGE_URL
)
+
+ # "licenseUrl" is deprecated in favor of "license"
_cpack_nuget_variable_fallback_and_wrap_into_element(licenseUrl LICENSEURL)
+
+ # "iconUrl" is deprecated in favor of "icon"
_cpack_nuget_variable_fallback_and_wrap_into_element(iconUrl ICONURL)
+
+ # "license" takes a "type" attribute of either "file" or "expression"
+ # "file" refers to a file path of a .txt or .md file relative to the installation root
+ # "expression" refers to simple or compound expression of license identifiers
+ # listed at https://spdx.org/licenses/
+ # Note that only one of CPACK_NUGET_PACKAGE_LICENSE_FILE_NAME and
+ # CPACK_NUGET_PACKAGE_LICENSE_EXPRESSION may be specified. If both are specified,
+ # CPACK_NUGET_PACKAGE_LICENSE_FILE_NAME takes precedence and CPACK_NUGET_PACKAGE_LICENSE_EXPRESSION is ignored.
+ if(CPACK_NUGET_PACKAGE_LICENSE_FILE_NAME)
+ _cpack_nuget_variable_fallback_and_wrap_into_element(
+ license LICENSE_FILE_NAME
+ ATTRIBUTES [[type="file"]]
+ )
+ elseif(CPACK_NUGET_PACKAGE_LICENSE_EXPRESSION)
+ _cpack_nuget_variable_fallback_and_wrap_into_element(
+ license LICENSE_EXPRESSION
+ ATTRIBUTES [[type="expression"]]
+ )
+ endif()
+
+ # "icon" refers to a file path relative to the installation root
+ _cpack_nuget_variable_fallback_and_wrap_into_element(icon ICON)
+ # "summary" is deprecated in favor of "description"
_cpack_nuget_variable_fallback_and_wrap_into_element(
summary DESCRIPTION_SUMMARY
FALLBACK_VARS
@@ -222,7 +287,12 @@ function(_cpack_nuget_render_spec)
endif()
_cpack_nuget_variable_fallback_and_wrap_into_element(releaseNotes RELEASE_NOTES)
_cpack_nuget_variable_fallback_and_wrap_into_element(copyright COPYRIGHT)
+ # "language" is a locale identifier such as "en_CA"
+ _cpack_nuget_variable_fallback_and_wrap_into_element(language LANGUAGE)
_cpack_nuget_variable_fallback_and_wrap_into_element(tags TAGS LIST_GLUE " ")
+ # "repository" holds repository metadata consisting of four optional
+ # attributes: "type", "url", "branch", and "commit". While all fields are
+ # considered optional, they are not independent. Currently unsupported.
# Handle dependencies
_cpack_nuget_variable_fallback(_deps DEPENDENCIES)
diff --git a/Modules/Internal/CPack/NSIS.template.in b/Modules/Internal/CPack/NSIS.template.in
index 6009ce0..b448c76 100644
--- a/Modules/Internal/CPack/NSIS.template.in
+++ b/Modules/Internal/CPack/NSIS.template.in
@@ -1,4 +1,4 @@
-; CPack install script designed for a nmake build
+; CPack install script designed for a nmake build
;--------------------------------
; You must define these values
diff --git a/Modules/Platform/Android-Clang.cmake b/Modules/Platform/Android-Clang.cmake
index 160eada..3a279ca 100644
--- a/Modules/Platform/Android-Clang.cmake
+++ b/Modules/Platform/Android-Clang.cmake
@@ -7,6 +7,23 @@ if(__ANDROID_COMPILER_CLANG)
endif()
set(__ANDROID_COMPILER_CLANG 1)
+# Include the NDK hook.
+# It can be used by NDK to inject necessary fixes for an earlier cmake.
+if(CMAKE_ANDROID_NDK)
+ include(${CMAKE_ANDROID_NDK}/build/cmake/hooks/pre/Android-Clang.cmake OPTIONAL)
+endif()
+
+# Load flags from NDK. This file may provides the following variables:
+# _ANDROID_NDK_INIT_CFLAGS
+# _ANDROID_NDK_INIT_CFLAGS_DEBUG
+# _ANDROID_NDK_INIT_CFLAGS_RELEASE
+# _ANDROID_NDK_INIT_LDFLAGS
+# _ANDROID_NDK_INIT_LDFLAGS_EXE
+if(CMAKE_ANDROID_NDK)
+ include(${CMAKE_ANDROID_NDK}/build/cmake/flags.cmake OPTIONAL
+ RESULT_VARIABLE _INCLUDED_FLAGS)
+endif()
+
# Support for NVIDIA Nsight Tegra Visual Studio Edition was previously
# implemented in the CMake VS IDE generators. Avoid interfering with
# that functionality for now. Later we may try to integrate this.
@@ -34,20 +51,29 @@ endif()
include(Platform/Android-Common)
-# The NDK toolchain configuration files at:
-#
-# <ndk>/[build/core/]toolchains/*-clang*/setup.mk
-#
-# contain logic to set LLVM_TRIPLE for Clang-based toolchains for each target.
-# We need to produce the same target here to produce compatible binaries.
-include(Platform/Android/abi-${CMAKE_ANDROID_ARCH_ABI}-Clang)
+if(_INCLUDED_FLAGS)
+ # NDK provides the flags.
+ set(_ANDROID_ABI_INIT_CFLAGS "${_ANDROID_NDK_INIT_CFLAGS}")
+ set(_ANDROID_ABI_INIT_CFLAGS_DEBUG "${_ANDROID_NDK_INIT_CFLAGS_DEBUG}")
+ set(_ANDROID_ABI_INIT_CFLAGS_RELEASE "${_ANDROID_NDK_INIT_CFLAGS_RELEASE}")
+ set(_ANDROID_ABI_INIT_LDFLAGS "${_ANDROID_NDK_INIT_LDFLAGS}")
+ set(_ANDROID_ABI_INIT_EXE_LDFLAGS "${_ANDROID_NDK_INIT_LDFLAGS_EXE}")
+else()
+ # The NDK toolchain configuration files at:
+ #
+ # <ndk>/[build/core/]toolchains/*-clang*/setup.mk
+ #
+ # contain logic to set LLVM_TRIPLE for Clang-based toolchains for each target.
+ # We need to produce the same target here to produce compatible binaries.
+ include(Platform/Android/abi-${CMAKE_ANDROID_ARCH_ABI}-Clang)
+endif()
macro(__android_compiler_clang lang)
if(NOT "x${lang}" STREQUAL "xASM")
__android_compiler_common(${lang})
endif()
if(NOT CMAKE_${lang}_COMPILER_TARGET)
- set(CMAKE_${lang}_COMPILER_TARGET "${_ANDROID_ABI_CLANG_TARGET}")
+ set(CMAKE_${lang}_COMPILER_TARGET "${CMAKE_ANDROID_ARCH_LLVM_TRIPLE}")
if(CMAKE_ANDROID_NDK_TOOLCHAIN_UNIFIED)
string(APPEND CMAKE_${lang}_COMPILER_TARGET "${CMAKE_SYSTEM_VERSION}")
endif()
@@ -57,3 +83,9 @@ macro(__android_compiler_clang lang)
set(_ANDROID_STL_NOSTDLIBXX 1)
endif()
endmacro()
+
+# Include the NDK hook.
+# It can be used by NDK to inject necessary fixes for an earlier cmake.
+if(CMAKE_ANDROID_NDK)
+ include(${CMAKE_ANDROID_NDK}/build/cmake/hooks/post/Android-Clang.cmake OPTIONAL)
+endif()
diff --git a/Modules/Platform/Android-Common.cmake b/Modules/Platform/Android-Common.cmake
index 581fde4..39da933 100644
--- a/Modules/Platform/Android-Common.cmake
+++ b/Modules/Platform/Android-Common.cmake
@@ -53,6 +53,12 @@ if(CMAKE_ANDROID_STL_TYPE)
set(_ANDROID_STL_RTTI 0)
macro(__android_stl lang)
string(APPEND CMAKE_${lang}_FLAGS_INIT " -stdlib=libstdc++")
+ if(_ANDROID_STL_EXCEPTIONS OR _ANDROID_STL_RTTI)
+ string(APPEND CMAKE_${lang}_STANDARD_LIBRARIES " -lc++abi")
+ if(CMAKE_SYSTEM_VERSION LESS 21)
+ list(APPEND CMAKE_${lang}_STANDARD_LIBRARIES "-landroid_support")
+ endif()
+ endif()
endmacro()
elseif(CMAKE_ANDROID_STL_TYPE STREQUAL "c++_static")
set(_ANDROID_STL_EXCEPTIONS 1)
@@ -81,6 +87,12 @@ if(CMAKE_ANDROID_STL_TYPE)
"Android: STL '${CMAKE_ANDROID_STL_TYPE}' not supported by this NDK."
)
endif()
+ if(DEFINED CMAKE_ANDROID_RTTI)
+ set(_ANDROID_STL_RTTI ${CMAKE_ANDROID_RTTI})
+ endif()
+ if(DEFINED CMAKE_ANDROID_EXCEPTIONS)
+ set(_ANDROID_STL_EXCEPTIONS ${CMAKE_ANDROID_EXCEPTIONS})
+ endif()
elseif(CMAKE_ANDROID_NDK)
macro(__android_stl_inc lang dir req)
diff --git a/Modules/Platform/Android-Determine.cmake b/Modules/Platform/Android-Determine.cmake
index f7d8d13..77e621a 100644
--- a/Modules/Platform/Android-Determine.cmake
+++ b/Modules/Platform/Android-Determine.cmake
@@ -5,6 +5,12 @@
# This module detects platform-wide information about the Android target
# in order to store it in "CMakeSystem.cmake".
+# Include the NDK hook.
+# It can be used by NDK to inject necessary fixes for an earlier cmake.
+if(CMAKE_ANDROID_NDK)
+ include(${CMAKE_ANDROID_NDK}/build/cmake/hooks/pre/Android-Determine.cmake OPTIONAL)
+endif()
+
# Support for NVIDIA Nsight Tegra Visual Studio Edition was previously
# implemented in the CMake VS IDE generators. Avoid interfering with
# that functionality for now.
@@ -202,8 +208,13 @@ if(NOT CMAKE_ANDROID_NDK AND NOT CMAKE_ANDROID_STANDALONE_TOOLCHAIN)
endif()
if(CMAKE_ANDROID_NDK)
- # NDK >= 18 has abis.cmake and platforms.cmake.
+ # NDK >= 18 has platforms.cmake. It provides:
+ # NDK_MIN_PLATFORM_LEVEL
+ # NDK_MAX_PLATFORM_LEVEL
include("${CMAKE_ANDROID_NDK}/build/cmake/platforms.cmake" OPTIONAL RESULT_VARIABLE _INCLUDED_PLATFORMS)
+ # NDK >= 18 has abis.cmake. It provides:
+ # NDK_KNOWN_DEVICE_ABI32S
+ # NDK_KNOWN_DEVICE_ABI64S
include("${CMAKE_ANDROID_NDK}/build/cmake/abis.cmake" OPTIONAL RESULT_VARIABLE _INCLUDED_ABIS)
endif()
@@ -241,32 +252,44 @@ else()
set(CMAKE_ANDROID_NDK_TOOLCHAIN_UNIFIED "")
endif()
+if(_INCLUDED_ABIS)
+ set(_ANDROID_KNOWN_ABIS ${NDK_KNOWN_DEVICE_ABI32S} ${NDK_KNOWN_DEVICE_ABI64S})
+endif()
+
# https://developer.android.com/ndk/guides/abis.html
-set(_ANDROID_ABI_arm64-v8a_PROC "aarch64")
-set(_ANDROID_ABI_arm64-v8a_ARCH "arm64")
-set(_ANDROID_ABI_arm64-v8a_TRIPLE "aarch64-linux-android")
-set(_ANDROID_ABI_armeabi-v7a_PROC "armv7-a")
-set(_ANDROID_ABI_armeabi-v7a_ARCH "arm")
-set(_ANDROID_ABI_armeabi-v7a_TRIPLE "arm-linux-androideabi")
-set(_ANDROID_ABI_armeabi-v6_PROC "armv6")
-set(_ANDROID_ABI_armeabi-v6_ARCH "arm")
-set(_ANDROID_ABI_armeabi-v6_TRIPLE "arm-linux-androideabi")
-set(_ANDROID_ABI_armeabi_PROC "armv5te")
-set(_ANDROID_ABI_armeabi_ARCH "arm")
-set(_ANDROID_ABI_armeabi_TRIPLE "arm-linux-androideabi")
-set(_ANDROID_ABI_mips_PROC "mips")
-set(_ANDROID_ABI_mips_ARCH "mips")
-set(_ANDROID_ABI_mips_TRIPLE "mipsel-linux-android")
-set(_ANDROID_ABI_mips64_PROC "mips64")
-set(_ANDROID_ABI_mips64_ARCH "mips64")
-set(_ANDROID_ABI_mips64_TRIPLE "mips64el-linux-android")
-set(_ANDROID_ABI_x86_PROC "i686")
-set(_ANDROID_ABI_x86_ARCH "x86")
-set(_ANDROID_ABI_x86_TRIPLE "i686-linux-android")
-set(_ANDROID_ABI_x86_64_PROC "x86_64")
-set(_ANDROID_ABI_x86_64_ARCH "x86_64")
-set(_ANDROID_ABI_x86_64_TRIPLE "x86_64-linux-android")
+set(_ANDROID_ABI_arm64-v8a_PROC "aarch64")
+set(_ANDROID_ABI_arm64-v8a_ARCH "arm64")
+set(_ANDROID_ABI_arm64-v8a_TRIPLE "aarch64-linux-android")
+set(_ANDROID_ABI_arm64-v8a_LLVM_TRIPLE "aarch64-none-linux-android")
+set(_ANDROID_ABI_armeabi-v7a_PROC "armv7-a")
+set(_ANDROID_ABI_armeabi-v7a_ARCH "arm")
+set(_ANDROID_ABI_armeabi-v7a_TRIPLE "arm-linux-androideabi")
+set(_ANDROID_ABI_armeabi-v7a_LLVM_TRIPLE "armv7-none-linux-androideabi")
+set(_ANDROID_ABI_armeabi-v6_PROC "armv6")
+set(_ANDROID_ABI_armeabi-v6_ARCH "arm")
+set(_ANDROID_ABI_armeabi-v6_TRIPLE "arm-linux-androideabi")
+set(_ANDROID_ABI_armeabi-v6_LLVM_TRIPLE "armv6-none-linux-androideabi")
+set(_ANDROID_ABI_armeabi_PROC "armv5te")
+set(_ANDROID_ABI_armeabi_ARCH "arm")
+set(_ANDROID_ABI_armeabi_TRIPLE "arm-linux-androideabi")
+set(_ANDROID_ABI_armeabi_LLVM_TRIPLE "armv5te-none-linux-androideabi")
+set(_ANDROID_ABI_mips_PROC "mips")
+set(_ANDROID_ABI_mips_ARCH "mips")
+set(_ANDROID_ABI_mips_TRIPLE "mipsel-linux-android")
+set(_ANDROID_ABI_mips_LLVM_TRIPLE "mipsel-none-linux-android")
+set(_ANDROID_ABI_mips64_PROC "mips64")
+set(_ANDROID_ABI_mips64_ARCH "mips64")
+set(_ANDROID_ABI_mips64_TRIPLE "mips64el-linux-android")
+set(_ANDROID_ABI_mips64_LLVM_TRIPLE "mips64el-none-linux-android")
+set(_ANDROID_ABI_x86_PROC "i686")
+set(_ANDROID_ABI_x86_ARCH "x86")
+set(_ANDROID_ABI_x86_TRIPLE "i686-linux-android")
+set(_ANDROID_ABI_x86_LLVM_TRIPLE "i686-none-linux-android")
+set(_ANDROID_ABI_x86_64_PROC "x86_64")
+set(_ANDROID_ABI_x86_64_ARCH "x86_64")
+set(_ANDROID_ABI_x86_64_TRIPLE "x86_64-linux-android")
+set(_ANDROID_ABI_x86_64_LLVM_TRIPLE "x86_64-none-linux-android")
set(_ANDROID_PROC_aarch64_ARCH_ABI "arm64-v8a")
set(_ANDROID_PROC_armv7-a_ARCH_ABI "armeabi-v7a")
@@ -307,7 +330,7 @@ if(NOT CMAKE_ANDROID_ARCH_ABI)
elseif(_INCLUDED_ABIS)
# Default to the oldest ARM ABI.
foreach(abi armeabi armeabi-v7a arm64-v8a)
- if("${abi}" IN_LIST NDK_DEFAULT_ABIS)
+ if("${abi}" IN_LIST _ANDROID_KNOWN_ABIS)
set(CMAKE_ANDROID_ARCH_ABI "${abi}")
break()
endif()
@@ -353,10 +376,10 @@ if(NOT CMAKE_ANDROID_ARCH_ABI)
endif()
endif()
endif()
-if(_INCLUDED_ABIS AND NOT CMAKE_ANDROID_ARCH_ABI IN_LIST NDK_DEFAULT_ABIS)
+if(_INCLUDED_ABIS AND NOT CMAKE_ANDROID_ARCH_ABI IN_LIST _ANDROID_KNOWN_ABIS)
message(FATAL_ERROR
"Android: ABI '${CMAKE_ANDROID_ARCH_ABI}' is not supported by the NDK.\n"
- "Supported ABIS: ${NDK_DEFAULT_ABIS}."
+ "Supported ABIS: ${_ANDROID_KNOWN_ABIS}."
)
endif()
set(CMAKE_ANDROID_ARCH "${_ANDROID_ABI_${CMAKE_ANDROID_ARCH_ABI}_ARCH}")
@@ -368,6 +391,8 @@ if(_ANDROID_SYSROOT_ARCH AND NOT "x${_ANDROID_SYSROOT_ARCH}" STREQUAL "x${CMAKE_
)
endif()
set(CMAKE_ANDROID_ARCH_TRIPLE "${_ANDROID_ABI_${CMAKE_ANDROID_ARCH_ABI}_TRIPLE}")
+set(CMAKE_ANDROID_ARCH_LLVM_TRIPLE
+ "${_ANDROID_ABI_${CMAKE_ANDROID_ARCH_ABI}_LLVM_TRIPLE}")
# Select a processor.
if(NOT CMAKE_SYSTEM_PROCESSOR)
@@ -482,6 +507,7 @@ set(CMAKE_ANDROID_ARCH_ABI \"${CMAKE_ANDROID_ARCH_ABI}\")
if(CMAKE_ANDROID_NDK)
string(APPEND CMAKE_SYSTEM_CUSTOM_CODE
"set(CMAKE_ANDROID_ARCH_TRIPLE \"${CMAKE_ANDROID_ARCH_TRIPLE}\")\n"
+ "set(CMAKE_ANDROID_ARCH_LLVM_TRIPLE \"${CMAKE_ANDROID_ARCH_LLVM_TRIPLE}\")\n"
"set(CMAKE_ANDROID_NDK_DEPRECATED_HEADERS \"${CMAKE_ANDROID_NDK_DEPRECATED_HEADERS}\")\n"
"set(CMAKE_ANDROID_NDK_TOOLCHAIN_HOST_TAG \"${CMAKE_ANDROID_NDK_TOOLCHAIN_HOST_TAG}\")\n"
"set(CMAKE_ANDROID_NDK_TOOLCHAIN_UNIFIED \"${CMAKE_ANDROID_NDK_TOOLCHAIN_UNIFIED}\")\n"
@@ -519,3 +545,9 @@ endif()
message(STATUS "Android: Targeting API '${CMAKE_SYSTEM_VERSION}' with architecture '${CMAKE_ANDROID_ARCH}', ABI '${CMAKE_ANDROID_ARCH_ABI}', and processor '${CMAKE_SYSTEM_PROCESSOR}'")
cmake_policy(POP)
+
+# Include the NDK hook.
+# It can be used by NDK to inject necessary fixes for an earlier cmake.
+if(CMAKE_ANDROID_NDK)
+ include(${CMAKE_ANDROID_NDK}/build/cmake/hooks/post/Android-Determine.cmake OPTIONAL)
+endif()
diff --git a/Modules/Platform/Android-Initialize.cmake b/Modules/Platform/Android-Initialize.cmake
index 5019c28..6116ae1 100644
--- a/Modules/Platform/Android-Initialize.cmake
+++ b/Modules/Platform/Android-Initialize.cmake
@@ -4,6 +4,12 @@
# When CMAKE_SYSTEM_NAME is "Android", CMakeSystemSpecificInitialize loads this
# module.
+# Include the NDK hook.
+# It can be used by NDK to inject necessary fixes for an earlier cmake.
+if(CMAKE_ANDROID_NDK)
+ include(${CMAKE_ANDROID_NDK}/build/cmake/hooks/pre/Android-Initialize.cmake OPTIONAL)
+endif()
+
# Support for NVIDIA Nsight Tegra Visual Studio Edition was previously
# implemented in the CMake VS IDE generators. Avoid interfering with
# that functionality for now.
@@ -17,7 +23,7 @@ if(CMAKE_SYSTEM_VERSION EQUAL 1)
return()
endif()
-set(CMAKE_BUILD_TYPE_INIT Debug)
+set(CMAKE_BUILD_TYPE_INIT "RelWithDebInfo")
# Skip sysroot selection if the NDK has a unified toolchain.
if(CMAKE_ANDROID_NDK_TOOLCHAIN_UNIFIED)
@@ -53,3 +59,9 @@ else()
"Android: No CMAKE_SYSROOT was selected."
)
endif()
+
+# Include the NDK hook.
+# It can be used by NDK to inject necessary fixes for an earlier cmake.
+if(CMAKE_ANDROID_NDK)
+ include(${CMAKE_ANDROID_NDK}/build/cmake/hooks/post/Android-Initialize.cmake OPTIONAL)
+endif()
diff --git a/Modules/Platform/Android.cmake b/Modules/Platform/Android.cmake
index 8ffa1b2..e4b9a09 100644
--- a/Modules/Platform/Android.cmake
+++ b/Modules/Platform/Android.cmake
@@ -1,3 +1,9 @@
+# Include the NDK hook.
+# It can be used by NDK to inject necessary fixes for an earlier cmake.
+if(CMAKE_ANDROID_NDK)
+ include(${CMAKE_ANDROID_NDK}/build/cmake/hooks/pre/Android.cmake OPTIONAL)
+endif()
+
include(Platform/Linux)
set(ANDROID 1)
@@ -22,3 +28,65 @@ set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "")
if(CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android")
set(CMAKE_LINK_LIBRARY_FLAG "")
endif()
+
+# Commonly used Android toolchain files that pre-date CMake upstream support
+# set CMAKE_SYSTEM_VERSION to 1. Avoid interfering with them.
+if(CMAKE_SYSTEM_VERSION EQUAL 1)
+ return()
+endif()
+
+if(CMAKE_ANDROID_NDK_TOOLCHAIN_UNIFIED)
+ # Tell CMake not to search host sysroots for headers/libraries.
+
+ # All paths added to CMAKE_SYSTEM_*_PATH below will be rerooted under
+ # CMAKE_FIND_ROOT_PATH. This is set because:
+ # 1. Users may structure their libraries in a way similar to NDK. When they do that,
+ # they can simply append another path to CMAKE_FIND_ROOT_PATH.
+ # 2. CMAKE_FIND_ROOT_PATH must be non-empty for CMAKE_FIND_ROOT_PATH_MODE_* == ONLY
+ # to be meaningful. https://github.com/android-ndk/ndk/issues/890
+ list(APPEND CMAKE_FIND_ROOT_PATH "${CMAKE_ANDROID_NDK_TOOLCHAIN_UNIFIED}/sysroot")
+
+ # Allow users to override these values in case they want more strict behaviors.
+ # For example, they may want to prevent the NDK's libz from being picked up so
+ # they can use their own.
+ # https://github.com/android-ndk/ndk/issues/517
+ if(NOT DEFINED CMAKE_FIND_ROOT_PATH_MODE_PROGRAM)
+ set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+ endif()
+
+ if(NOT DEFINED CMAKE_FIND_ROOT_PATH_MODE_LIBRARY)
+ set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+ endif()
+
+ if(NOT DEFINED CMAKE_FIND_ROOT_PATH_MODE_INCLUDE)
+ set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
+ endif()
+
+ if(NOT DEFINED CMAKE_FIND_ROOT_PATH_MODE_PACKAGE)
+ set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
+ endif()
+
+ # Don't search paths in PATH environment variable.
+ if(NOT DEFINED CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH)
+ set(CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH OFF)
+ endif()
+
+ # Allows CMake to find headers in the architecture-specific include directories.
+ set(CMAKE_LIBRARY_ARCHITECTURE "${CMAKE_ANDROID_ARCH_TRIPLE}")
+
+ # Instructs CMake to search the correct API level for libraries.
+ # Besides the paths like <root>/<prefix>/lib/<arch>, cmake also searches <root>/<prefix>.
+ # So we can add the API level specific directory directly.
+ # https://github.com/android/ndk/issues/929
+ list(PREPEND CMAKE_SYSTEM_PREFIX_PATH
+ "/usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}/${CMAKE_SYSTEM_VERSION}"
+ )
+
+ list(APPEND CMAKE_SYSTEM_PROGRAM_PATH "${CMAKE_ANDROID_NDK_TOOLCHAIN_UNIFIED}/bin")
+endif()
+
+# Include the NDK hook.
+# It can be used by NDK to inject necessary fixes for an earlier cmake.
+if(CMAKE_ANDROID_NDK)
+ include(${CMAKE_ANDROID_NDK}/build/cmake/hooks/post/Android.cmake OPTIONAL)
+endif()
diff --git a/Modules/Platform/Android/Determine-Compiler.cmake b/Modules/Platform/Android/Determine-Compiler.cmake
index f9c2d89..f8eae62 100644
--- a/Modules/Platform/Android/Determine-Compiler.cmake
+++ b/Modules/Platform/Android/Determine-Compiler.cmake
@@ -7,6 +7,12 @@ if(__ANDROID_DETERMINE_COMPILER)
endif()
set(__ANDROID_DETERMINE_COMPILER 1)
+# Include the NDK hook.
+# It can be used by NDK to inject necessary fixes for an earlier cmake.
+if(CMAKE_ANDROID_NDK)
+ include(${CMAKE_ANDROID_NDK}/build/cmake/hooks/pre/Determine-Compiler.cmake OPTIONAL)
+endif()
+
# Support for NVIDIA Nsight Tegra Visual Studio Edition was previously
# implemented in the CMake VS IDE generators. Avoid interfering with
# that functionality for now. Later we may try to integrate this.
@@ -83,3 +89,9 @@ set(CMAKE_${lang}_ANDROID_TOOLCHAIN_SUFFIX \"${_ANDROID_TOOL_${lang}_TOOLCHAIN_S
")
endif()
endmacro()
+
+# Include the NDK hook.
+# It can be used by NDK to inject necessary fixes for an earlier cmake.
+if(CMAKE_ANDROID_NDK)
+ include(${CMAKE_ANDROID_NDK}/build/cmake/hooks/post/Determine-Compiler.cmake OPTIONAL)
+endif()
diff --git a/Modules/Platform/Android/abi-arm64-v8a-Clang.cmake b/Modules/Platform/Android/abi-arm64-v8a-Clang.cmake
index f4717d5..c18c0a2 100644
--- a/Modules/Platform/Android/abi-arm64-v8a-Clang.cmake
+++ b/Modules/Platform/Android/abi-arm64-v8a-Clang.cmake
@@ -1,6 +1,3 @@
-# <ndk>/build/core/toolchains/aarch64-linux-android-clang/setup.mk
-set(_ANDROID_ABI_CLANG_TARGET "aarch64-none-linux-android")
-
# Suppress -Wl,-z,nocopyreloc flag on arm64-v8a
set(_ANDROID_ABI_INIT_EXE_LDFLAGS_NO_nocopyreloc 1)
diff --git a/Modules/Platform/Android/abi-armeabi-Clang.cmake b/Modules/Platform/Android/abi-armeabi-Clang.cmake
index b857bd3..2b1de03 100644
--- a/Modules/Platform/Android/abi-armeabi-Clang.cmake
+++ b/Modules/Platform/Android/abi-armeabi-Clang.cmake
@@ -1,6 +1,3 @@
-# <ndk>/build/core/toolchains/arm-linux-androideabi-clang/setup.mk
-set(_ANDROID_ABI_CLANG_TARGET "armv5te-none-linux-androideabi")
-
string(APPEND _ANDROID_ABI_INIT_CFLAGS
" -march=armv5te"
)
diff --git a/Modules/Platform/Android/abi-armeabi-v6-Clang.cmake b/Modules/Platform/Android/abi-armeabi-v6-Clang.cmake
index a7412f5..bb176ae 100644
--- a/Modules/Platform/Android/abi-armeabi-v6-Clang.cmake
+++ b/Modules/Platform/Android/abi-armeabi-v6-Clang.cmake
@@ -1,6 +1,3 @@
-# <ndk>/build/core/toolchains/arm-linux-androideabi-clang/setup.mk
-set(_ANDROID_ABI_CLANG_TARGET "armv6-none-linux-androideabi")
-
string(APPEND _ANDROID_ABI_INIT_CFLAGS
" -march=armv6"
)
diff --git a/Modules/Platform/Android/abi-armeabi-v7a-Clang.cmake b/Modules/Platform/Android/abi-armeabi-v7a-Clang.cmake
index e2ab58b..6feeef6 100644
--- a/Modules/Platform/Android/abi-armeabi-v7a-Clang.cmake
+++ b/Modules/Platform/Android/abi-armeabi-v7a-Clang.cmake
@@ -1,6 +1,3 @@
-# <ndk>/build/core/toolchains/arm-linux-androideabi-clang/setup.mk
-set(_ANDROID_ABI_CLANG_TARGET "armv7-none-linux-androideabi")
-
string(APPEND _ANDROID_ABI_INIT_CFLAGS
" -march=armv7-a"
)
diff --git a/Modules/Platform/Android/abi-mips-Clang.cmake b/Modules/Platform/Android/abi-mips-Clang.cmake
index 73addde..7df6a36 100644
--- a/Modules/Platform/Android/abi-mips-Clang.cmake
+++ b/Modules/Platform/Android/abi-mips-Clang.cmake
@@ -1,4 +1 @@
-# <ndk>/build/core/toolchains/mipsel-linux-android-clang/setup.mk
-set(_ANDROID_ABI_CLANG_TARGET "mipsel-none-linux-android")
-
include(Platform/Android/abi-common-Clang)
diff --git a/Modules/Platform/Android/abi-mips64-Clang.cmake b/Modules/Platform/Android/abi-mips64-Clang.cmake
index 603f1b2..7df6a36 100644
--- a/Modules/Platform/Android/abi-mips64-Clang.cmake
+++ b/Modules/Platform/Android/abi-mips64-Clang.cmake
@@ -1,4 +1 @@
-# <ndk>/build/core/toolchains/mips64el-linux-android-clang/setup.mk
-set(_ANDROID_ABI_CLANG_TARGET "mips64el-none-linux-android")
-
include(Platform/Android/abi-common-Clang)
diff --git a/Modules/Platform/Android/abi-x86-Clang.cmake b/Modules/Platform/Android/abi-x86-Clang.cmake
index fe7eace..7df6a36 100644
--- a/Modules/Platform/Android/abi-x86-Clang.cmake
+++ b/Modules/Platform/Android/abi-x86-Clang.cmake
@@ -1,4 +1 @@
-# <ndk>/build/core/toolchains/x86-clang/setup.mk
-set(_ANDROID_ABI_CLANG_TARGET "i686-none-linux-android")
-
include(Platform/Android/abi-common-Clang)
diff --git a/Modules/Platform/Android/abi-x86_64-Clang.cmake b/Modules/Platform/Android/abi-x86_64-Clang.cmake
index 3cbcd49..7df6a36 100644
--- a/Modules/Platform/Android/abi-x86_64-Clang.cmake
+++ b/Modules/Platform/Android/abi-x86_64-Clang.cmake
@@ -1,4 +1 @@
-# <ndk>/build/core/toolchains/x86_64-clang/setup.mk
-set(_ANDROID_ABI_CLANG_TARGET "x86_64-none-linux-android")
-
include(Platform/Android/abi-common-Clang)
diff --git a/Modules/Platform/Windows-Clang.cmake b/Modules/Platform/Windows-Clang.cmake
index 2261c90..6275043 100644
--- a/Modules/Platform/Windows-Clang.cmake
+++ b/Modules/Platform/Windows-Clang.cmake
@@ -112,7 +112,9 @@ macro(__enable_llvm_rc_preprocessing clang_option_prefix)
endif()
if(DEFINED CMAKE_RC_PREPROCESSOR)
set(CMAKE_DEPFILE_FLAGS_RC "${clang_option_prefix}-MD ${clang_option_prefix}-MF ${clang_option_prefix}<DEPFILE>")
- set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_COMMAND> -E cmake_llvm_rc <SOURCE> <OBJECT>.pp <${CMAKE_RC_PREPROCESSOR}> <DEFINES> -DRC_INVOKED <INCLUDES> <FLAGS> -E -- <SOURCE> ++ <CMAKE_RC_COMPILER> <DEFINES> -I <SOURCE_DIR> <INCLUDES> /fo <OBJECT> <OBJECT>.pp")
+ # The <FLAGS> are passed to the preprocess and the resource compiler to pick
+ # up the eventual -D / -C options passed through the CMAKE_RC_FLAGS.
+ set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_COMMAND> -E cmake_llvm_rc <SOURCE> <OBJECT>.pp <${CMAKE_RC_PREPROCESSOR}> <DEFINES> -DRC_INVOKED <INCLUDES> <FLAGS> -E -- <SOURCE> ++ <CMAKE_RC_COMPILER> <DEFINES> -I <SOURCE_DIR> <INCLUDES> <FLAGS> /fo <OBJECT> <OBJECT>.pp")
if(CMAKE_GENERATOR MATCHES "Ninja")
set(CMAKE_NINJA_CMCLDEPS_RC 0)
set(CMAKE_NINJA_DEP_TYPE_RC gcc)
diff --git a/Modules/TestBigEndian.cmake b/Modules/TestBigEndian.cmake
index 8a769b7..ea8ca73 100644
--- a/Modules/TestBigEndian.cmake
+++ b/Modules/TestBigEndian.cmake
@@ -5,19 +5,41 @@
TestBigEndian
-------------
-Define macro to determine endian type
+.. deprecated:: 3.20
-Check if the system is big endian or little endian
+ Supserseded by the :variable:`CMAKE_<LANG>_BYTE_ORDER` variable.
-::
+Check if the target architecture is big endian or little endian.
+
+.. command:: test_big_endian
+
+ .. code-block:: cmake
+
+ test_big_endian(<var>)
+
+ Stores in variable ``<var>`` either 1 or 0 indicating whether the
+ target architecture is big or little endian.
- TEST_BIG_ENDIAN(VARIABLE)
- VARIABLE - variable to store the result to
#]=======================================================================]
+include_guard()
include(CheckTypeSize)
-macro(TEST_BIG_ENDIAN VARIABLE)
+function(TEST_BIG_ENDIAN VARIABLE)
+ if(";${CMAKE_C_BYTE_ORDER};${CMAKE_CXX_BYTE_ORDER};${CMAKE_CUDA_BYTE_ORDER};${CMAKE_OBJC_BYTE_ORDER};${CMAKE_OBJCXX_BYTE_ORDER};" MATCHES ";(BIG_ENDIAN|LITTLE_ENDIAN);")
+ set(order "${CMAKE_MATCH_1}")
+ if(order STREQUAL "BIG_ENDIAN")
+ set("${VARIABLE}" 1 PARENT_SCOPE)
+ else()
+ set("${VARIABLE}" 0 PARENT_SCOPE)
+ endif()
+ else()
+ __TEST_BIG_ENDIAN_LEGACY_IMPL(is_big)
+ set("${VARIABLE}" "${is_big}" PARENT_SCOPE)
+ endif()
+endfunction()
+
+macro(__TEST_BIG_ENDIAN_LEGACY_IMPL VARIABLE)
if(NOT DEFINED HAVE_${VARIABLE})
message(CHECK_START "Check if the system is big endian")
message(CHECK_START "Searching 16 bit integer")
@@ -119,5 +141,3 @@ macro(TEST_BIG_ENDIAN VARIABLE)
endif()
endif()
endmacro()
-
-