summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'Modules')
-rw-r--r--Modules/CMakeCCompilerId.c.in2
-rw-r--r--Modules/CMakeCXXCompilerId.cpp.in2
-rw-r--r--Modules/CMakeCompilerIdDetection.cmake1
-rw-r--r--Modules/CMakeDetermineCUDACompiler.cmake73
-rw-r--r--Modules/Compiler/IAR-CXX.cmake9
-rw-r--r--Modules/Compiler/IBMClang-ASM.cmake5
-rw-r--r--Modules/Compiler/IBMClang-C-DetermineCompiler.cmake8
-rw-r--r--Modules/Compiler/IBMClang-C.cmake30
-rw-r--r--Modules/Compiler/IBMClang-CXX-DetermineCompiler.cmake8
-rw-r--r--Modules/Compiler/IBMClang-CXX.cmake39
-rw-r--r--Modules/Compiler/IBMClang.cmake79
-rw-r--r--Modules/ExternalProject.cmake373
-rw-r--r--Modules/ExternalProject/RepositoryInfo.txt.in (renamed from Modules/RepositoryInfo.txt.in)0
-rw-r--r--Modules/ExternalProject/cfgcmd.txt.in1
-rw-r--r--Modules/ExternalProject/download.cmake.in (renamed from Modules/ExternalProject-download.cmake.in)0
-rw-r--r--Modules/ExternalProject/extractfile.cmake.in65
-rw-r--r--Modules/ExternalProject/gitclone.cmake.in73
-rw-r--r--Modules/ExternalProject/gitupdate.cmake.in (renamed from Modules/ExternalProject-gitupdate.cmake.in)0
-rw-r--r--Modules/ExternalProject/hgclone.cmake.in49
-rw-r--r--Modules/ExternalProject/mkdirs.cmake.in19
-rw-r--r--Modules/ExternalProject/verify.cmake.in (renamed from Modules/ExternalProject-verify.cmake.in)0
-rw-r--r--Modules/FindCUDA.cmake4
-rw-r--r--Modules/FindCUDAToolkit.cmake4
-rw-r--r--Modules/FindMPI/test_mpi.c2
-rw-r--r--Modules/FindOpenSSL.cmake6
-rw-r--r--Modules/FindXercesC.cmake2
-rw-r--r--Modules/GenerateExportHeader.cmake2
-rw-r--r--Modules/Platform/AIX-IBMClang-C.cmake2
-rw-r--r--Modules/Platform/AIX-IBMClang-CXX.cmake3
-rw-r--r--Modules/Platform/AIX-IBMClang.cmake16
30 files changed, 600 insertions, 277 deletions
diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in
index 30ad9824..0cb8724 100644
--- a/Modules/CMakeCCompilerId.c.in
+++ b/Modules/CMakeCCompilerId.c.in
@@ -61,7 +61,7 @@ const char* info_language_standard_default =
const char* info_language_extensions_default = "INFO" ":" "extensions_default["
/* !defined(_MSC_VER) to exclude Clang's MSVC compatibility mode. */
-#if (defined(__clang__) || defined(__GNUC__) || \
+#if (defined(__clang__) || defined(__GNUC__) || defined(__xlC__) || \
defined(__TI_COMPILER_VERSION__)) && \
!defined(__STRICT_ANSI__) && !defined(_MSC_VER)
"ON"
diff --git a/Modules/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in
index e7a5487..4904249 100644
--- a/Modules/CMakeCXXCompilerId.cpp.in
+++ b/Modules/CMakeCXXCompilerId.cpp.in
@@ -67,7 +67,7 @@ const char* info_language_standard_default = "INFO" ":" "standard_default["
const char* info_language_extensions_default = "INFO" ":" "extensions_default["
/* !defined(_MSC_VER) to exclude Clang's MSVC compatibility mode. */
-#if (defined(__clang__) || defined(__GNUC__) || \
+#if (defined(__clang__) || defined(__GNUC__) || defined(__xlC__) || \
defined(__TI_COMPILER_VERSION__)) && \
!defined(__STRICT_ANSI__) && !defined(_MSC_VER)
"ON"
diff --git a/Modules/CMakeCompilerIdDetection.cmake b/Modules/CMakeCompilerIdDetection.cmake
index 044326c..f15974a 100644
--- a/Modules/CMakeCompilerIdDetection.cmake
+++ b/Modules/CMakeCompilerIdDetection.cmake
@@ -59,6 +59,7 @@ function(compiler_id_detection outvar lang)
HP
Compaq
zOS
+ IBMClang
XLClang
XL
VisualAge
diff --git a/Modules/CMakeDetermineCUDACompiler.cmake b/Modules/CMakeDetermineCUDACompiler.cmake
index df71799..8fe07fe 100644
--- a/Modules/CMakeDetermineCUDACompiler.cmake
+++ b/Modules/CMakeDetermineCUDACompiler.cmake
@@ -257,7 +257,7 @@ if(NOT CMAKE_CUDA_COMPILER_ID_RUN)
endif()
# Append user-specified architectures.
- if(CMAKE_CUDA_ARCHITECTURES)
+ if(DEFINED CMAKE_CUDA_ARCHITECTURES)
if("x${CMAKE_CUDA_ARCHITECTURES}" STREQUAL "xall")
string(APPEND nvcc_test_flags " -arch=all")
set(architectures_mode all)
@@ -279,11 +279,18 @@ if(NOT CMAKE_CUDA_COMPILER_ID_RUN)
set(CMAKE_CUDA_COMPILER_ID_REQUIRE_SUCCESS ON)
endif()
+ # Rest of the code treats an empty value as equivalent to "use the defaults".
+ # Error out early to prevent confusing errors as a result of this.
+ # Note that this also catches invalid non-numerical values such as "a".
+ if(architectures_mode STREQUAL "explicit" AND "${tested_architectures}" STREQUAL "")
+ message(FATAL_ERROR "CMAKE_CUDA_ARCHITECTURES must be valid if set.")
+ endif()
+
if(CMAKE_CUDA_COMPILER_ID STREQUAL "Clang")
if(NOT CMAKE_CUDA_ARCHITECTURES)
# Clang doesn't automatically select an architecture supported by the SDK.
# Try in reverse order of deprecation with the most recent at front (i.e. the most likely to work for new setups).
- foreach(arch "20" "30" "52")
+ foreach(arch "52" "30" "20")
list(APPEND CMAKE_CUDA_COMPILER_ID_TEST_FLAGS_FIRST "${clang_test_flags} --cuda-gpu-arch=sm_${arch}")
endforeach()
endif()
@@ -346,18 +353,12 @@ if(${CMAKE_GENERATOR} MATCHES "Visual Studio")
set(_SET_CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT
"set(CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT \"${CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT}\")")
elseif(CMAKE_CUDA_COMPILER_ID STREQUAL "Clang")
- if(NOT CMAKE_CUDA_ARCHITECTURES)
- # Find the architecture that we successfully compiled using and set it as the default.
- string(REGEX MATCH "-target-cpu sm_([0-9]+)" dont_care "${CMAKE_CUDA_COMPILER_PRODUCED_OUTPUT}")
- set(detected_architecture "${CMAKE_MATCH_1}")
- else()
- string(REGEX MATCHALL "-target-cpu sm_([0-9]+)" target_cpus "${CMAKE_CUDA_COMPILER_PRODUCED_OUTPUT}")
+ string(REGEX MATCHALL "-target-cpu sm_([0-9]+)" target_cpus "${CMAKE_CUDA_COMPILER_PRODUCED_OUTPUT}")
- foreach(cpu ${target_cpus})
- string(REGEX MATCH "-target-cpu sm_([0-9]+)" dont_care "${cpu}")
- list(APPEND architectures "${CMAKE_MATCH_1}")
- endforeach()
- endif()
+ foreach(cpu ${target_cpus})
+ string(REGEX MATCH "-target-cpu sm_([0-9]+)" dont_care "${cpu}")
+ list(APPEND architectures_detected "${CMAKE_MATCH_1}")
+ endforeach()
# Find target directory when crosscompiling.
if(CMAKE_CROSSCOMPILING)
@@ -583,28 +584,25 @@ if(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA")
"Failed to detect CUDA nvcc include information:\n${_nvcc_log}\n\n")
endif()
- # Parse default CUDA architecture.
- cmake_policy(GET CMP0104 _CUDA_CMP0104)
- if(NOT CMAKE_CUDA_ARCHITECTURES AND _CUDA_CMP0104 STREQUAL "NEW")
- string(REGEX MATCH "arch[ =]compute_([0-9]+)" dont_care "${CMAKE_CUDA_COMPILER_PRODUCED_OUTPUT}")
- set(detected_architecture "${CMAKE_MATCH_1}")
- elseif(CMAKE_CUDA_ARCHITECTURES)
- string(REGEX MATCHALL "-arch compute_([0-9]+)" target_cpus "${CMAKE_CUDA_COMPILER_PRODUCED_OUTPUT}")
-
- foreach(cpu ${target_cpus})
- string(REGEX MATCH "-arch compute_([0-9]+)" dont_care "${cpu}")
- list(APPEND architectures "${CMAKE_MATCH_1}")
- endforeach()
- endif()
+ string(REGEX MATCHALL "-arch compute_([0-9]+)" target_cpus "${CMAKE_CUDA_COMPILER_PRODUCED_OUTPUT}")
+
+ foreach(cpu ${target_cpus})
+ string(REGEX MATCH "-arch compute_([0-9]+)" dont_care "${cpu}")
+ list(APPEND architectures_detected "${CMAKE_MATCH_1}")
+ endforeach()
endif()
# If the user didn't set the architectures, then set them to a default.
# If the user did, then make sure those architectures worked.
-if(DEFINED detected_architecture AND "${CMAKE_CUDA_ARCHITECTURES}" STREQUAL "")
- set(CMAKE_CUDA_ARCHITECTURES "${detected_architecture}" CACHE STRING "CUDA architectures")
+if("${CMAKE_CUDA_ARCHITECTURES}" STREQUAL "")
+ cmake_policy(GET CMP0104 _CUDA_CMP0104)
+
+ if(NOT CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA" OR _CUDA_CMP0104 STREQUAL "NEW")
+ set(CMAKE_CUDA_ARCHITECTURES "${architectures_detected}" CACHE STRING "CUDA architectures")
- if(NOT CMAKE_CUDA_ARCHITECTURES)
- message(FATAL_ERROR "Failed to find a working CUDA architecture.")
+ if(NOT CMAKE_CUDA_ARCHITECTURES)
+ message(FATAL_ERROR "Failed to detect a default CUDA architecture.\n\nCompiler output:\n${CMAKE_CUDA_COMPILER_PRODUCED_OUTPUT}")
+ endif()
endif()
elseif(architectures AND (architectures_mode STREQUAL "xall" OR
architectures_mode STREQUAL "xall-major"))
@@ -617,9 +615,9 @@ elseif(architectures AND (architectures_mode STREQUAL "xall" OR
"instead.")
endif()
-elseif(architectures AND architectures_mode STREQUAL "xexplicit")
+elseif(architectures_mode STREQUAL "xexplicit")
# Sort since order mustn't matter.
- list(SORT architectures)
+ list(SORT architectures_detected)
list(SORT tested_architectures)
# We don't distinguish real/virtual architectures during testing.
@@ -627,12 +625,19 @@ elseif(architectures AND architectures_mode STREQUAL "xexplicit")
# Thus we need to remove duplicates before checking if they're equal.
list(REMOVE_DUPLICATES tested_architectures)
- if(NOT "${architectures}" STREQUAL "${tested_architectures}")
+ # Print the actual architectures for generic values (all and all-major).
+ if(NOT DEFINED architectures_explicit)
+ set(architectures_error "${CMAKE_CUDA_ARCHITECTURES} (${tested_architectures})")
+ else()
+ set(architectures_error "${tested_architectures}")
+ endif()
+
+ if(NOT "${architectures_detected}" STREQUAL "${tested_architectures}")
message(FATAL_ERROR
"The CMAKE_CUDA_ARCHITECTURES:\n"
" ${CMAKE_CUDA_ARCHITECTURES}\n"
"do not all work with this compiler. Try:\n"
- " ${architectures}\n"
+ " ${architectures_detected}\n"
"instead.")
endif()
endif()
diff --git a/Modules/Compiler/IAR-CXX.cmake b/Modules/Compiler/IAR-CXX.cmake
index a3f1dbc..7df74ad 100644
--- a/Modules/Compiler/IAR-CXX.cmake
+++ b/Modules/Compiler/IAR-CXX.cmake
@@ -16,14 +16,17 @@ endif()
# Whenever needed, override this default behavior using CMAKE_IAR_CXX_FLAG in your toolchain file.
if(NOT CMAKE_IAR_CXX_FLAG)
- set(_CMAKE_IAR_MODERNCXX_LIST 14 17)
- if(${CMAKE_CXX_STANDARD_COMPUTED_DEFAULT} IN_LIST _CMAKE_IAR_MODERNCXX_LIST OR
+ cmake_policy(PUSH)
+ cmake_policy(SET CMP0057 NEW) # if IN_LIST
+
+ if(${CMAKE_CXX_STANDARD_COMPUTED_DEFAULT} IN_LIST "14;17" OR
("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "ARM" AND ${CMAKE_CXX_STANDARD_COMPUTED_DEFAULT} EQUAL 98))
string(PREPEND CMAKE_CXX_FLAGS "--c++ ")
else()
string(PREPEND CMAKE_CXX_FLAGS "--eec++ ")
endif()
- unset(_CMAKE_IAR_MODERNCXX_LIST)
+
+ cmake_policy(POP)
endif()
set(CMAKE_CXX_STANDARD_COMPILE_OPTION "")
diff --git a/Modules/Compiler/IBMClang-ASM.cmake b/Modules/Compiler/IBMClang-ASM.cmake
new file mode 100644
index 0000000..dffc085
--- /dev/null
+++ b/Modules/Compiler/IBMClang-ASM.cmake
@@ -0,0 +1,5 @@
+include(Compiler/IBMClang)
+
+set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;S;asm)
+
+__compiler_ibmclang(ASM)
diff --git a/Modules/Compiler/IBMClang-C-DetermineCompiler.cmake b/Modules/Compiler/IBMClang-C-DetermineCompiler.cmake
new file mode 100644
index 0000000..623c8af
--- /dev/null
+++ b/Modules/Compiler/IBMClang-C-DetermineCompiler.cmake
@@ -0,0 +1,8 @@
+set(_compiler_id_pp_test "defined(__open_xl__) && defined(__clang__)")
+
+set(_compiler_id_version_compute "
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__open_xl_version__)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__open_xl_release__)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__open_xl_modification__)
+# define @PREFIX@COMPILER_VERSION_TWEAK @MACRO_DEC@(__open_xl_ptf_fix_level__)
+")
diff --git a/Modules/Compiler/IBMClang-C.cmake b/Modules/Compiler/IBMClang-C.cmake
new file mode 100644
index 0000000..b69b1b8
--- /dev/null
+++ b/Modules/Compiler/IBMClang-C.cmake
@@ -0,0 +1,30 @@
+include(Compiler/IBMClang)
+__compiler_ibmclang(C)
+
+set(CMAKE_C_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c)
+
+if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER)
+ AND CMAKE_GENERATOR MATCHES "Makefiles|WMake"
+ AND CMAKE_DEPFILE_FLAGS_C)
+ # dependencies are computed by the compiler itself
+ set(CMAKE_C_DEPFILE_FORMAT gcc)
+ set(CMAKE_C_DEPENDS_USE_COMPILER TRUE)
+endif()
+
+set(CMAKE_C90_STANDARD__HAS_FULL_SUPPORT ON)
+set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c90")
+set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=gnu90")
+
+set(CMAKE_C99_STANDARD__HAS_FULL_SUPPORT ON)
+set(CMAKE_C99_STANDARD_COMPILE_OPTION "-std=c99")
+set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-std=gnu99")
+
+set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON)
+set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11")
+set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11")
+
+if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 17.1.0)
+ set(CMAKE_C17_STANDARD_COMPILE_OPTION "-std=c17")
+ set(CMAKE_C17_EXTENSION_COMPILE_OPTION "-std=gnu17")
+endif ()
+__compiler_check_default_language_standard(C 17.1.0 17)
diff --git a/Modules/Compiler/IBMClang-CXX-DetermineCompiler.cmake b/Modules/Compiler/IBMClang-CXX-DetermineCompiler.cmake
new file mode 100644
index 0000000..623c8af
--- /dev/null
+++ b/Modules/Compiler/IBMClang-CXX-DetermineCompiler.cmake
@@ -0,0 +1,8 @@
+set(_compiler_id_pp_test "defined(__open_xl__) && defined(__clang__)")
+
+set(_compiler_id_version_compute "
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__open_xl_version__)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__open_xl_release__)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__open_xl_modification__)
+# define @PREFIX@COMPILER_VERSION_TWEAK @MACRO_DEC@(__open_xl_ptf_fix_level__)
+")
diff --git a/Modules/Compiler/IBMClang-CXX.cmake b/Modules/Compiler/IBMClang-CXX.cmake
new file mode 100644
index 0000000..5431b17
--- /dev/null
+++ b/Modules/Compiler/IBMClang-CXX.cmake
@@ -0,0 +1,39 @@
+include(Compiler/IBMClang)
+__compiler_ibmclang(CXX)
+
+if("x${CMAKE_CXX_COMPILER_FRONTEND_VARIANT}" STREQUAL "xGNU")
+ if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER)
+ AND CMAKE_GENERATOR MATCHES "Makefiles|WMake"
+ AND CMAKE_DEPFILE_FLAGS_CXX)
+ # dependencies are computed by the compiler itself
+ set(CMAKE_CXX_DEPFILE_FORMAT gcc)
+ set(CMAKE_CXX_DEPENDS_USE_COMPILER TRUE)
+ endif()
+
+ set(CMAKE_CXX_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c++)
+ set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden")
+endif()
+
+set(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT ON)
+set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "-std=c++98")
+set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "-std=gnu++98")
+
+set(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT ON)
+set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11")
+set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++11")
+
+set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON)
+set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++14")
+set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++14")
+
+if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 17.1.0)
+ set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-std=c++17")
+ set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++17")
+ set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "-std=c++20")
+ set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "-std=gnu++20")
+endif()
+
+__compiler_check_default_language_standard(CXX 17.1.0 17)
+
+set(CMAKE_CXX_COMPILE_OBJECT
+ "<CMAKE_CXX_COMPILER> -x c++ <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>")
diff --git a/Modules/Compiler/IBMClang.cmake b/Modules/Compiler/IBMClang.cmake
new file mode 100644
index 0000000..9ed7658
--- /dev/null
+++ b/Modules/Compiler/IBMClang.cmake
@@ -0,0 +1,79 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+
+# This module is shared by multiple languages; use include blocker.
+if(__COMPILER_IBMClang)
+ return()
+endif()
+set(__COMPILER_IBMClang 1)
+
+include(Compiler/CMakeCommonCompilerMacros)
+
+set(__pch_header_C "c-header")
+set(__pch_header_CXX "c++-header")
+set(__pch_header_OBJC "objective-c-header")
+set(__pch_header_OBJCXX "objective-c++-header")
+
+include(Compiler/GNU)
+
+macro(__compiler_ibmclang lang)
+ __compiler_gnu(${lang})
+
+ # Feature flags.
+ set(CMAKE_${lang}_VERBOSE_FLAG "-v")
+ set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "-fPIC")
+ set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-fPIC")
+ set(CMAKE_${lang}_RESPONSE_FILE_FLAG "@")
+ set(CMAKE_${lang}_RESPONSE_FILE_LINK_FLAG "@")
+
+ set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-isystem ")
+ set(CMAKE_${lang}_COMPILE_OPTIONS_VISIBILITY "-fvisibility=")
+
+ set(CMAKE_${lang}_COMPILE_OPTIONS_TARGET "--target=")
+ set(CMAKE_${lang}_COMPILE_OPTIONS_EXTERNAL_TOOLCHAIN "--gcc-toolchain=")
+
+ set(CMAKE_${lang}_LINKER_WRAPPER_FLAG "-Xlinker" " ")
+ set(CMAKE_${lang}_LINKER_WRAPPER_FLAG_SEP)
+
+ if(CMAKE_${lang}_COMPILER_TARGET)
+ list(APPEND CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND "--target=${CMAKE_${lang}_COMPILER_TARGET}")
+ endif()
+
+ set(_CMAKE_${lang}_IPO_SUPPORTED_BY_CMAKE YES)
+ set(_CMAKE_${lang}_IPO_MAY_BE_SUPPORTED_BY_COMPILER YES)
+
+ set(_CMAKE_LTO_THIN TRUE)
+
+ if(_CMAKE_LTO_THIN)
+ set(CMAKE_${lang}_COMPILE_OPTIONS_IPO "-flto=thin")
+ else()
+ set(CMAKE_${lang}_COMPILE_OPTIONS_IPO "-flto")
+ endif()
+
+ set(__ar "${CMAKE_${lang}_COMPILER_AR}")
+ set(__ranlib "${CMAKE_${lang}_COMPILER_RANLIB}")
+
+ set(CMAKE_${lang}_ARCHIVE_CREATE_IPO
+ "\"${__ar}\" cr <TARGET> <LINK_FLAGS> <OBJECTS>"
+ )
+
+ set(CMAKE_${lang}_ARCHIVE_APPEND_IPO
+ "\"${__ar}\" r <TARGET> <LINK_FLAGS> <OBJECTS>"
+ )
+
+ set(CMAKE_${lang}_ARCHIVE_FINISH_IPO
+ "\"${__ranlib}\" <TARGET>"
+ )
+
+ list(APPEND CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND "-dM" "-E" "-c" "${CMAKE_ROOT}/Modules/CMakeCXXCompilerABI.cpp")
+
+ set(CMAKE_PCH_EXTENSION .pch)
+
+ set(CMAKE_PCH_PROLOGUE "#pragma clang system_header")
+
+ set(CMAKE_${lang}_COMPILE_OPTIONS_INSTANTIATE_TEMPLATES_PCH -fpch-instantiate-templates)
+
+ set(CMAKE_${lang}_COMPILE_OPTIONS_USE_PCH -Xclang -include-pch -Xclang <PCH_FILE> -Xclang -include -Xclang <PCH_HEADER>)
+ set(CMAKE_${lang}_COMPILE_OPTIONS_CREATE_PCH -Xclang -emit-pch -Xclang -include -Xclang <PCH_HEADER> -x ${__pch_header_${lang}})
+endmacro()
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index fc15a0f..411a1a9 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -1254,7 +1254,25 @@ define_property(DIRECTORY PROPERTY "EP_UPDATE_DISCONNECTED" INHERITED
"ExternalProject module."
)
-function(_ep_write_gitclone_script script_filename source_dir git_EXECUTABLE git_repository git_tag git_remote_name init_submodules git_submodules_recurse git_submodules git_shallow git_progress git_config src_name work_dir gitclone_infofile gitclone_stampfile tls_verify)
+function(_ep_write_gitclone_script
+ script_filename
+ source_dir
+ git_EXECUTABLE
+ git_repository
+ git_tag
+ git_remote_name
+ init_submodules
+ git_submodules_recurse
+ git_submodules
+ git_shallow
+ git_progress
+ git_config
+ src_name
+ work_dir
+ gitclone_infofile
+ gitclone_stampfile
+ tls_verify)
+
if(NOT GIT_VERSION_STRING VERSION_LESS 1.8.5)
# Use `git checkout <tree-ish> --` to avoid ambiguity with a local path.
set(git_checkout_explicit-- "--")
@@ -1300,136 +1318,48 @@ function(_ep_write_gitclone_script script_filename source_dir git_EXECUTABLE git
endif()
string (REPLACE ";" " " git_options "${git_options}")
- file(WRITE ${script_filename}
-"
-if(EXISTS \"${gitclone_stampfile}\" AND EXISTS \"${gitclone_infofile}\" AND
- \"${gitclone_stampfile}\" IS_NEWER_THAN \"${gitclone_infofile}\")
- message(STATUS \"Avoiding repeated git clone, stamp file is up to date: '${gitclone_stampfile}'\")
- return()
-endif()
-
-execute_process(
- COMMAND \${CMAKE_COMMAND} -E rm -rf \"${source_dir}\"
- RESULT_VARIABLE error_code
- )
-if(error_code)
- message(FATAL_ERROR \"Failed to remove directory: '${source_dir}'\")
-endif()
-
-# try the clone 3 times in case there is an odd git clone issue
-set(error_code 1)
-set(number_of_tries 0)
-while(error_code AND number_of_tries LESS 3)
- execute_process(
- COMMAND \"${git_EXECUTABLE}\" ${git_options} clone ${git_clone_options} \"${git_repository}\" \"${src_name}\"
- WORKING_DIRECTORY \"${work_dir}\"
- RESULT_VARIABLE error_code
- )
- math(EXPR number_of_tries \"\${number_of_tries} + 1\")
-endwhile()
-if(number_of_tries GREATER 1)
- message(STATUS \"Had to git clone more than once:
- \${number_of_tries} times.\")
-endif()
-if(error_code)
- message(FATAL_ERROR \"Failed to clone repository: '${git_repository}'\")
-endif()
-
-execute_process(
- COMMAND \"${git_EXECUTABLE}\" ${git_options} checkout ${git_tag} ${git_checkout_explicit--}
- WORKING_DIRECTORY \"${work_dir}/${src_name}\"
- RESULT_VARIABLE error_code
- )
-if(error_code)
- message(FATAL_ERROR \"Failed to checkout tag: '${git_tag}'\")
-endif()
-
-set(init_submodules ${init_submodules})
-if(init_submodules)
- execute_process(
- COMMAND \"${git_EXECUTABLE}\" ${git_options} submodule update ${git_submodules_recurse} --init ${git_submodules}
- WORKING_DIRECTORY \"${work_dir}/${src_name}\"
- RESULT_VARIABLE error_code
- )
-endif()
-if(error_code)
- message(FATAL_ERROR \"Failed to update submodules in: '${work_dir}/${src_name}'\")
-endif()
-
-# Complete success, update the script-last-run stamp file:
-#
-execute_process(
- COMMAND \${CMAKE_COMMAND} -E copy
- \"${gitclone_infofile}\"
- \"${gitclone_stampfile}\"
- RESULT_VARIABLE error_code
+ configure_file(
+ ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/ExternalProject/gitclone.cmake.in
+ ${script_filename}
+ @ONLY
)
-if(error_code)
- message(FATAL_ERROR \"Failed to copy script-last-run stamp file: '${gitclone_stampfile}'\")
-endif()
-
-"
-)
-
endfunction()
-function(_ep_write_hgclone_script script_filename source_dir hg_EXECUTABLE hg_repository hg_tag src_name work_dir hgclone_infofile hgclone_stampfile)
+function(_ep_write_hgclone_script
+ script_filename
+ source_dir
+ hg_EXECUTABLE
+ hg_repository
+ hg_tag
+ src_name
+ work_dir
+ hgclone_infofile
+ hgclone_stampfile)
+
if("${hg_tag}" STREQUAL "")
message(FATAL_ERROR "Tag for hg checkout should not be empty.")
endif()
- file(WRITE ${script_filename}
-"
-if(EXISTS \"${hgclone_stampfile}\" AND EXISTS \"${hgclone_infofile}\" AND
- \"${hgclone_stampfile}\" IS_NEWER_THAN \"${hgclone_infofile}\")
- message(STATUS \"Avoiding repeated hg clone, stamp file is up to date: '${hgclone_stampfile}'\")
- return()
-endif()
-
-execute_process(
- COMMAND \${CMAKE_COMMAND} -E rm -rf \"${source_dir}\"
- RESULT_VARIABLE error_code
- )
-if(error_code)
- message(FATAL_ERROR \"Failed to remove directory: '${source_dir}'\")
-endif()
-execute_process(
- COMMAND \"${hg_EXECUTABLE}\" clone -U \"${hg_repository}\" \"${src_name}\"
- WORKING_DIRECTORY \"${work_dir}\"
- RESULT_VARIABLE error_code
- )
-if(error_code)
- message(FATAL_ERROR \"Failed to clone repository: '${hg_repository}'\")
-endif()
-
-execute_process(
- COMMAND \"${hg_EXECUTABLE}\" update ${hg_tag}
- WORKING_DIRECTORY \"${work_dir}/${src_name}\"
- RESULT_VARIABLE error_code
- )
-if(error_code)
- message(FATAL_ERROR \"Failed to checkout tag: '${hg_tag}'\")
-endif()
-
-# Complete success, update the script-last-run stamp file:
-#
-execute_process(
- COMMAND \${CMAKE_COMMAND} -E copy
- \"${hgclone_infofile}\"
- \"${hgclone_stampfile}\"
- RESULT_VARIABLE error_code
+ configure_file(
+ ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/ExternalProject/hgclone.cmake.in
+ ${script_filename}
+ @ONLY
)
-if(error_code)
- message(FATAL_ERROR \"Failed to copy script-last-run stamp file: '${hgclone_stampfile}'\")
-endif()
-
-"
-)
-
endfunction()
-function(_ep_write_gitupdate_script script_filename git_EXECUTABLE git_tag git_remote_name init_submodules git_submodules_recurse git_submodules git_repository work_dir git_update_strategy)
+function(_ep_write_gitupdate_script
+ script_filename
+ git_EXECUTABLE
+ git_tag
+ git_remote_name
+ init_submodules
+ git_submodules_recurse
+ git_submodules
+ git_repository
+ work_dir
+ git_update_strategy)
+
if("${git_tag}" STREQUAL "")
message(FATAL_ERROR "Tag for git checkout should not be empty.")
endif()
@@ -1443,13 +1373,27 @@ function(_ep_write_gitupdate_script script_filename git_EXECUTABLE git_tag git_r
endif()
configure_file(
- "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/ExternalProject-gitupdate.cmake.in"
+ "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/ExternalProject/gitupdate.cmake.in"
"${script_filename}"
@ONLY
)
endfunction()
-function(_ep_write_downloadfile_script script_filename REMOTE LOCAL timeout inactivity_timeout no_progress hash tls_verify tls_cainfo userpwd http_headers netrc netrc_file)
+function(_ep_write_downloadfile_script
+ script_filename
+ REMOTE
+ LOCAL
+ timeout
+ inactivity_timeout
+ no_progress
+ hash
+ tls_verify
+ tls_cainfo
+ userpwd
+ http_headers
+ netrc
+ netrc_file)
+
if(timeout)
set(TIMEOUT_ARGS TIMEOUT ${timeout})
set(TIMEOUT_MSG "${timeout} seconds")
@@ -1465,7 +1409,6 @@ function(_ep_write_downloadfile_script script_filename REMOTE LOCAL timeout inac
set(INACTIVITY_TIMEOUT_MSG "none")
endif()
-
if(no_progress)
set(SHOW_PROGRESS "")
else()
@@ -1553,7 +1496,7 @@ function(_ep_write_downloadfile_script script_filename REMOTE LOCAL timeout inac
# * USERPWD_ARGS
# * HTTP_HEADERS_ARGS
configure_file(
- "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/ExternalProject-download.cmake.in"
+ "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/ExternalProject/download.cmake.in"
"${script_filename}"
@ONLY
)
@@ -1574,7 +1517,7 @@ function(_ep_write_verifyfile_script script_filename LOCAL hash)
# * EXPECT_VALUE
# * LOCAL
configure_file(
- "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/ExternalProject-verify.cmake.in"
+ "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/ExternalProject/verify.cmake.in"
"${script_filename}"
@ONLY
)
@@ -1597,68 +1540,11 @@ function(_ep_write_extractfile_script script_filename name filename directory)
return()
endif()
- file(WRITE ${script_filename}
-"# Make file names absolute:
-#
-get_filename_component(filename \"${filename}\" ABSOLUTE)
-get_filename_component(directory \"${directory}\" ABSOLUTE)
-
-message(STATUS \"extracting...
- src='\${filename}'
- dst='\${directory}'\")
-
-if(NOT EXISTS \"\${filename}\")
- message(FATAL_ERROR \"error: file to extract does not exist: '\${filename}'\")
-endif()
-
-# Prepare a space for extracting:
-#
-set(i 1234)
-while(EXISTS \"\${directory}/../ex-${name}\${i}\")
- math(EXPR i \"\${i} + 1\")
-endwhile()
-set(ut_dir \"\${directory}/../ex-${name}\${i}\")
-file(MAKE_DIRECTORY \"\${ut_dir}\")
-
-# Extract it:
-#
-message(STATUS \"extracting... [tar ${args}]\")
-execute_process(COMMAND \${CMAKE_COMMAND} -E tar ${args} \${filename}
- WORKING_DIRECTORY \${ut_dir}
- RESULT_VARIABLE rv)
-
-if(NOT rv EQUAL 0)
- message(STATUS \"extracting... [error clean up]\")
- file(REMOVE_RECURSE \"\${ut_dir}\")
- message(FATAL_ERROR \"error: extract of '\${filename}' failed\")
-endif()
-
-# Analyze what came out of the tar file:
-#
-message(STATUS \"extracting... [analysis]\")
-file(GLOB contents \"\${ut_dir}/*\")
-list(REMOVE_ITEM contents \"\${ut_dir}/.DS_Store\")
-list(LENGTH contents n)
-if(NOT n EQUAL 1 OR NOT IS_DIRECTORY \"\${contents}\")
- set(contents \"\${ut_dir}\")
-endif()
-
-# Move \"the one\" directory to the final directory:
-#
-message(STATUS \"extracting... [rename]\")
-file(REMOVE_RECURSE \${directory})
-get_filename_component(contents \${contents} ABSOLUTE)
-file(RENAME \${contents} \${directory})
-
-# Clean up:
-#
-message(STATUS \"extracting... [clean up]\")
-file(REMOVE_RECURSE \"\${ut_dir}\")
-
-message(STATUS \"extracting... done\")
-"
-)
-
+ configure_file(
+ "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/ExternalProject/extractfile.cmake.in"
+ "${script_filename}"
+ @ONLY
+ )
endfunction()
@@ -1674,6 +1560,7 @@ function(_ep_set_directories name)
endif()
endif()
if(prefix)
+ file(TO_CMAKE_PATH "${prefix}" prefix)
set(tmp_default "${prefix}/tmp")
set(download_default "${prefix}/src")
set(source_default "${prefix}/src/${name}")
@@ -1681,6 +1568,7 @@ function(_ep_set_directories name)
set(stamp_default "${prefix}/src/${name}-stamp")
set(install_default "${prefix}")
else()
+ file(TO_CMAKE_PATH "${base}" base)
set(tmp_default "${base}/tmp/${name}")
set(download_default "${base}/Download/${name}")
set(source_default "${base}/Source/${name}")
@@ -1709,6 +1597,7 @@ function(_ep_set_directories name)
if(NOT IS_ABSOLUTE "${${var}_dir}")
get_filename_component(${var}_dir "${top}/${${var}_dir}" ABSOLUTE)
endif()
+ file(TO_CMAKE_PATH "${${var}_dir}" ${var}_dir)
set_property(TARGET ${name} PROPERTY _EP_${VAR}_DIR "${${var}_dir}")
endforeach()
@@ -1720,6 +1609,7 @@ function(_ep_set_directories name)
if(NOT IS_ABSOLUTE "${log_dir}")
get_filename_component(log_dir "${top}/${log_dir}" ABSOLUTE)
endif()
+ file(TO_CMAKE_PATH "${log_dir}" log_dir)
set_property(TARGET ${name} PROPERTY _EP_LOG_DIR "${log_dir}")
get_property(source_subdir TARGET ${name} PROPERTY _EP_SOURCE_SUBDIR)
@@ -1731,6 +1621,7 @@ function(_ep_set_directories name)
else()
# Prefix with a slash so that when appended to the source directory, it
# behaves as expected.
+ file(TO_CMAKE_PATH "${source_subdir}" source_subdir)
set_property(TARGET ${name} PROPERTY _EP_SOURCE_SUBDIR "/${source_subdir}")
endif()
if(build_in_source)
@@ -1742,22 +1633,19 @@ function(_ep_set_directories name)
endif()
endif()
- # Make the directories at CMake configure time *and* add a custom command
- # to make them at build time. They need to exist at makefile generation
- # time for Borland make and wmake so that CMake may generate makefiles
- # with "cd C:\short\paths\with\no\spaces" commands in them.
- #
- # Additionally, the add_custom_command is still used in case somebody
- # removes one of the necessary directories and tries to rebuild without
- # re-running cmake.
- foreach(var ${places})
- string(TOUPPER "${var}" VAR)
- get_property(dir TARGET ${name} PROPERTY _EP_${VAR}_DIR)
- file(MAKE_DIRECTORY "${dir}")
- if(NOT EXISTS "${dir}")
- message(FATAL_ERROR "dir '${dir}' does not exist after file(MAKE_DIRECTORY)")
- endif()
- endforeach()
+ # This script will be used both here and by the mkdir step. We create the
+ # directories now at configure time and ensure they exist again at build
+ # time (since somebody might remove one of the required directories and try
+ # to rebuild without re-running cmake). They need to exist now at makefile
+ # generation time for Borland make and wmake so that CMake may generate
+ # makefiles with "cd C:\short\paths\with\no\spaces" commands in them.
+ set(script_filename "${tmp_dir}/${name}-mkdirs.cmake")
+ configure_file(
+ ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/ExternalProject/mkdirs.cmake.in
+ ${script_filename}
+ @ONLY
+ )
+ include(${script_filename})
endfunction()
@@ -2523,22 +2411,14 @@ endfunction()
function(_ep_add_mkdir_command name)
- ExternalProject_Get_Property(${name}
- source_dir binary_dir install_dir stamp_dir download_dir tmp_dir log_dir)
-
- _ep_get_configuration_subdir_suffix(cfgdir)
+ ExternalProject_Get_Property(${name} tmp_dir)
+ set(script_filename "${tmp_dir}/${name}-mkdirs.cmake")
ExternalProject_Add_Step(${name} mkdir
INDEPENDENT TRUE
COMMENT "Creating directories for '${name}'"
- COMMAND ${CMAKE_COMMAND} -E make_directory ${source_dir}
- COMMAND ${CMAKE_COMMAND} -E make_directory ${binary_dir}
- COMMAND ${CMAKE_COMMAND} -E make_directory ${install_dir}
- COMMAND ${CMAKE_COMMAND} -E make_directory ${tmp_dir}
- COMMAND ${CMAKE_COMMAND} -E make_directory ${stamp_dir}${cfgdir}
- COMMAND ${CMAKE_COMMAND} -E make_directory ${download_dir}
- COMMAND ${CMAKE_COMMAND} -E make_directory ${log_dir}
- )
+ COMMAND ${CMAKE_COMMAND} -P ${script_filename}
+ )
endfunction()
@@ -2613,7 +2493,7 @@ function(_ep_add_download_command name)
set(module ${cvs_module})
set(tag ${cvs_tag})
configure_file(
- "${CMAKE_ROOT}/Modules/RepositoryInfo.txt.in"
+ "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/ExternalProject/RepositoryInfo.txt.in"
"${stamp_dir}/${name}-cvsinfo.txt"
@ONLY
)
@@ -2638,7 +2518,7 @@ function(_ep_add_download_command name)
set(module)
set(tag ${svn_revision})
configure_file(
- "${CMAKE_ROOT}/Modules/RepositoryInfo.txt.in"
+ "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/ExternalProject/RepositoryInfo.txt.in"
"${stamp_dir}/${name}-svninfo.txt"
@ONLY
)
@@ -2714,7 +2594,7 @@ function(_ep_add_download_command name)
set(module)
set(tag ${git_remote_name})
configure_file(
- "${CMAKE_ROOT}/Modules/RepositoryInfo.txt.in"
+ "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/ExternalProject/RepositoryInfo.txt.in"
"${stamp_dir}/${name}-gitinfo.txt"
@ONLY
)
@@ -2754,7 +2634,7 @@ function(_ep_add_download_command name)
set(module)
set(tag)
configure_file(
- "${CMAKE_ROOT}/Modules/RepositoryInfo.txt.in"
+ "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/ExternalProject/RepositoryInfo.txt.in"
"${stamp_dir}/${name}-hginfo.txt"
@ONLY
)
@@ -2795,7 +2675,7 @@ function(_ep_add_download_command name)
set(module "${url}")
set(tag "${hash}")
configure_file(
- "${CMAKE_ROOT}/Modules/RepositoryInfo.txt.in"
+ "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/ExternalProject/RepositoryInfo.txt.in"
"${stamp_dir}/${name}-urlinfo.txt"
@ONLY
)
@@ -2850,7 +2730,21 @@ function(_ep_add_download_command name)
get_property(http_password TARGET ${name} PROPERTY _EP_HTTP_PASSWORD)
get_property(http_headers TARGET ${name} PROPERTY _EP_HTTP_HEADER)
set(download_script "${stamp_dir}/download-${name}.cmake")
- _ep_write_downloadfile_script("${download_script}" "${url}" "${file}" "${timeout}" "${inactivity_timeout}" "${no_progress}" "${hash}" "${tls_verify}" "${tls_cainfo}" "${http_username}:${http_password}" "${http_headers}" "${netrc}" "${netrc_file}")
+ _ep_write_downloadfile_script(
+ "${download_script}"
+ "${url}"
+ "${file}"
+ "${timeout}"
+ "${inactivity_timeout}"
+ "${no_progress}"
+ "${hash}"
+ "${tls_verify}"
+ "${tls_cainfo}"
+ "${http_username}:${http_password}"
+ "${http_headers}"
+ "${netrc}"
+ "${netrc_file}"
+ )
set(cmd ${CMAKE_COMMAND} -P "${download_script}"
COMMAND)
if (no_extract)
@@ -2868,11 +2762,20 @@ function(_ep_add_download_command name)
set(steps "verify and extract")
endif ()
set(comment "Performing download step (${steps}) for '${name}'")
- _ep_write_verifyfile_script("${stamp_dir}/verify-${name}.cmake" "${file}" "${hash}")
+ _ep_write_verifyfile_script(
+ "${stamp_dir}/verify-${name}.cmake"
+ "${file}"
+ "${hash}"
+ )
endif()
list(APPEND cmd ${CMAKE_COMMAND} -P ${stamp_dir}/verify-${name}.cmake)
if (NOT no_extract)
- _ep_write_extractfile_script("${stamp_dir}/extract-${name}.cmake" "${name}" "${file}" "${source_dir}")
+ _ep_write_extractfile_script(
+ "${stamp_dir}/extract-${name}.cmake"
+ "${name}"
+ "${file}"
+ "${source_dir}"
+ )
list(APPEND cmd COMMAND ${CMAKE_COMMAND} -P ${stamp_dir}/extract-${name}.cmake)
else ()
set_property(TARGET ${name} PROPERTY _EP_DOWNLOADED_FILE ${file})
@@ -3035,9 +2938,18 @@ function(_ep_add_update_command name)
_ep_get_git_submodules_recurse(git_submodules_recurse)
- _ep_write_gitupdate_script(${tmp_dir}/${name}-gitupdate.cmake
- ${GIT_EXECUTABLE} ${git_tag} ${git_remote_name} ${git_init_submodules} "${git_submodules_recurse}" "${git_submodules}" ${git_repository} ${work_dir} ${git_update_strategy}
- )
+ _ep_write_gitupdate_script(
+ "${tmp_dir}/${name}-gitupdate.cmake"
+ "${GIT_EXECUTABLE}"
+ "${git_tag}"
+ "${git_remote_name}"
+ "${git_init_submodules}"
+ "${git_submodules_recurse}"
+ "${git_submodules}"
+ "${git_repository}"
+ "${work_dir}"
+ "${git_update_strategy}"
+ )
set(cmd ${CMAKE_COMMAND} -P ${tmp_dir}/${name}-gitupdate.cmake)
set(always 1)
elseif(hg_repository)
@@ -3279,10 +3191,11 @@ function(_ep_add_configure_command name)
# used, cmake args or cmake generator) then re-run the configure step.
# Fixes issue https://gitlab.kitware.com/cmake/cmake/-/issues/10258
#
- if(NOT EXISTS ${tmp_dir}/${name}-cfgcmd.txt.in)
- file(WRITE ${tmp_dir}/${name}-cfgcmd.txt.in "cmd='\@cmd\@'\n")
- endif()
- configure_file(${tmp_dir}/${name}-cfgcmd.txt.in ${tmp_dir}/${name}-cfgcmd.txt)
+ configure_file(
+ ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/ExternalProject/cfgcmd.txt.in
+ ${tmp_dir}/${name}-cfgcmd.txt
+ @ONLY
+ )
list(APPEND file_deps ${tmp_dir}/${name}-cfgcmd.txt)
list(APPEND file_deps ${_ep_cache_args_script})
diff --git a/Modules/RepositoryInfo.txt.in b/Modules/ExternalProject/RepositoryInfo.txt.in
index df8e322..df8e322 100644
--- a/Modules/RepositoryInfo.txt.in
+++ b/Modules/ExternalProject/RepositoryInfo.txt.in
diff --git a/Modules/ExternalProject/cfgcmd.txt.in b/Modules/ExternalProject/cfgcmd.txt.in
new file mode 100644
index 0000000..b3f09ef
--- /dev/null
+++ b/Modules/ExternalProject/cfgcmd.txt.in
@@ -0,0 +1 @@
+cmd='@cmd@'
diff --git a/Modules/ExternalProject-download.cmake.in b/Modules/ExternalProject/download.cmake.in
index ff8c659..ff8c659 100644
--- a/Modules/ExternalProject-download.cmake.in
+++ b/Modules/ExternalProject/download.cmake.in
diff --git a/Modules/ExternalProject/extractfile.cmake.in b/Modules/ExternalProject/extractfile.cmake.in
new file mode 100644
index 0000000..d7f5756
--- /dev/null
+++ b/Modules/ExternalProject/extractfile.cmake.in
@@ -0,0 +1,65 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+cmake_minimum_required(VERSION 3.5)
+
+# Make file names absolute:
+#
+get_filename_component(filename "@filename@" ABSOLUTE)
+get_filename_component(directory "@directory@" ABSOLUTE)
+
+message(STATUS "extracting...
+ src='${filename}'
+ dst='${directory}'"
+)
+
+if(NOT EXISTS "${filename}")
+ message(FATAL_ERROR "File to extract does not exist: '${filename}'")
+endif()
+
+# Prepare a space for extracting:
+#
+set(i 1234)
+while(EXISTS "${directory}/../ex-@name@${i}")
+ math(EXPR i "${i} + 1")
+endwhile()
+set(ut_dir "${directory}/../ex-@name@${i}")
+file(MAKE_DIRECTORY "${ut_dir}")
+
+# Extract it:
+#
+message(STATUS "extracting... [tar @args@]")
+execute_process(COMMAND ${CMAKE_COMMAND} -E tar @args@ ${filename}
+ WORKING_DIRECTORY ${ut_dir}
+ RESULT_VARIABLE rv
+)
+
+if(NOT rv EQUAL 0)
+ message(STATUS "extracting... [error clean up]")
+ file(REMOVE_RECURSE "${ut_dir}")
+ message(FATAL_ERROR "Extract of '${filename}' failed")
+endif()
+
+# Analyze what came out of the tar file:
+#
+message(STATUS "extracting... [analysis]")
+file(GLOB contents "${ut_dir}/*")
+list(REMOVE_ITEM contents "${ut_dir}/.DS_Store")
+list(LENGTH contents n)
+if(NOT n EQUAL 1 OR NOT IS_DIRECTORY "${contents}")
+ set(contents "${ut_dir}")
+endif()
+
+# Move "the one" directory to the final directory:
+#
+message(STATUS "extracting... [rename]")
+file(REMOVE_RECURSE ${directory})
+get_filename_component(contents ${contents} ABSOLUTE)
+file(RENAME ${contents} ${directory})
+
+# Clean up:
+#
+message(STATUS "extracting... [clean up]")
+file(REMOVE_RECURSE "${ut_dir}")
+
+message(STATUS "extracting... done")
diff --git a/Modules/ExternalProject/gitclone.cmake.in b/Modules/ExternalProject/gitclone.cmake.in
new file mode 100644
index 0000000..3312171
--- /dev/null
+++ b/Modules/ExternalProject/gitclone.cmake.in
@@ -0,0 +1,73 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+cmake_minimum_required(VERSION 3.5)
+
+if(EXISTS "@gitclone_stampfile@" AND EXISTS "@gitclone_infofile@" AND
+ "@gitclone_stampfile@" IS_NEWER_THAN "@gitclone_infofile@")
+ message(STATUS
+ "Avoiding repeated git clone, stamp file is up to date: "
+ "'@gitclone_stampfile@'"
+ )
+ return()
+endif()
+
+execute_process(
+ COMMAND ${CMAKE_COMMAND} -E rm -rf "@source_dir@"
+ RESULT_VARIABLE error_code
+)
+if(error_code)
+ message(FATAL_ERROR "Failed to remove directory: '@source_dir@'")
+endif()
+
+# try the clone 3 times in case there is an odd git clone issue
+set(error_code 1)
+set(number_of_tries 0)
+while(error_code AND number_of_tries LESS 3)
+ execute_process(
+ COMMAND "@git_EXECUTABLE@" @git_options@
+ clone @git_clone_options@ "@git_repository@" "@src_name@"
+ WORKING_DIRECTORY "@work_dir@"
+ RESULT_VARIABLE error_code
+ )
+ math(EXPR number_of_tries "${number_of_tries} + 1")
+endwhile()
+if(number_of_tries GREATER 1)
+ message(STATUS "Had to git clone more than once: ${number_of_tries} times.")
+endif()
+if(error_code)
+ message(FATAL_ERROR "Failed to clone repository: '@git_repository@'")
+endif()
+
+execute_process(
+ COMMAND "@git_EXECUTABLE@" @git_options@
+ checkout "@git_tag@" @git_checkout_explicit--@
+ WORKING_DIRECTORY "@work_dir@/@src_name@"
+ RESULT_VARIABLE error_code
+)
+if(error_code)
+ message(FATAL_ERROR "Failed to checkout tag: '@git_tag@'")
+endif()
+
+set(init_submodules @init_submodules@)
+if(init_submodules)
+ execute_process(
+ COMMAND "@git_EXECUTABLE@" @git_options@
+ submodule update @git_submodules_recurse@ --init @git_submodules@
+ WORKING_DIRECTORY "@work_dir@/@src_name@"
+ RESULT_VARIABLE error_code
+ )
+endif()
+if(error_code)
+ message(FATAL_ERROR "Failed to update submodules in: '@work_dir@/@src_name@'")
+endif()
+
+# Complete success, update the script-last-run stamp file:
+#
+execute_process(
+ COMMAND ${CMAKE_COMMAND} -E copy "@gitclone_infofile@" "@gitclone_stampfile@"
+ RESULT_VARIABLE error_code
+)
+if(error_code)
+ message(FATAL_ERROR "Failed to copy script-last-run stamp file: '@gitclone_stampfile@'")
+endif()
diff --git a/Modules/ExternalProject-gitupdate.cmake.in b/Modules/ExternalProject/gitupdate.cmake.in
index 0de2372..0de2372 100644
--- a/Modules/ExternalProject-gitupdate.cmake.in
+++ b/Modules/ExternalProject/gitupdate.cmake.in
diff --git a/Modules/ExternalProject/hgclone.cmake.in b/Modules/ExternalProject/hgclone.cmake.in
new file mode 100644
index 0000000..e2b55ba
--- /dev/null
+++ b/Modules/ExternalProject/hgclone.cmake.in
@@ -0,0 +1,49 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+cmake_minimum_required(VERSION 3.5)
+
+if(EXISTS "@hgclone_stampfile@" AND EXISTS "@hgclone_infofile@" AND
+ "@hgclone_stampfile@" IS_NEWER_THAN "@hgclone_infofile@")
+ message(STATUS
+ "Avoiding repeated hg clone, stamp file is up to date: "
+ "'@hgclone_stampfile@'"
+ )
+ return()
+endif()
+
+execute_process(
+ COMMAND ${CMAKE_COMMAND} -E rm -rf "@source_dir@"
+ RESULT_VARIABLE error_code
+)
+if(error_code)
+ message(FATAL_ERROR "Failed to remove directory: '@source_dir@'")
+endif()
+
+execute_process(
+ COMMAND "@hg_EXECUTABLE@" clone -U "@hg_repository@" "@src_name@"
+ WORKING_DIRECTORY "@work_dir@"
+ RESULT_VARIABLE error_code
+)
+if(error_code)
+ message(FATAL_ERROR "Failed to clone repository: '@hg_repository@'")
+endif()
+
+execute_process(
+ COMMAND "@hg_EXECUTABLE@" update @hg_tag@
+ WORKING_DIRECTORY "@work_dir@/@src_name@"
+ RESULT_VARIABLE error_code
+)
+if(error_code)
+ message(FATAL_ERROR "Failed to checkout tag: '@hg_tag@'")
+endif()
+
+# Complete success, update the script-last-run stamp file:
+#
+execute_process(
+ COMMAND ${CMAKE_COMMAND} -E copy "@hgclone_infofile@" "@hgclone_stampfile@"
+ RESULT_VARIABLE error_code
+)
+if(error_code)
+ message(FATAL_ERROR "Failed to copy script-last-run stamp file: '@hgclone_stampfile@'")
+endif()
diff --git a/Modules/ExternalProject/mkdirs.cmake.in b/Modules/ExternalProject/mkdirs.cmake.in
new file mode 100644
index 0000000..d30a2e7
--- /dev/null
+++ b/Modules/ExternalProject/mkdirs.cmake.in
@@ -0,0 +1,19 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+cmake_minimum_required(VERSION 3.5)
+
+file(MAKE_DIRECTORY
+ "@source_dir@"
+ "@binary_dir@"
+ "@install_dir@"
+ "@tmp_dir@"
+ "@stamp_dir@"
+ "@download_dir@"
+ "@log_dir@"
+)
+
+set(configSubDirs @CMAKE_CONFIGURATION_TYPES@)
+foreach(subDir IN LISTS configSubDirs)
+ file(MAKE_DIRECTORY "@stamp_dir@/${subDir}")
+endforeach()
diff --git a/Modules/ExternalProject-verify.cmake.in b/Modules/ExternalProject/verify.cmake.in
index c06da4e..c06da4e 100644
--- a/Modules/ExternalProject-verify.cmake.in
+++ b/Modules/ExternalProject/verify.cmake.in
diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake
index dd795f4..af5f798 100644
--- a/Modules/FindCUDA.cmake
+++ b/Modules/FindCUDA.cmake
@@ -926,8 +926,8 @@ mark_as_advanced(CUDA_NVCC_EXECUTABLE)
if(CUDA_NVCC_EXECUTABLE AND NOT CUDA_VERSION)
# Compute the version.
execute_process (COMMAND ${CUDA_NVCC_EXECUTABLE} "--version" OUTPUT_VARIABLE NVCC_OUT)
- string(REGEX REPLACE ".*release ([0-9]+)\\.([0-9]+).*" "\\1" CUDA_VERSION_MAJOR ${NVCC_OUT})
- string(REGEX REPLACE ".*release ([0-9]+)\\.([0-9]+).*" "\\2" CUDA_VERSION_MINOR ${NVCC_OUT})
+ string(REGEX REPLACE ".*release ([0-9]+)\\.([0-9]+).*" "\\1" CUDA_VERSION_MAJOR "${NVCC_OUT}")
+ string(REGEX REPLACE ".*release ([0-9]+)\\.([0-9]+).*" "\\2" CUDA_VERSION_MINOR "${NVCC_OUT}")
set(CUDA_VERSION "${CUDA_VERSION_MAJOR}.${CUDA_VERSION_MINOR}" CACHE STRING "Version of CUDA as computed from nvcc.")
mark_as_advanced(CUDA_VERSION)
else()
diff --git a/Modules/FindCUDAToolkit.cmake b/Modules/FindCUDAToolkit.cmake
index d1cd38d..573f956 100644
--- a/Modules/FindCUDAToolkit.cmake
+++ b/Modules/FindCUDAToolkit.cmake
@@ -143,13 +143,11 @@ CUDA Driver Library
""""""""""""""""""""
The CUDA Driver library (cuda) are used by applications that use calls
-such as `cuMemAlloc`, and `cuMemFree`. This is generally used by advanced
-
+such as `cuMemAlloc`, and `cuMemFree`.
Targets Created:
- ``CUDA::cuda_driver``
-- ``CUDA::cuda_driver``
.. _`cuda_toolkit_cuBLAS`:
diff --git a/Modules/FindMPI/test_mpi.c b/Modules/FindMPI/test_mpi.c
index 70d7e1d..36b5dfd 100644
--- a/Modules/FindMPI/test_mpi.c
+++ b/Modules/FindMPI/test_mpi.c
@@ -7,7 +7,7 @@
#endif
#if defined(MPI_VERSION) && defined(MPI_SUBVERSION)
-const static char mpiver_str[] = { 'I', 'N',
+static const char mpiver_str[] = { 'I', 'N',
'F', 'O',
':', 'M',
'P', 'I',
diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake
index 85e386a..5a8bfef 100644
--- a/Modules/FindOpenSSL.cmake
+++ b/Modules/FindOpenSSL.cmake
@@ -124,7 +124,11 @@ function(_OpenSSL_target_add_dependencies target)
set_property( TARGET ${target} APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${CMAKE_DL_LIBS} )
endif()
if(WIN32 AND OPENSSL_USE_STATIC_LIBS)
- set_property( TARGET ${target} APPEND PROPERTY INTERFACE_LINK_LIBRARIES ws2_32 )
+ if(WINCE)
+ set_property( TARGET ${target} APPEND PROPERTY INTERFACE_LINK_LIBRARIES ws2 )
+ else()
+ set_property( TARGET ${target} APPEND PROPERTY INTERFACE_LINK_LIBRARIES ws2_32 )
+ endif()
set_property( TARGET ${target} APPEND PROPERTY INTERFACE_LINK_LIBRARIES crypt32 )
endif()
endfunction()
diff --git a/Modules/FindXercesC.cmake b/Modules/FindXercesC.cmake
index af1b0b4..d39bbf6 100644
--- a/Modules/FindXercesC.cmake
+++ b/Modules/FindXercesC.cmake
@@ -91,11 +91,13 @@ if(NOT XercesC_LIBRARY)
NAMES "xerces-c"
"xerces-c_${XercesC_VERSION_MAJOR}"
"xerces-c-${XercesC_VERSION_MAJOR}.${XercesC_VERSION_MINOR}"
+ NAMES_PER_DIR
DOC "Xerces-C++ libraries (release)")
find_library(XercesC_LIBRARY_DEBUG
NAMES "xerces-cd"
"xerces-c_${XercesC_VERSION_MAJOR}D"
"xerces-c_${XercesC_VERSION_MAJOR}_${XercesC_VERSION_MINOR}D"
+ NAMES_PER_DIR
DOC "Xerces-C++ libraries (debug)")
include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
select_library_configurations(XercesC)
diff --git a/Modules/GenerateExportHeader.cmake b/Modules/GenerateExportHeader.cmake
index a9a9c59..7461a3e 100644
--- a/Modules/GenerateExportHeader.cmake
+++ b/Modules/GenerateExportHeader.cmake
@@ -231,7 +231,7 @@ macro(_test_compiler_hidden_visibility)
AND NOT _INTEL_TOO_OLD
AND NOT WIN32
AND NOT CYGWIN
- AND NOT CMAKE_CXX_COMPILER_ID MATCHES XL
+ AND NOT CMAKE_CXX_COMPILER_ID MATCHES "^(IBMClang|XLClang|XL)$"
AND NOT CMAKE_CXX_COMPILER_ID MATCHES "^(PGI|NVHPC)$"
AND NOT CMAKE_CXX_COMPILER_ID MATCHES Watcom)
if (CMAKE_CXX_COMPILER_LOADED)
diff --git a/Modules/Platform/AIX-IBMClang-C.cmake b/Modules/Platform/AIX-IBMClang-C.cmake
new file mode 100644
index 0000000..db21f29
--- /dev/null
+++ b/Modules/Platform/AIX-IBMClang-C.cmake
@@ -0,0 +1,2 @@
+include(Platform/AIX-IBMClang)
+__aix_compiler_ibmclang(C)
diff --git a/Modules/Platform/AIX-IBMClang-CXX.cmake b/Modules/Platform/AIX-IBMClang-CXX.cmake
new file mode 100644
index 0000000..bf580ec
--- /dev/null
+++ b/Modules/Platform/AIX-IBMClang-CXX.cmake
@@ -0,0 +1,3 @@
+include(Platform/AIX-IBMClang)
+__aix_compiler_ibmclang(CXX)
+unset(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN)
diff --git a/Modules/Platform/AIX-IBMClang.cmake b/Modules/Platform/AIX-IBMClang.cmake
new file mode 100644
index 0000000..4e5205e
--- /dev/null
+++ b/Modules/Platform/AIX-IBMClang.cmake
@@ -0,0 +1,16 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+
+# This module is shared by multiple languages; use include blocker.
+if(__AIX_COMPILER_IBMCLANG)
+ return()
+endif()
+set(__AIX_COMPILER_IBMCLANG 1)
+
+include(Platform/AIX-GNU)
+
+macro(__aix_compiler_ibmclang lang)
+ __aix_compiler_gnu(${lang})
+ unset(CMAKE_${lang}_COMPILE_OPTIONS_VISIBILITY)
+endmacro()