summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Help/command/file.rst2
-rw-r--r--Help/release/dev/0-sample-topic.rst7
-rw-r--r--Help/release/index.rst2
-rw-r--r--Modules/CMakeSwiftCompiler.cmake.in2
-rw-r--r--Modules/CMakeTestSwiftCompiler.cmake5
-rw-r--r--Modules/ExternalProject.cmake47
-rw-r--r--Modules/FindCUDAToolkit.cmake28
-rw-r--r--Modules/FindMPI.cmake60
-rw-r--r--Modules/FindOpenMP.cmake32
-rw-r--r--Modules/FindPython/Support.cmake225
-rw-r--r--Modules/Platform/Darwin.cmake2
-rw-r--r--Source/CMakeVersion.cmake6
-rw-r--r--Source/cmAddCustomCommandCommand.cxx2
-rw-r--r--Source/cmComputeLinkDepends.cxx17
-rw-r--r--Source/cmComputeLinkDepends.h3
-rw-r--r--Source/cmComputeLinkInformation.cxx82
-rw-r--r--Source/cmComputeLinkInformation.h20
-rw-r--r--Source/cmGlobVerificationManager.cxx2
-rw-r--r--Source/cmGlobalGenerator.h2
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx15
-rw-r--r--Source/cmGlobalNinjaGenerator.h4
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx4
-rw-r--r--Source/cmInstallCommand.cxx44
-rw-r--r--Source/cmLinkLineComputer.cxx22
-rw-r--r--Source/cmLinkLineDeviceComputer.cxx10
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx4
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx16
-rw-r--r--Tests/CMakeOnly/CheckStructHasMember/CMakeLists.txt6
-rw-r--r--Tests/CMakeOnly/Test.cmake.in8
-rw-r--r--Tests/CTestConfig/dashboard.cmake.in2
-rw-r--r--Tests/CTestConfig/script.cmake.in9
-rw-r--r--Tests/FindPython/VirtualEnv/CMakeLists.txt1
-rw-r--r--Tests/RunCMake/FileAPI/RunCMakeTest.cmake4
-rw-r--r--Tests/RunCMake/NinjaMultiConfig/CustomCommandDepfile-check.cmake5
-rw-r--r--Tests/RunCMake/NinjaMultiConfig/CustomCommandDepfile.cmake9
-rw-r--r--Tests/RunCMake/NinjaMultiConfig/DefaultBuildFileConfig.cmake1
-rw-r--r--Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake23
-rw-r--r--Tests/RunCMake/NinjaMultiConfig/SimpleDefaultBuildAliasListCross-target-configs-ninja-check.cmake37
-rw-r--r--Tests/RunCMake/NinjaMultiConfig/SimpleDefaultBuildAliasListCross.cmake1
-rw-r--r--Tests/RunCMake/XcodeProject/RunCMakeTest.cmake21
-rw-r--r--Tests/RunCMake/XcodeProject/XcodeRemoveExcessiveISystem.cmake52
-rw-r--r--Tests/RunCMake/XcodeProject/foo.swift2
-rw-r--r--Tests/RunCMake/XcodeProject/use_cmath.cpp6
-rw-r--r--Tests/RunCMake/file/GLOB-CONFIGURE_DEPENDS-CMP0009-RerunCMake-build-stdout.txt1
-rw-r--r--Tests/RunCMake/file/GLOB-CONFIGURE_DEPENDS-CMP0009-RerunCMake-rebuild-stdout.txt1
-rw-r--r--Tests/RunCMake/file/GLOB-CONFIGURE_DEPENDS-CMP0009-RerunCMake-stdout.txt1
-rw-r--r--Tests/RunCMake/file/GLOB-CONFIGURE_DEPENDS-CMP0009-RerunCMake.cmake10
-rw-r--r--Tests/RunCMake/file/RunCMakeTest.cmake19
-rw-r--r--Tests/RunCMake/install/TARGETS-Defaults-Cache-all-check.cmake9
-rw-r--r--Tests/RunCMake/install/TARGETS-Defaults-Cache-stderr.txt2
-rw-r--r--Tests/RunCMake/install/TARGETS-Defaults-Cache.cmake1
-rw-r--r--Tests/RunCMake/install/TARGETS-Defaults-all-check.cmake9
-rw-r--r--Tests/RunCMake/install/TARGETS-Defaults-stderr.txt2
-rw-r--r--Tests/RunCMake/install/TARGETS-Defaults.cmake1
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_string.c7
55 files changed, 641 insertions, 274 deletions
diff --git a/Help/command/file.rst b/Help/command/file.rst
index b186177eb6..df7d8bad92 100644
--- a/Help/command/file.rst
+++ b/Help/command/file.rst
@@ -540,7 +540,7 @@ are only traversed if ``FOLLOW_SYMLINKS`` is given or policy
By default ``GLOB_RECURSE`` omits directories from result list - setting
``LIST_DIRECTORIES`` to true adds directories to result list.
If ``FOLLOW_SYMLINKS`` is given or policy :policy:`CMP0009` is not set to
-``OLD`` then ``LIST_DIRECTORIES`` treats symlinks as directories.
+``NEW`` then ``LIST_DIRECTORIES`` treats symlinks as directories.
Examples of recursive globbing include::
diff --git a/Help/release/dev/0-sample-topic.rst b/Help/release/dev/0-sample-topic.rst
deleted file mode 100644
index e4cc01e23f..0000000000
--- a/Help/release/dev/0-sample-topic.rst
+++ /dev/null
@@ -1,7 +0,0 @@
-0-sample-topic
---------------
-
-* This is a sample release note for the change in a topic.
- Developers should add similar notes for each topic branch
- making a noteworthy change. Each document should be named
- and titled to match the topic name to avoid merge conflicts.
diff --git a/Help/release/index.rst b/Help/release/index.rst
index 22b1a09fb8..5d1f8a2bc2 100644
--- a/Help/release/index.rst
+++ b/Help/release/index.rst
@@ -7,8 +7,6 @@ CMake Release Notes
This file should include the adjacent "dev.txt" file
in development versions but not in release versions.
-.. include:: dev.txt
-
Releases
========
diff --git a/Modules/CMakeSwiftCompiler.cmake.in b/Modules/CMakeSwiftCompiler.cmake.in
index 7c8d1c19a7..47ada38c2c 100644
--- a/Modules/CMakeSwiftCompiler.cmake.in
+++ b/Modules/CMakeSwiftCompiler.cmake.in
@@ -12,3 +12,5 @@ set(CMAKE_Swift_COMPILER_ENV_VAR "SWIFTC")
set(CMAKE_Swift_COMPILER_ID_RUN 1)
set(CMAKE_Swift_SOURCE_FILE_EXTENSIONS swift)
+
+set(CMAKE_Swift_IMPLICIT_INCLUDE_DIRECTORIES "@CMAKE_Swift_IMPLICIT_INCLUDE_DIRECTORIES@")
diff --git a/Modules/CMakeTestSwiftCompiler.cmake b/Modules/CMakeTestSwiftCompiler.cmake
index 3e4ff95e43..d98dc9dfa3 100644
--- a/Modules/CMakeTestSwiftCompiler.cmake
+++ b/Modules/CMakeTestSwiftCompiler.cmake
@@ -50,6 +50,11 @@ else()
"the following output:\n${__CMAKE_Swift_COMPILER_OUTPUT}\n\n")
endif()
+ # Unlike C and CXX we do not yet detect any information about the Swift ABI.
+ # However, one of the steps done for C and CXX as part of that detection is
+ # to initialize the implicit include directories. That is relevant here.
+ set(CMAKE_Swift_IMPLICIT_INCLUDE_DIRECTORIES "${_CMAKE_Swift_IMPLICIT_INCLUDE_DIRECTORIES_INIT}")
+
# Re-configure to save learned information.
configure_file(${CMAKE_ROOT}/Modules/CMakeSwiftCompiler.cmake.in
${CMAKE_PLATFORM_INFO_DIR}/CMakeSwiftCompiler.cmake @ONLY)
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index db3716a1b1..c69a2ee2bf 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -1239,7 +1239,7 @@ endif()
endfunction()
-function(_ep_write_gitupdate_script script_filename git_EXECUTABLE git_tag git_remote_name init_submodules git_submodules git_repository work_dir)
+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)
if("${git_tag}" STREQUAL "")
message(FATAL_ERROR "Tag for git checkout should not be empty.")
endif()
@@ -2339,6 +2339,29 @@ function(_ep_is_dir_empty dir empty_var)
endif()
endfunction()
+function(_ep_get_git_submodules_recurse git_submodules_recurse)
+ # Checks for GIT_SUBMODULES_RECURSE property
+ # Default is ON, which sets git_submodules_recurse output variable to "--recursive"
+ # Otherwise, the output variable is set to an empty value ""
+ get_property(git_submodules_recurse_set TARGET ${name} PROPERTY _EP_GIT_SUBMODULES_RECURSE SET)
+ if(NOT git_submodules_recurse_set)
+ set(recurseFlag "--recursive")
+ else()
+ get_property(git_submodules_recurse_value TARGET ${name} PROPERTY _EP_GIT_SUBMODULES_RECURSE)
+ if(git_submodules_recurse_value)
+ set(recurseFlag "--recursive")
+ else()
+ set(recurseFlag "")
+ endif()
+ endif()
+ set(${git_submodules_recurse} "${recurseFlag}" PARENT_SCOPE)
+
+ # The git submodule update '--recursive' flag requires git >= v1.6.5
+ if(recurseFlag AND GIT_VERSION_STRING VERSION_LESS 1.6.5)
+ message(FATAL_ERROR "error: git version 1.6.5 or later required for --recursive flag with 'git submodule ...': GIT_VERSION_STRING='${GIT_VERSION_STRING}'")
+ endif()
+endfunction()
+
function(_ep_add_download_command name)
ExternalProject_Get_Property(${name} source_dir stamp_dir download_dir tmp_dir)
@@ -2431,23 +2454,7 @@ function(_ep_add_download_command name)
message(FATAL_ERROR "error: could not find git for clone of ${name}")
endif()
- get_property(git_submodules_recurse_set TARGET ${name} PROPERTY _EP_GIT_SUBMODULES_RECURSE SET)
- if(NOT git_submodules_recurse_set)
- set(git_submodules_recurse "--recursive")
- else()
- get_property(git_submodules_recurse_value TARGET ${name} PROPERTY _EP_GIT_SUBMODULES_RECURSE)
- if(git_submodules_recurse_value)
- set(git_submodules_recurse "--recursive")
- else()
- set(git_submodules_recurse "")
- endif()
- endif()
-
- # The git submodule update '--recursive' flag requires git >= v1.6.5
- #
- if(git_submodules_recurse AND GIT_VERSION_STRING VERSION_LESS 1.6.5)
- message(FATAL_ERROR "error: git version 1.6.5 or later required for 'git submodule update --recursive': GIT_VERSION_STRING='${GIT_VERSION_STRING}'")
- endif()
+ _ep_get_git_submodules_recurse(git_submodules_recurse)
get_property(git_tag TARGET ${name} PROPERTY _EP_GIT_TAG)
if(NOT git_tag)
@@ -2774,8 +2781,10 @@ function(_ep_add_update_command name)
endif()
endif()
+ _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}" ${git_repository} ${work_dir}
+ ${GIT_EXECUTABLE} ${git_tag} ${git_remote_name} ${git_init_submodules} "${git_submodules_recurse}" "${git_submodules}" ${git_repository} ${work_dir}
)
set(cmd ${CMAKE_COMMAND} -P ${tmp_dir}/${name}-gitupdate.cmake)
set(always 1)
diff --git a/Modules/FindCUDAToolkit.cmake b/Modules/FindCUDAToolkit.cmake
index 62749ed8ea..f251b417a6 100644
--- a/Modules/FindCUDAToolkit.cmake
+++ b/Modules/FindCUDAToolkit.cmake
@@ -105,6 +105,7 @@ of the following libraries that are part of the CUDAToolkit:
- :ref:`cuRAND<cuda_toolkit_cuRAND>`
- :ref:`cuSOLVER<cuda_toolkit_cuSOLVER>`
- :ref:`cuSPARSE<cuda_toolkit_cuSPARSE>`
+- :ref:`cuPTI<cuda_toolkit_cupti>`
- :ref:`NPP<cuda_toolkit_NPP>`
- :ref:`nvBLAS<cuda_toolkit_nvBLAS>`
- :ref:`nvGRAPH<cuda_toolkit_nvGRAPH>`
@@ -202,6 +203,18 @@ Targets Created:
- ``CUDA::cusparse``
- ``CUDA::cusparse_static``
+.. _`cuda_toolkit_cupti`:
+
+cupti
+"""""
+
+The `NVIDIA CUDA Profiling Tools Interface <https://developer.nvidia.com/CUPTI>`_.
+
+Targets Created:
+
+- ``CUDA::cupti``
+- ``CUDA::cupti_static``
+
.. _`cuda_toolkit_NPP`:
NPP
@@ -333,8 +346,6 @@ Targets Created:
- ``CUDA::nvml``
-.. _`cuda_toolkit_opencl`:
-
.. _`cuda_toolkit_nvToolsExt`:
nvToolsExt
@@ -347,6 +358,8 @@ Targets Created:
- ``CUDA::nvToolsExt``
+.. _`cuda_toolkit_opencl`:
+
OpenCL
""""""
@@ -732,15 +745,17 @@ endif()
if(CUDAToolkit_FOUND)
function(_CUDAToolkit_find_and_add_import_lib lib_name)
- cmake_parse_arguments(arg "" "" "ALT;DEPS" ${ARGN})
+ cmake_parse_arguments(arg "" "" "ALT;DEPS;EXTRA_PATH_SUFFIXES" ${ARGN})
set(search_names ${lib_name} ${arg_ALT})
+ message(STATUS "arg_EXTRA_PATH_SUFFIXES: ${arg_EXTRA_PATH_SUFFIXES}")
find_library(CUDA_${lib_name}_LIBRARY
NAMES ${search_names}
HINTS ${CUDAToolkit_LIBRARY_DIR}
ENV CUDA_PATH
PATH_SUFFIXES nvidia/current lib64 lib64/stubs lib/x64 lib lib/stubs
+ ${arg_EXTRA_PATH_SUFFIXES}
)
if (NOT TARGET CUDA::${lib_name} AND CUDA_${lib_name}_LIBRARY)
@@ -815,6 +830,13 @@ if(CUDAToolkit_FOUND)
_CUDAToolkit_find_and_add_import_lib(${cuda_lib}_static DEPS nppc_static)
endforeach()
+ _CUDAToolkit_find_and_add_import_lib(cupti
+ EXTRA_PATH_SUFFIXES ../extras/CUPTI/lib64/
+ ../extras/CUPTI/lib/)
+ _CUDAToolkit_find_and_add_import_lib(cupti_static
+ EXTRA_PATH_SUFFIXES ../extras/CUPTI/lib64/
+ ../extras/CUPTI/lib/)
+
_CUDAToolkit_find_and_add_import_lib(nvrtc DEPS cuda_driver)
_CUDAToolkit_find_and_add_import_lib(nvml ALT nvidia-ml nvml)
diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake
index 3e42386cd5..41e1d0809b 100644
--- a/Modules/FindMPI.cmake
+++ b/Modules/FindMPI.cmake
@@ -842,8 +842,8 @@ function (_MPI_interrogate_compiler LANG)
if(NOT MPI_${LANG}_COMPILE_DEFINITIONS)
set(MPI_${LANG}_COMPILE_DEFINITIONS ${MPI_COMPILE_DEFINITIONS_WORK} CACHE STRING "MPI ${LANG} compilation definitions" FORCE)
endif()
- if(NOT MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS)
- set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS ${MPI_INCLUDE_DIRS_WORK} CACHE STRING "MPI ${LANG} additional include directories" FORCE)
+ if(NOT MPI_${LANG}_COMPILER_INCLUDE_DIRS)
+ set(MPI_${LANG}_COMPILER_INCLUDE_DIRS ${MPI_INCLUDE_DIRS_WORK} CACHE STRING "MPI ${LANG} compiler wrapper include directories" FORCE)
endif()
if(NOT MPI_${LANG}_LINK_FLAGS)
set(MPI_${LANG}_LINK_FLAGS ${MPI_LINK_FLAGS_WORK} CACHE STRING "MPI ${LANG} linker flags" FORCE)
@@ -1071,20 +1071,41 @@ macro(_MPI_assemble_libraries LANG)
endif()
endmacro()
+macro(_MPI_assemble_include_dirs LANG)
+ set(MPI_${LANG}_INCLUDE_DIRS
+ ${MPI_${LANG}_COMPILER_INCLUDE_DIRS}
+ ${MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS}
+ )
+ if("${LANG}" MATCHES "(C|CXX)")
+ if(MPI_${LANG}_HEADER_DIR)
+ list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_HEADER_DIR}")
+ endif()
+ else() # Fortran
+ if(MPI_${LANG}_F77_HEADER_DIR)
+ list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_F77_HEADER_DIR}")
+ endif()
+ if(MPI_${LANG}_MODULE_DIR)
+ list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_MODULE_DIR}")
+ endif()
+ endif()
+ if(MPI_${LANG}_INCLUDE_DIRS)
+ list(REMOVE_DUPLICATES MPI_${LANG}_INCLUDE_DIRS)
+ endif()
+endmacro()
+
macro(_MPI_split_include_dirs LANG)
# Backwards compatibility: Search INCLUDE_PATH if given.
if(MPI_${LANG}_INCLUDE_PATH)
list(APPEND MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS "${MPI_${LANG}_INCLUDE_PATH}")
endif()
- # Preserve the include dirs before stripping out the components
- set(MPI_${LANG}_INCLUDE_DIRS ${MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS})
-
# We try to find the headers/modules among those paths (and system paths)
# For C/C++, we just need to have a look for mpi.h.
if("${LANG}" MATCHES "(C|CXX)")
find_path(MPI_${LANG}_HEADER_DIR "mpi.h"
- HINTS ${MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS}
+ HINTS
+ ${MPI_${LANG}_COMPILER_INCLUDE_DIRS}
+ ${MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS}
)
mark_as_advanced(MPI_${LANG}_HEADER_DIR)
if(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS)
@@ -1097,11 +1118,15 @@ macro(_MPI_split_include_dirs LANG)
# a Fortran 90 module.
elseif("${LANG}" STREQUAL "Fortran")
find_path(MPI_${LANG}_F77_HEADER_DIR "mpif.h"
- HINTS ${MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS}
+ HINTS
+ ${MPI_${LANG}_COMPILER_INCLUDE_DIRS}
+ ${MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS}
)
find_path(MPI_${LANG}_MODULE_DIR
NAMES "mpi.mod" "mpi_f08.mod"
- HINTS ${MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS}
+ HINTS
+ ${MPI_${LANG}_COMPILER_INCLUDE_DIRS}
+ ${MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS}
)
if(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS)
list(REMOVE_ITEM MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS
@@ -1388,7 +1413,7 @@ foreach(LANG IN ITEMS C CXX Fortran)
set(MPI_CXX_SKIP_MPICXX FALSE CACHE BOOL "If true, the MPI-2 C++ bindings are disabled using definitions.")
mark_as_advanced(MPI_CXX_SKIP_MPICXX)
endif()
- if(NOT (MPI_${LANG}_LIB_NAMES AND (MPI_${LANG}_INCLUDE_PATH OR MPI_${LANG}_INCLUDE_DIRS OR MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS)))
+ if(NOT (MPI_${LANG}_LIB_NAMES AND (MPI_${LANG}_INCLUDE_PATH OR MPI_${LANG}_INCLUDE_DIRS OR MPI_${LANG}_COMPILER_INCLUDE_DIRS)))
set(MPI_${LANG}_TRIED_IMPLICIT FALSE)
set(MPI_${LANG}_WORKS_IMPLICIT FALSE)
if(NOT MPI_${LANG}_COMPILER AND NOT MPI_ASSUME_NO_BUILTIN_MPI)
@@ -1473,7 +1498,7 @@ foreach(LANG IN ITEMS C CXX Fortran)
if("${LANG}" STREQUAL "CXX" AND MPI_C_WRAPPER_FOUND)
set(MPI_${LANG}_COMPILE_OPTIONS ${MPI_C_COMPILE_OPTIONS} CACHE STRING "MPI ${LANG} compilation options" )
set(MPI_${LANG}_COMPILE_DEFINITIONS ${MPI_C_COMPILE_DEFINITIONS} CACHE STRING "MPI ${LANG} compilation definitions" )
- set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS ${MPI_C_INCLUDE_DIRS} CACHE STRING "MPI ${LANG} additional include directories")
+ set(MPI_${LANG}_COMPILER_INCLUDE_DIRS ${MPI_C_INCLUDE_DIRS} CACHE STRING "MPI ${LANG} compiler wrapper include directories")
set(MPI_${LANG}_LINK_FLAGS ${MPI_C_LINK_FLAGS} CACHE STRING "MPI ${LANG} linker flags" )
set(MPI_${LANG}_LIB_NAMES ${MPI_C_LIB_NAMES} CACHE STRING "MPI ${LANG} libraries to link against" )
else()
@@ -1486,6 +1511,9 @@ foreach(LANG IN ITEMS C CXX Fortran)
if(NOT "${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}")
_MPI_split_include_dirs(${LANG})
+ _MPI_assemble_include_dirs(${LANG})
+ else()
+ set(MPI_${LANG}_INCLUDE_DIRS "")
endif()
_MPI_assemble_libraries(${LANG})
@@ -1500,13 +1528,21 @@ foreach(LANG IN ITEMS C CXX Fortran)
# Next, we'll initialize the MPI variables that have not been previously set.
set(MPI_${LANG}_COMPILE_OPTIONS "" CACHE STRING "MPI ${LANG} compilation flags" )
set(MPI_${LANG}_COMPILE_DEFINITIONS "" CACHE STRING "MPI ${LANG} compilation definitions" )
+ set(MPI_${LANG}_COMPILER_INCLUDE_DIRS "" CACHE STRING "MPI ${LANG} compiler wrapper include directories")
set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS "" CACHE STRING "MPI ${LANG} additional include directories")
set(MPI_${LANG}_LINK_FLAGS "" CACHE STRING "MPI ${LANG} linker flags" )
if(NOT MPI_${LANG}_COMPILER STREQUAL CMAKE_${LANG}_COMPILER)
set(MPI_${LANG}_LIB_NAMES "" CACHE STRING "MPI ${LANG} libraries to link against" )
endif()
- mark_as_advanced(MPI_${LANG}_COMPILE_OPTIONS MPI_${LANG}_COMPILE_DEFINITIONS MPI_${LANG}_LINK_FLAGS
- MPI_${LANG}_LIB_NAMES MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS MPI_${LANG}_COMPILER)
+ mark_as_advanced(
+ MPI_${LANG}_COMPILE_OPTIONS
+ MPI_${LANG}_COMPILE_DEFINITIONS
+ MPI_${LANG}_LINK_FLAGS
+ MPI_${LANG}_LIB_NAMES
+ MPI_${LANG}_COMPILER_INCLUDE_DIRS
+ MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS
+ MPI_${LANG}_COMPILER
+ )
# If we've found MPI, then we'll perform additional analysis: Determine the MPI version, MPI library version, supported
# MPI APIs (i.e. MPI-2 C++ bindings). For Fortran we also need to find specific parameters if we're under MPI-3.
diff --git a/Modules/FindOpenMP.cmake b/Modules/FindOpenMP.cmake
index 26fed41808..a4b1e1e48c 100644
--- a/Modules/FindOpenMP.cmake
+++ b/Modules/FindOpenMP.cmake
@@ -96,7 +96,7 @@ function(_OPENMP_FLAG_CANDIDATES LANG)
unset(OpenMP_FLAG_CANDIDATES)
set(OMP_FLAG_GNU "-fopenmp")
- set(OMP_FLAG_Clang "-fopenmp=libomp" "-fopenmp=libiomp5" "-fopenmp")
+ set(OMP_FLAG_Clang "-fopenmp=libomp" "-fopenmp=libiomp5" "-fopenmp" "-Xclang -fopenmp")
set(OMP_FLAG_AppleClang "-Xclang -fopenmp")
set(OMP_FLAG_HP "+Oopenmp")
if(WIN32)
@@ -299,6 +299,25 @@ function(_OPENMP_GET_FLAGS LANG FLAG_MODE OPENMP_FLAG_VAR OPENMP_LIB_NAMES_VAR)
break()
endif()
endif()
+ elseif(CMAKE_${LANG}_COMPILER_ID STREQUAL "Clang" AND WIN32)
+ # Check for separate OpenMP library for Clang on Windows
+ find_library(OpenMP_libomp_LIBRARY
+ NAMES libomp libgomp libiomp5
+ HINTS ${CMAKE_${LANG}_IMPLICIT_LINK_DIRECTORIES}
+ )
+ mark_as_advanced(OpenMP_libomp_LIBRARY)
+ if(OpenMP_libomp_LIBRARY)
+ try_compile( OpenMP_COMPILE_RESULT_${FLAG_MODE}_${OPENMP_PLAIN_FLAG} ${CMAKE_BINARY_DIR} ${_OPENMP_TEST_SRC}
+ CMAKE_FLAGS "-DCOMPILE_DEFINITIONS:STRING=${OPENMP_FLAGS_TEST}"
+ LINK_LIBRARIES ${CMAKE_${LANG}_VERBOSE_FLAG} ${OpenMP_libomp_LIBRARY}
+ OUTPUT_VARIABLE OpenMP_TRY_COMPILE_OUTPUT
+ )
+ if(OpenMP_COMPILE_RESULT_${FLAG_MODE}_${OPENMP_PLAIN_FLAG})
+ set("${OPENMP_FLAG_VAR}" "${OPENMP_FLAG}" PARENT_SCOPE)
+ set("${OPENMP_LIB_NAMES_VAR}" "libomp" PARENT_SCOPE)
+ break()
+ endif()
+ endif()
else()
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Detecting ${LANG} OpenMP failed with the following output:\n${OpenMP_TRY_COMPILE_OUTPUT}\n\n")
@@ -425,13 +444,12 @@ foreach(LANG IN ITEMS C CXX)
if(NOT DEFINED OpenMP_${LANG}_FLAGS OR "${OpenMP_${LANG}_FLAGS}" STREQUAL "NOTFOUND"
OR NOT DEFINED OpenMP_${LANG}_LIB_NAMES OR "${OpenMP_${LANG}_LIB_NAMES}" STREQUAL "NOTFOUND")
_OPENMP_GET_FLAGS("${LANG}" "${LANG}" OpenMP_${LANG}_FLAGS_WORK OpenMP_${LANG}_LIB_NAMES_WORK)
+ set(OpenMP_${LANG}_FLAGS "${OpenMP_${LANG}_FLAGS_WORK}"
+ CACHE STRING "${LANG} compiler flags for OpenMP parallelization" FORCE)
+ set(OpenMP_${LANG}_LIB_NAMES "${OpenMP_${LANG}_LIB_NAMES_WORK}"
+ CACHE STRING "${LANG} compiler libraries for OpenMP parallelization" FORCE)
+ mark_as_advanced(OpenMP_${LANG}_FLAGS OpenMP_${LANG}_LIB_NAMES)
endif()
-
- set(OpenMP_${LANG}_FLAGS "${OpenMP_${LANG}_FLAGS_WORK}"
- CACHE STRING "${LANG} compiler flags for OpenMP parallelization")
- set(OpenMP_${LANG}_LIB_NAMES "${OpenMP_${LANG}_LIB_NAMES_WORK}"
- CACHE STRING "${LANG} compiler libraries for OpenMP parallelization")
- mark_as_advanced(OpenMP_${LANG}_FLAGS OpenMP_${LANG}_LIB_NAMES)
endif()
endforeach()
diff --git a/Modules/FindPython/Support.cmake b/Modules/FindPython/Support.cmake
index 7483d72ad8..889d407ba6 100644
--- a/Modules/FindPython/Support.cmake
+++ b/Modules/FindPython/Support.cmake
@@ -473,14 +473,27 @@ function (_PYTHON_VALIDATE_INTERPRETER)
OUTPUT_VARIABLE version
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
- if (result OR (_PVI_EXACT AND NOT version VERSION_EQUAL expected_version) OR (version VERSION_LESS expected_version))
- # interpreter not usable or has wrong major version
- if (result)
- set (_${_PYTHON_PREFIX}_Interpreter_REASON_FAILURE "Cannot use the interpreter \"${_${_PYTHON_PREFIX}_EXECUTABLE}\"")
+ if (result)
+ # interpreter is not usable
+ set (_${_PYTHON_PREFIX}_Interpreter_REASON_FAILURE "Cannot use the interpreter \"${_${_PYTHON_PREFIX}_EXECUTABLE}\"")
+ set_property (CACHE _${_PYTHON_PREFIX}_EXECUTABLE PROPERTY VALUE "_${_PYTHON_PREFIX}_EXECUTABLE-NOTFOUND")
+ else()
+ if (_PVI_EXACT AND NOT version VERSION_EQUAL expected_version)
+ # interpreter has wrong version
+ set (_${_PYTHON_PREFIX}_Interpreter_REASON_FAILURE "Wrong version for the interpreter \"${_${_PYTHON_PREFIX}_EXECUTABLE}\"")
+ set_property (CACHE _${_PYTHON_PREFIX}_EXECUTABLE PROPERTY VALUE "_${_PYTHON_PREFIX}_EXECUTABLE-NOTFOUND")
else()
- set (_${_PYTHON_PREFIX}_Interpreter_REASON_FAILURE "Wrong major version for the interpreter \"${_${_PYTHON_PREFIX}_EXECUTABLE}\"")
+ # check that version is OK
+ string(REGEX REPLACE "^([0-9]+)\." "\\1" major_version "${version}")
+ string(REGEX REPLACE "^([0-9]+)\." "\\1" expected_major_version "${expected_version}")
+ if (NOT major_version VERSION_EQUAL expected_major_version
+ OR NOT version VERSION_GREATER_EQUAL expected_version)
+ set (_${_PYTHON_PREFIX}_Interpreter_REASON_FAILURE "Wrong version for the interpreter \"${_${_PYTHON_PREFIX}_EXECUTABLE}\"")
+ set_property (CACHE _${_PYTHON_PREFIX}_EXECUTABLE PROPERTY VALUE "_${_PYTHON_PREFIX}_EXECUTABLE-NOTFOUND")
+ endif()
endif()
- set_property (CACHE _${_PYTHON_PREFIX}_EXECUTABLE PROPERTY VALUE "_${_PYTHON_PREFIX}_EXECUTABLE-NOTFOUND")
+ endif()
+ if (NOT _${_PYTHON_PREFIX}_EXECUTABLE)
return()
endif()
else()
@@ -912,6 +925,10 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
if (DEFINED ${_PYTHON_PREFIX}_EXECUTABLE
AND IS_ABSOLUTE "${${_PYTHON_PREFIX}_EXECUTABLE}")
+ if (NOT ${_PYTHON_PREFIX}_EXECUTABLE STREQUAL _${_PYTHON_PREFIX}_EXECUTABLE)
+ # invalidate cache properties
+ unset (_${_PYTHON_PREFIX}_INTERPRETER_PROPERTIES CACHE)
+ endif()
set (_${_PYTHON_PREFIX}_EXECUTABLE "${${_PYTHON_PREFIX}_EXECUTABLE}" CACHE INTERNAL "")
elseif (DEFINED _${_PYTHON_PREFIX}_EXECUTABLE)
# compute interpreter signature and check validity of definition
@@ -925,7 +942,10 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
endif()
else()
unset (_${_PYTHON_PREFIX}_EXECUTABLE CACHE)
+ endif()
+ if (NOT _${_PYTHON_PREFIX}_EXECUTABLE)
unset (_${_PYTHON_PREFIX}_INTERPRETER_SIGNATURE CACHE)
+ unset (_${_PYTHON_PREFIX}_INTERPRETER_PROPERTIES CACHE)
endif()
endif()
@@ -1218,10 +1238,6 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
OUTPUT_STRIP_TRAILING_WHITESPACE)
if (NOT _${_PYTHON_PREFIX}_RESULT)
set (_${_PYTHON_PREFIX}_EXECUTABLE_USABLE TRUE)
- string (REGEX MATCHALL "[0-9]+" _${_PYTHON_PREFIX}_VERSIONS "${${_PYTHON_PREFIX}_VERSION}")
- list (GET _${_PYTHON_PREFIX}_VERSIONS 0 ${_PYTHON_PREFIX}_VERSION_MAJOR)
- list (GET _${_PYTHON_PREFIX}_VERSIONS 1 ${_PYTHON_PREFIX}_VERSION_MINOR)
- list (GET _${_PYTHON_PREFIX}_VERSIONS 2 ${_PYTHON_PREFIX}_VERSION_PATCH)
else()
# Interpreter is not usable
set (_${_PYTHON_PREFIX}_EXECUTABLE_USABLE FALSE)
@@ -1230,97 +1246,130 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
endif()
endif()
- if (_${_PYTHON_PREFIX}_EXECUTABLE AND _${_PYTHON_PREFIX}_EXECUTABLE_USABLE
- AND ${_PYTHON_PREFIX}_VERSION_MAJOR VERSION_EQUAL _${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR)
- set (${_PYTHON_PREFIX}_Interpreter_FOUND TRUE)
- # Use interpreter version and ABI for future searches to ensure consistency
- set (_${_PYTHON_PREFIX}_FIND_VERSIONS ${${_PYTHON_PREFIX}_VERSION_MAJOR}.${${_PYTHON_PREFIX}_VERSION_MINOR})
- execute_process (COMMAND "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c "import sys; sys.stdout.write(sys.abiflags)"
- RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT
- OUTPUT_VARIABLE _${_PYTHON_PREFIX}_ABIFLAGS
- ERROR_QUIET
- OUTPUT_STRIP_TRAILING_WHITESPACE)
- if (_${_PYTHON_PREFIX}_RESULT)
- # assunme ABI is not supported
- set (_${_PYTHON_PREFIX}_ABIFLAGS "")
- endif()
- endif()
+ if (_${_PYTHON_PREFIX}_EXECUTABLE AND _${_PYTHON_PREFIX}_EXECUTABLE_USABLE)
+ if (_${_PYTHON_PREFIX}_INTERPRETER_PROPERTIES)
+ set (${_PYTHON_PREFIX}_Interpreter_FOUND TRUE)
- if (${_PYTHON_PREFIX}_Interpreter_FOUND)
- # compute and save interpreter signature
- string (MD5 __${_PYTHON_PREFIX}_INTERPRETER_SIGNATURE "${_${_PYTHON_PREFIX}_SIGNATURE}:${_${_PYTHON_PREFIX}_EXECUTABLE}")
- set (_${_PYTHON_PREFIX}_INTERPRETER_SIGNATURE "${__${_PYTHON_PREFIX}_INTERPRETER_SIGNATURE}" CACHE INTERNAL "")
-
- if (NOT CMAKE_SIZEOF_VOID_P)
- # determine interpreter architecture
- execute_process (COMMAND "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c "import sys; print(sys.maxsize > 2**32)"
- RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT
- OUTPUT_VARIABLE ${_PYTHON_PREFIX}_IS64BIT
- ERROR_VARIABLE ${_PYTHON_PREFIX}_IS64BIT)
- if (NOT _${_PYTHON_PREFIX}_RESULT)
- if (${_PYTHON_PREFIX}_IS64BIT)
- set (_${_PYTHON_PREFIX}_ARCH 64)
- set (_${_PYTHON_PREFIX}_ARCH2 64)
- else()
- set (_${_PYTHON_PREFIX}_ARCH 32)
- set (_${_PYTHON_PREFIX}_ARCH2 32)
+ list (GET _${_PYTHON_PREFIX}_INTERPRETER_PROPERTIES 0 ${_PYTHON_PREFIX}_INTERPRETER_ID)
+
+ list (GET _${_PYTHON_PREFIX}_INTERPRETER_PROPERTIES 1 ${_PYTHON_PREFIX}_VERSION_MAJOR)
+ list (GET _${_PYTHON_PREFIX}_INTERPRETER_PROPERTIES 2 ${_PYTHON_PREFIX}_VERSION_MINOR)
+ list (GET _${_PYTHON_PREFIX}_INTERPRETER_PROPERTIES 3 ${_PYTHON_PREFIX}_VERSION_PATH)
+
+ list (GET _${_PYTHON_PREFIX}_INTERPRETER_PROPERTIES 4 _${_PYTHON_PREFIX}_ARCH)
+ set (_${_PYTHON_PREFIX}_ARCH2 ${_${_PYTHON_PREFIX}_ARCH})
+
+ list (GET _${_PYTHON_PREFIX}_INTERPRETER_PROPERTIES 5 _${_PYTHON_PREFIX}_ABIFLAGS)
+ list (GET _${_PYTHON_PREFIX}_INTERPRETER_PROPERTIES 6 ${_PYTHON_PREFIX}_SOABI)
+
+ list (GET _${_PYTHON_PREFIX}_INTERPRETER_PROPERTIES 7 ${_PYTHON_PREFIX}_STDLIB)
+ list (GET _${_PYTHON_PREFIX}_INTERPRETER_PROPERTIES 8 ${_PYTHON_PREFIX}_STDARCH)
+ list (GET _${_PYTHON_PREFIX}_INTERPRETER_PROPERTIES 9 ${_PYTHON_PREFIX}_SITELIB)
+ list (GET _${_PYTHON_PREFIX}_INTERPRETER_PROPERTIES 10 ${_PYTHON_PREFIX}_SITEARCH)
+ else()
+ string (REGEX MATCHALL "[0-9]+" _${_PYTHON_PREFIX}_VERSIONS "${${_PYTHON_PREFIX}_VERSION}")
+ list (GET _${_PYTHON_PREFIX}_VERSIONS 0 ${_PYTHON_PREFIX}_VERSION_MAJOR)
+ list (GET _${_PYTHON_PREFIX}_VERSIONS 1 ${_PYTHON_PREFIX}_VERSION_MINOR)
+ list (GET _${_PYTHON_PREFIX}_VERSIONS 2 ${_PYTHON_PREFIX}_VERSION_PATCH)
+
+ if (${_PYTHON_PREFIX}_VERSION_MAJOR VERSION_EQUAL _${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR)
+ set (${_PYTHON_PREFIX}_Interpreter_FOUND TRUE)
+
+ # Use interpreter version and ABI for future searches to ensure consistency
+ set (_${_PYTHON_PREFIX}_FIND_VERSIONS ${${_PYTHON_PREFIX}_VERSION_MAJOR}.${${_PYTHON_PREFIX}_VERSION_MINOR})
+ execute_process (COMMAND "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c "import sys; sys.stdout.write(sys.abiflags)"
+ RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT
+ OUTPUT_VARIABLE _${_PYTHON_PREFIX}_ABIFLAGS
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ if (_${_PYTHON_PREFIX}_RESULT)
+ # assunme ABI is not supported
+ set (_${_PYTHON_PREFIX}_ABIFLAGS "")
endif()
endif()
- endif()
- # retrieve interpreter identity
- execute_process (COMMAND "${_${_PYTHON_PREFIX}_EXECUTABLE}" -V
- RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT
- OUTPUT_VARIABLE ${_PYTHON_PREFIX}_INTERPRETER_ID
- ERROR_VARIABLE ${_PYTHON_PREFIX}_INTERPRETER_ID)
- if (NOT _${_PYTHON_PREFIX}_RESULT)
- if (${_PYTHON_PREFIX}_INTERPRETER_ID MATCHES "Anaconda")
- set (${_PYTHON_PREFIX}_INTERPRETER_ID "Anaconda")
- elseif (${_PYTHON_PREFIX}_INTERPRETER_ID MATCHES "Enthought")
- set (${_PYTHON_PREFIX}_INTERPRETER_ID "Canopy")
- else()
- string (REGEX REPLACE "^([^ ]+).*" "\\1" ${_PYTHON_PREFIX}_INTERPRETER_ID "${${_PYTHON_PREFIX}_INTERPRETER_ID}")
- if (${_PYTHON_PREFIX}_INTERPRETER_ID STREQUAL "Python")
- # try to get a more precise ID
- execute_process (COMMAND "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c "import sys; print(sys.copyright)"
+ if (${_PYTHON_PREFIX}_Interpreter_FOUND)
+ # compute and save interpreter signature
+ string (MD5 __${_PYTHON_PREFIX}_INTERPRETER_SIGNATURE "${_${_PYTHON_PREFIX}_SIGNATURE}:${_${_PYTHON_PREFIX}_EXECUTABLE}")
+ set (_${_PYTHON_PREFIX}_INTERPRETER_SIGNATURE "${__${_PYTHON_PREFIX}_INTERPRETER_SIGNATURE}" CACHE INTERNAL "")
+
+ if (NOT CMAKE_SIZEOF_VOID_P)
+ # determine interpreter architecture
+ execute_process (COMMAND "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c "import sys; print(sys.maxsize > 2**32)"
RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT
- OUTPUT_VARIABLE ${_PYTHON_PREFIX}_COPYRIGHT
- ERROR_QUIET)
- if (${_PYTHON_PREFIX}_COPYRIGHT MATCHES "ActiveState")
- set (${_PYTHON_PREFIX}_INTERPRETER_ID "ActivePython")
+ OUTPUT_VARIABLE ${_PYTHON_PREFIX}_IS64BIT
+ ERROR_VARIABLE ${_PYTHON_PREFIX}_IS64BIT)
+ if (NOT _${_PYTHON_PREFIX}_RESULT)
+ if (${_PYTHON_PREFIX}_IS64BIT)
+ set (_${_PYTHON_PREFIX}_ARCH 64)
+ set (_${_PYTHON_PREFIX}_ARCH2 64)
+ else()
+ set (_${_PYTHON_PREFIX}_ARCH 32)
+ set (_${_PYTHON_PREFIX}_ARCH2 32)
+ endif()
endif()
endif()
- endif()
- else()
- set (${_PYTHON_PREFIX}_INTERPRETER_ID Python)
- endif()
- # retrieve various package installation directories
- execute_process (COMMAND "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c "import sys; from distutils import sysconfig;sys.stdout.write(';'.join([sysconfig.get_python_lib(plat_specific=False,standard_lib=True),sysconfig.get_python_lib(plat_specific=True,standard_lib=True),sysconfig.get_python_lib(plat_specific=False,standard_lib=False),sysconfig.get_python_lib(plat_specific=True,standard_lib=False)]))"
- RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT
- OUTPUT_VARIABLE _${_PYTHON_PREFIX}_LIBPATHS
- ERROR_QUIET)
- if (NOT _${_PYTHON_PREFIX}_RESULT)
- list (GET _${_PYTHON_PREFIX}_LIBPATHS 0 ${_PYTHON_PREFIX}_STDLIB)
- list (GET _${_PYTHON_PREFIX}_LIBPATHS 1 ${_PYTHON_PREFIX}_STDARCH)
- list (GET _${_PYTHON_PREFIX}_LIBPATHS 2 ${_PYTHON_PREFIX}_SITELIB)
- list (GET _${_PYTHON_PREFIX}_LIBPATHS 3 ${_PYTHON_PREFIX}_SITEARCH)
- else()
- unset (${_PYTHON_PREFIX}_STDLIB)
- unset (${_PYTHON_PREFIX}_STDARCH)
- unset (${_PYTHON_PREFIX}_SITELIB)
- unset (${_PYTHON_PREFIX}_SITEARCH)
- endif()
+ # retrieve interpreter identity
+ execute_process (COMMAND "${_${_PYTHON_PREFIX}_EXECUTABLE}" -V
+ RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT
+ OUTPUT_VARIABLE ${_PYTHON_PREFIX}_INTERPRETER_ID
+ ERROR_VARIABLE ${_PYTHON_PREFIX}_INTERPRETER_ID)
+ if (NOT _${_PYTHON_PREFIX}_RESULT)
+ if (${_PYTHON_PREFIX}_INTERPRETER_ID MATCHES "Anaconda")
+ set (${_PYTHON_PREFIX}_INTERPRETER_ID "Anaconda")
+ elseif (${_PYTHON_PREFIX}_INTERPRETER_ID MATCHES "Enthought")
+ set (${_PYTHON_PREFIX}_INTERPRETER_ID "Canopy")
+ else()
+ string (REGEX REPLACE "^([^ ]+).*" "\\1" ${_PYTHON_PREFIX}_INTERPRETER_ID "${${_PYTHON_PREFIX}_INTERPRETER_ID}")
+ if (${_PYTHON_PREFIX}_INTERPRETER_ID STREQUAL "Python")
+ # try to get a more precise ID
+ execute_process (COMMAND "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c "import sys; print(sys.copyright)"
+ RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT
+ OUTPUT_VARIABLE ${_PYTHON_PREFIX}_COPYRIGHT
+ ERROR_QUIET)
+ if (${_PYTHON_PREFIX}_COPYRIGHT MATCHES "ActiveState")
+ set (${_PYTHON_PREFIX}_INTERPRETER_ID "ActivePython")
+ endif()
+ endif()
+ endif()
+ else()
+ set (${_PYTHON_PREFIX}_INTERPRETER_ID Python)
+ endif()
- if (_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR VERSION_GREATER_EQUAL 3)
- _python_get_config_var (${_PYTHON_PREFIX}_SOABI SOABI)
+ # retrieve various package installation directories
+ execute_process (COMMAND "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c "import sys; from distutils import sysconfig;sys.stdout.write(';'.join([sysconfig.get_python_lib(plat_specific=False,standard_lib=True),sysconfig.get_python_lib(plat_specific=True,standard_lib=True),sysconfig.get_python_lib(plat_specific=False,standard_lib=False),sysconfig.get_python_lib(plat_specific=True,standard_lib=False)]))"
+ RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT
+ OUTPUT_VARIABLE _${_PYTHON_PREFIX}_LIBPATHS
+ ERROR_QUIET)
+ if (NOT _${_PYTHON_PREFIX}_RESULT)
+ list (GET _${_PYTHON_PREFIX}_LIBPATHS 0 ${_PYTHON_PREFIX}_STDLIB)
+ list (GET _${_PYTHON_PREFIX}_LIBPATHS 1 ${_PYTHON_PREFIX}_STDARCH)
+ list (GET _${_PYTHON_PREFIX}_LIBPATHS 2 ${_PYTHON_PREFIX}_SITELIB)
+ list (GET _${_PYTHON_PREFIX}_LIBPATHS 3 ${_PYTHON_PREFIX}_SITEARCH)
+ else()
+ unset (${_PYTHON_PREFIX}_STDLIB)
+ unset (${_PYTHON_PREFIX}_STDARCH)
+ unset (${_PYTHON_PREFIX}_SITELIB)
+ unset (${_PYTHON_PREFIX}_SITEARCH)
+ endif()
+
+ if (_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR VERSION_GREATER_EQUAL 3)
+ _python_get_config_var (${_PYTHON_PREFIX}_SOABI SOABI)
+ endif()
+
+ # store properties in the cache to speed-up future searches
+ set (_${_PYTHON_PREFIX}_INTERPRETER_PROPERTIES
+ "${${_PYTHON_PREFIX}_INTERPRETER_ID};${${_PYTHON_PREFIX}_VERSION_MAJOR};${${_PYTHON_PREFIX}_VERSION_MINOR};${${_PYTHON_PREFIX}_VERSION_PATCH};${_${_PYTHON_PREFIX}_ARCH};${_${_PYTHON_PREFIX}_ABIFLAGS};${${_PYTHON_PREFIX}_SOABI};${${_PYTHON_PREFIX}_STDLIB};${${_PYTHON_PREFIX}_STDARCH};${${_PYTHON_PREFIX}_SITELIB};${${_PYTHON_PREFIX}_SITEARCH}" CACHE INTERNAL "${_PYTHON_PREFIX} Properties")
+ else()
+ unset (_${_PYTHON_PREFIX}_INTERPRETER_SIGNATURE CACHE)
+ unset (${_PYTHON_PREFIX}_INTERPRETER_ID)
+ endif()
endif()
- else()
- unset (_${_PYTHON_PREFIX}_INTERPRETER_SIGNATURE CACHE)
- unset (${_PYTHON_PREFIX}_INTERPRETER_ID)
endif()
mark_as_advanced (_${_PYTHON_PREFIX}_EXECUTABLE
+ _${_PYTHON_PREFIX}_INTERPRETER_PROPERTIES
_${_PYTHON_PREFIX}_INTERPRETER_SIGNATURE)
endif()
diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake
index e5a57b59fc..0a4d4e1cd4 100644
--- a/Modules/Platform/Darwin.cmake
+++ b/Modules/Platform/Darwin.cmake
@@ -210,7 +210,7 @@ unset(_apps_paths)
include(Platform/UnixPaths)
if(_CMAKE_OSX_SYSROOT_PATH AND EXISTS ${_CMAKE_OSX_SYSROOT_PATH}/usr/include)
list(APPEND CMAKE_SYSTEM_PREFIX_PATH ${_CMAKE_OSX_SYSROOT_PATH}/usr)
- foreach(lang C CXX OBJC OBJCXX)
+ foreach(lang C CXX OBJC OBJCXX Swift)
list(APPEND _CMAKE_${lang}_IMPLICIT_INCLUDE_DIRECTORIES_INIT ${_CMAKE_OSX_SYSROOT_PATH}/usr/include)
endforeach()
endif()
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 1b0765bc6b..f08760bd04 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,8 +1,8 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
-set(CMake_VERSION_MINOR 16)
-set(CMake_VERSION_PATCH 20200205)
-#set(CMake_VERSION_RC 0)
+set(CMake_VERSION_MINOR 17)
+set(CMake_VERSION_PATCH 0)
+set(CMake_VERSION_RC 0)
set(CMake_VERSION_IS_DIRTY 0)
# Start with the full version number used in tags. It has no dev info.
diff --git a/Source/cmAddCustomCommandCommand.cxx b/Source/cmAddCustomCommandCommand.cxx
index 5deba8b5a7..231a2d6303 100644
--- a/Source/cmAddCustomCommandCommand.cxx
+++ b/Source/cmAddCustomCommandCommand.cxx
@@ -174,7 +174,7 @@ bool cmAddCustomCommandCommand(std::vector<std::string> const& args,
doing = doing_comment;
} else if (copy == keyDEPFILE) {
doing = doing_depfile;
- if (mf.GetGlobalGenerator()->GetName() != "Ninja") {
+ if (!mf.GetGlobalGenerator()->SupportsCustomCommandDepfile()) {
status.SetError("Option DEPFILE not supported by " +
mf.GetGlobalGenerator()->GetName());
return false;
diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx
index 7a9e2b7f61..ccef9c85fa 100644
--- a/Source/cmComputeLinkDepends.cxx
+++ b/Source/cmComputeLinkDepends.cxx
@@ -301,11 +301,11 @@ int cmComputeLinkDepends::AddLinkEntry(cmLinkItem const& item)
// Initialize the item entry.
int index = lei->second;
LinkEntry& entry = this->EntryList[index];
- entry.Item = item.AsStr();
+ entry.Item = BT<std::string>(item.AsStr(), item.Backtrace);
entry.Target = item.Target;
- entry.IsFlag =
- (!entry.Target && entry.Item[0] == '-' && entry.Item[1] != 'l' &&
- entry.Item.substr(0, 10) != "-framework");
+ entry.IsFlag = (!entry.Target && entry.Item.Value[0] == '-' &&
+ entry.Item.Value[1] != 'l' &&
+ entry.Item.Value.substr(0, 10) != "-framework");
// If the item has dependencies queue it to follow them.
if (entry.Target) {
@@ -314,7 +314,7 @@ int cmComputeLinkDepends::AddLinkEntry(cmLinkItem const& item)
this->BFSQueue.push(qe);
} else {
// Look for an old-style <item>_LIB_DEPENDS variable.
- std::string var = cmStrCat(entry.Item, "_LIB_DEPENDS");
+ std::string var = cmStrCat(entry.Item.Value, "_LIB_DEPENDS");
if (const char* val = this->Makefile->GetDefinition(var)) {
// The item dependencies are known. Follow them.
BFSEntry qe = { index, val };
@@ -396,7 +396,7 @@ void cmComputeLinkDepends::HandleSharedDependency(SharedDepEntry const& dep)
// Initialize the item entry.
LinkEntry& entry = this->EntryList[lei->second];
- entry.Item = dep.Item.AsStr();
+ entry.Item = BT<std::string>(dep.Item.AsStr(), dep.Item.Backtrace);
entry.Target = dep.Item.Target;
// This item was added specifically because it is a dependent
@@ -671,7 +671,8 @@ void cmComputeLinkDepends::DisplayComponents()
fprintf(stderr, "Component (%u):\n", c);
NodeList const& nl = components[c];
for (int i : nl) {
- fprintf(stderr, " item %d [%s]\n", i, this->EntryList[i].Item.c_str());
+ fprintf(stderr, " item %d [%s]\n", i,
+ this->EntryList[i].Item.Value.c_str());
}
EdgeList const& ol = this->CCG->GetComponentGraphEdges(c);
for (cmGraphEdge const& oi : ol) {
@@ -819,7 +820,7 @@ void cmComputeLinkDepends::DisplayFinalEntries()
if (lei.Target) {
fprintf(stderr, " target [%s]\n", lei.Target->GetName().c_str());
} else {
- fprintf(stderr, " item [%s]\n", lei.Item.c_str());
+ fprintf(stderr, " item [%s]\n", lei.Item.Value.c_str());
}
}
fprintf(stderr, "\n");
diff --git a/Source/cmComputeLinkDepends.h b/Source/cmComputeLinkDepends.h
index 47c821b022..e806dff99e 100644
--- a/Source/cmComputeLinkDepends.h
+++ b/Source/cmComputeLinkDepends.h
@@ -14,6 +14,7 @@
#include "cmGraphAdjacencyList.h"
#include "cmLinkItem.h"
+#include "cmListFileCache.h"
#include "cmTargetLinkLibraryType.h"
class cmComputeComponentGraph;
@@ -38,7 +39,7 @@ public:
// Basic information about each link item.
struct LinkEntry
{
- std::string Item;
+ BT<std::string> Item;
cmGeneratorTarget const* Target = nullptr;
bool IsSharedDep = false;
bool IsFlag = false;
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index 7be6d2c3d4..11570d6448 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -642,7 +642,7 @@ void cmComputeLinkInformation::AddImplicitLinkInfo(std::string const& lang)
}
}
-void cmComputeLinkInformation::AddItem(std::string const& item,
+void cmComputeLinkInformation::AddItem(BT<std::string> const& item,
cmGeneratorTarget const* tgt)
{
// Compute the proper name to use to link this library.
@@ -668,7 +668,8 @@ void cmComputeLinkInformation::AddItem(std::string const& item,
std::string exe = tgt->GetFullPath(config, artifact, true);
linkItem += exe;
- this->Items.emplace_back(linkItem, true, tgt);
+ this->Items.emplace_back(BT<std::string>(linkItem, item.Backtrace), true,
+ tgt);
this->Depends.push_back(std::move(exe));
} else if (tgt->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
// Add the interface library as an item so it can be considered as part
@@ -679,7 +680,7 @@ void cmComputeLinkInformation::AddItem(std::string const& item,
// Also add the item the interface specifies to be used in its place.
std::string const& libName = tgt->GetImportedLibName(config);
if (!libName.empty()) {
- this->AddItem(libName, nullptr);
+ this->AddItem(BT<std::string>(libName, item.Backtrace), nullptr);
}
} else if (tgt->GetType() == cmStateEnums::OBJECT_LIBRARY) {
// Ignore object library!
@@ -691,8 +692,9 @@ void cmComputeLinkInformation::AddItem(std::string const& item,
: cmStateEnums::RuntimeBinaryArtifact;
// Pass the full path to the target file.
- std::string lib = tgt->GetFullPath(config, artifact, true);
- if (tgt->Target->IsAIX() && cmHasLiteralSuffix(lib, "-NOTFOUND") &&
+ BT<std::string> lib = BT<std::string>(
+ tgt->GetFullPath(config, artifact, true), item.Backtrace);
+ if (tgt->Target->IsAIX() && cmHasLiteralSuffix(lib.Value, "-NOTFOUND") &&
artifact == cmStateEnums::ImportLibraryArtifact) {
// This is an imported executable on AIX that has ENABLE_EXPORTS
// but not IMPORTED_IMPLIB. CMake used to produce and accept such
@@ -703,23 +705,23 @@ void cmComputeLinkInformation::AddItem(std::string const& item,
}
if (!this->LinkDependsNoShared ||
tgt->GetType() != cmStateEnums::SHARED_LIBRARY) {
- this->Depends.push_back(lib);
+ this->Depends.push_back(lib.Value);
}
this->AddTargetItem(lib, tgt);
- this->AddLibraryRuntimeInfo(lib, tgt);
+ this->AddLibraryRuntimeInfo(lib.Value, tgt);
}
} else {
// This is not a CMake target. Use the name given.
- if (cmSystemTools::FileIsFullPath(item)) {
- if (cmSystemTools::FileIsDirectory(item)) {
+ if (cmSystemTools::FileIsFullPath(item.Value)) {
+ if (cmSystemTools::FileIsDirectory(item.Value)) {
// This is a directory.
- this->AddDirectoryItem(item);
+ this->AddDirectoryItem(item.Value);
} else {
// Use the full path given to the library file.
- this->Depends.push_back(item);
+ this->Depends.push_back(item.Value);
this->AddFullItem(item);
- this->AddLibraryRuntimeInfo(item);
+ this->AddLibraryRuntimeInfo(item.Value);
}
} else {
// This is a library or option specified by the user.
@@ -728,7 +730,7 @@ void cmComputeLinkInformation::AddItem(std::string const& item,
}
}
-void cmComputeLinkInformation::AddSharedDepItem(std::string const& item,
+void cmComputeLinkInformation::AddSharedDepItem(BT<std::string> const& item,
const cmGeneratorTarget* tgt)
{
// If dropping shared library dependencies, ignore them.
@@ -747,12 +749,12 @@ void cmComputeLinkInformation::AddSharedDepItem(std::string const& item,
} else {
// Skip items that are not full paths. We will not be able to
// reliably specify them.
- if (!cmSystemTools::FileIsFullPath(item)) {
+ if (!cmSystemTools::FileIsFullPath(item.Value)) {
return;
}
// Get the name of the library from the file name.
- std::string file = cmSystemTools::GetFilenameName(item);
+ std::string file = cmSystemTools::GetFilenameName(item.Value);
if (!this->ExtractSharedLibraryName.find(file)) {
// This is not the name of a shared library.
return;
@@ -776,7 +778,7 @@ void cmComputeLinkInformation::AddSharedDepItem(std::string const& item,
lib = tgt->GetFullPath(this->Config, artifact);
this->AddLibraryRuntimeInfo(lib, tgt);
} else {
- lib = item;
+ lib = item.Value;
this->AddLibraryRuntimeInfo(lib);
}
@@ -1033,7 +1035,7 @@ void cmComputeLinkInformation::SetCurrentLinkType(LinkType lt)
}
}
-void cmComputeLinkInformation::AddTargetItem(std::string const& item,
+void cmComputeLinkInformation::AddTargetItem(BT<std::string> const& item,
cmGeneratorTarget const* target)
{
// This is called to handle a link item that is a full path to a target.
@@ -1054,7 +1056,7 @@ void cmComputeLinkInformation::AddTargetItem(std::string const& item,
// Handle case of an imported shared library with no soname.
if (this->NoSONameUsesPath &&
target->IsImportedSharedLibWithoutSOName(this->Config)) {
- this->AddSharedLibNoSOName(item);
+ this->AddSharedLibNoSOName(item.Value);
return;
}
@@ -1062,23 +1064,23 @@ void cmComputeLinkInformation::AddTargetItem(std::string const& item,
// the linker search path.
if (this->OldLinkDirMode && !target->IsFrameworkOnApple() &&
!cmContains(this->OldLinkDirMask,
- cmSystemTools::GetFilenamePath(item))) {
- this->OldLinkDirItems.push_back(item);
+ cmSystemTools::GetFilenamePath(item.Value))) {
+ this->OldLinkDirItems.push_back(item.Value);
}
// Now add the full path to the library.
this->Items.emplace_back(item, true, target);
}
-void cmComputeLinkInformation::AddFullItem(std::string const& item)
+void cmComputeLinkInformation::AddFullItem(BT<std::string> const& item)
{
// Check for the implicit link directory special case.
- if (this->CheckImplicitDirItem(item)) {
+ if (this->CheckImplicitDirItem(item.Value)) {
return;
}
// Check for case of shared library with no builtin soname.
- if (this->NoSONameUsesPath && this->CheckSharedLibNoSOName(item)) {
+ if (this->NoSONameUsesPath && this->CheckSharedLibNoSOName(item.Value)) {
return;
}
@@ -1088,9 +1090,9 @@ void cmComputeLinkInformation::AddFullItem(std::string const& item)
if (this->Target->GetPolicyStatusCMP0008() != cmPolicies::NEW &&
(generator.find("Visual Studio") != std::string::npos ||
generator.find("Xcode") != std::string::npos)) {
- std::string file = cmSystemTools::GetFilenameName(item);
+ std::string file = cmSystemTools::GetFilenameName(item.Value);
if (!this->ExtractAnyLibraryName.find(file)) {
- this->HandleBadFullItem(item, file);
+ this->HandleBadFullItem(item.Value, file);
return;
}
}
@@ -1102,10 +1104,10 @@ void cmComputeLinkInformation::AddFullItem(std::string const& item)
// static libraries. If a previous user item changed the link type
// to static we need to make sure it is back to shared.
if (this->LinkTypeEnabled) {
- std::string name = cmSystemTools::GetFilenameName(item);
+ std::string name = cmSystemTools::GetFilenameName(item.Value);
if (this->ExtractSharedLibraryName.find(name)) {
this->SetCurrentLinkType(LinkShared);
- } else if (!this->ExtractStaticLibraryName.find(item)) {
+ } else if (!this->ExtractStaticLibraryName.find(item.Value)) {
// We cannot determine the type. Assume it is the target's
// default type.
this->SetCurrentLinkType(this->StartLinkType);
@@ -1116,8 +1118,8 @@ void cmComputeLinkInformation::AddFullItem(std::string const& item)
// the linker search path.
if (this->OldLinkDirMode &&
!cmContains(this->OldLinkDirMask,
- cmSystemTools::GetFilenamePath(item))) {
- this->OldLinkDirItems.push_back(item);
+ cmSystemTools::GetFilenamePath(item.Value))) {
+ this->OldLinkDirItems.push_back(item.Value);
}
// Now add the full path to the library.
@@ -1181,7 +1183,7 @@ bool cmComputeLinkInformation::CheckImplicitDirItem(std::string const& item)
return true;
}
-void cmComputeLinkInformation::AddUserItem(std::string const& item,
+void cmComputeLinkInformation::AddUserItem(BT<std::string> const& item,
bool pathNotKnown)
{
// This is called to handle a link item that does not match a CMake
@@ -1193,14 +1195,14 @@ void cmComputeLinkInformation::AddUserItem(std::string const& item,
// libfoo.a ==> -Wl,-Bstatic -lfoo
// Pass flags through untouched.
- if (item[0] == '-' || item[0] == '$' || item[0] == '`') {
+ if (item.Value[0] == '-' || item.Value[0] == '$' || item.Value[0] == '`') {
// if this is a -l option then we might need to warn about
// CMP0003 so put it in OldUserFlagItems, if it is not a -l
// or -Wl,-l (-framework -pthread), then allow it without a
// CMP0003 as -L will not affect those other linker flags
- if (item.find("-l") == 0 || item.find("-Wl,-l") == 0) {
+ if (item.Value.find("-l") == 0 || item.Value.find("-Wl,-l") == 0) {
// This is a linker option provided by the user.
- this->OldUserFlagItems.push_back(item);
+ this->OldUserFlagItems.push_back(item.Value);
}
// Restore the target link type since this item does not specify
@@ -1223,7 +1225,7 @@ void cmComputeLinkInformation::AddUserItem(std::string const& item,
// libraries. On AIX a library with the name libfoo.a can be
// shared!
std::string lib;
- if (this->ExtractSharedLibraryName.find(item)) {
+ if (this->ExtractSharedLibraryName.find(item.Value)) {
// This matches a shared library file name.
#ifdef CM_COMPUTE_LINK_INFO_DEBUG
fprintf(stderr, "shared regex matched [%s] [%s] [%s]\n",
@@ -1236,7 +1238,7 @@ void cmComputeLinkInformation::AddUserItem(std::string const& item,
// Use just the library name so the linker will search.
lib = this->ExtractSharedLibraryName.match(2);
- } else if (this->ExtractStaticLibraryName.find(item)) {
+ } else if (this->ExtractStaticLibraryName.find(item.Value)) {
// This matches a static library file name.
#ifdef CM_COMPUTE_LINK_INFO_DEBUG
fprintf(stderr, "static regex matched [%s] [%s] [%s]\n",
@@ -1249,7 +1251,7 @@ void cmComputeLinkInformation::AddUserItem(std::string const& item,
// Use just the library name so the linker will search.
lib = this->ExtractStaticLibraryName.match(2);
- } else if (this->ExtractAnyLibraryName.find(item)) {
+ } else if (this->ExtractAnyLibraryName.find(item.Value)) {
// This matches a library file name.
#ifdef CM_COMPUTE_LINK_INFO_DEBUG
fprintf(stderr, "any regex matched [%s] [%s] [%s]\n",
@@ -1266,19 +1268,19 @@ void cmComputeLinkInformation::AddUserItem(std::string const& item,
} else {
// This is a name specified by the user.
if (pathNotKnown) {
- this->OldUserFlagItems.push_back(item);
+ this->OldUserFlagItems.push_back(item.Value);
}
// We must ask the linker to search for a library with this name.
// Restore the target link type since this item does not specify
// one.
this->SetCurrentLinkType(this->StartLinkType);
- lib = item;
+ lib = item.Value;
}
// Create an option to ask the linker to search for the library.
std::string out = cmStrCat(this->LibLinkFlag, lib, this->LibLinkSuffix);
- this->Items.emplace_back(out, false);
+ this->Items.emplace_back(BT<std::string>(out, item.Backtrace), false);
// Here we could try to find the library the linker will find and
// add a runtime information entry for it. It would probably not be
@@ -1308,7 +1310,7 @@ void cmComputeLinkInformation::AddFrameworkItem(std::string const& item)
this->AddLibraryRuntimeInfo(full_fw);
// Add the item using the -framework option.
- this->Items.emplace_back("-framework", false);
+ this->Items.emplace_back(std::string("-framework"), false);
cmOutputConverter converter(this->Makefile->GetStateSnapshot());
fw = converter.EscapeForShell(fw);
this->Items.emplace_back(fw, false);
diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h
index 3bc9c16c7e..e50d369beb 100644
--- a/Source/cmComputeLinkInformation.h
+++ b/Source/cmComputeLinkInformation.h
@@ -14,13 +14,13 @@
#include "cmsys/RegularExpression.hxx"
+#include "cmListFileCache.h"
+
class cmGeneratorTarget;
class cmGlobalGenerator;
class cmMakefile;
class cmOrderDirectories;
class cmake;
-template <typename T>
-class BT;
/** \class cmComputeLinkInformation
* \brief Compute link information for a target in one configuration.
@@ -39,13 +39,13 @@ public:
struct Item
{
Item() = default;
- Item(std::string v, bool p, cmGeneratorTarget const* target = nullptr)
+ Item(BT<std::string> v, bool p, cmGeneratorTarget const* target = nullptr)
: Value(std::move(v))
, IsPath(p)
, Target(target)
{
}
- std::string Value;
+ BT<std::string> Value;
bool IsPath = true;
cmGeneratorTarget const* Target = nullptr;
};
@@ -78,8 +78,9 @@ public:
const cmGeneratorTarget* GetTarget() { return this->Target; }
private:
- void AddItem(std::string const& item, const cmGeneratorTarget* tgt);
- void AddSharedDepItem(std::string const& item, cmGeneratorTarget const* tgt);
+ void AddItem(BT<std::string> const& item, const cmGeneratorTarget* tgt);
+ void AddSharedDepItem(BT<std::string> const& item,
+ cmGeneratorTarget const* tgt);
// Output information.
ItemVector Items;
@@ -150,10 +151,11 @@ private:
std::string NoCaseExpression(const char* str);
// Handling of link items.
- void AddTargetItem(std::string const& item, const cmGeneratorTarget* target);
- void AddFullItem(std::string const& item);
+ void AddTargetItem(BT<std::string> const& item,
+ const cmGeneratorTarget* target);
+ void AddFullItem(BT<std::string> const& item);
bool CheckImplicitDirItem(std::string const& item);
- void AddUserItem(std::string const& item, bool pathNotKnown);
+ void AddUserItem(BT<std::string> const& item, bool pathNotKnown);
void AddDirectoryItem(std::string const& item);
void AddFrameworkItem(std::string const& item);
void DropDirectoryItem(std::string const& item);
diff --git a/Source/cmGlobVerificationManager.cxx b/Source/cmGlobVerificationManager.cxx
index 481777345a..9ac5cd5cd0 100644
--- a/Source/cmGlobVerificationManager.cxx
+++ b/Source/cmGlobVerificationManager.cxx
@@ -38,6 +38,8 @@ bool cmGlobVerificationManager::SaveVerificationScript(const std::string& path)
<< cmVersion::GetMajorVersion() << "."
<< cmVersion::GetMinorVersion() << "\n";
+ verifyScriptFile << "cmake_policy(SET CMP0009 NEW)\n";
+
for (auto const& i : this->Cache) {
CacheEntryKey k = std::get<0>(i);
CacheEntryValue v = std::get<1>(i);
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index e6ab1dd7f8..0e7e03d766 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -448,6 +448,8 @@ public:
MacFolder. */
virtual bool ShouldStripResourcePath(cmMakefile*) const;
+ virtual bool SupportsCustomCommandDepfile() const { return false; }
+
std::string GetSharedLibFlagsForLanguage(std::string const& lang) const;
/** Generate an <output>.rule file path for a given command output. */
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index ff1e5d6529..35421b6d3f 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -735,7 +735,7 @@ void cmGlobalNinjaGenerator::EnableLanguage(
if (this->IsMultiConfig()) {
if (!mf->GetDefinition("CMAKE_CONFIGURATION_TYPES")) {
mf->AddCacheDefinition(
- "CMAKE_CONFIGURATION_TYPES", "Debug;Release;MinSizeRel;RelWithDebInfo",
+ "CMAKE_CONFIGURATION_TYPES", "Debug;Release;RelWithDebInfo",
"Semicolon separated list of supported configuration types, only "
"supports Debug, Release, MinSizeRel, and RelWithDebInfo, anything "
"else will be ignored",
@@ -890,7 +890,8 @@ bool cmGlobalNinjaGenerator::OpenFileStream(
}
cm::optional<std::set<std::string>> cmGlobalNinjaGenerator::ListSubsetWithAll(
- const std::set<std::string>& defaults, const std::vector<std::string>& items)
+ const std::set<std::string>& all, const std::set<std::string>& defaults,
+ const std::vector<std::string>& items)
{
std::set<std::string> result;
@@ -901,7 +902,7 @@ cm::optional<std::set<std::string>> cmGlobalNinjaGenerator::ListSubsetWithAll(
} else {
return cm::nullopt;
}
- } else if (defaults.count(item)) {
+ } else if (all.count(item)) {
result.insert(item);
} else {
return cm::nullopt;
@@ -2640,7 +2641,7 @@ bool cmGlobalNinjaMultiGenerator::ReadCacheEntriesForBuild(
std::vector<std::string> crossConfigsVec;
cmExpandList(state.GetSafeCacheEntryValue("CMAKE_NMC_CROSS_CONFIGS"),
crossConfigsVec);
- auto crossConfigs = ListSubsetWithAll(configs, crossConfigsVec);
+ auto crossConfigs = ListSubsetWithAll(configs, configs, crossConfigsVec);
if (!crossConfigs) {
std::ostringstream msg;
msg << "CMAKE_NMC_CROSS_CONFIGS is not a subset of "
@@ -2657,6 +2658,7 @@ bool cmGlobalNinjaMultiGenerator::ReadCacheEntriesForBuild(
defaultConfigsString = this->DefaultFileConfig;
}
if (!defaultConfigsString.empty() &&
+ defaultConfigsString != this->DefaultFileConfig &&
(this->DefaultFileConfig.empty() || this->CrossConfigs.empty())) {
std::ostringstream msg;
msg << "CMAKE_NMC_DEFAULT_CONFIGS cannot be used without "
@@ -2670,8 +2672,9 @@ bool cmGlobalNinjaMultiGenerator::ReadCacheEntriesForBuild(
std::vector<std::string> defaultConfigsVec;
cmExpandList(defaultConfigsString, defaultConfigsVec);
if (!this->DefaultFileConfig.empty()) {
- auto defaultConfigs = ListSubsetWithAll(
- this->GetCrossConfigs(this->DefaultFileConfig), defaultConfigsVec);
+ auto defaultConfigs =
+ ListSubsetWithAll(this->GetCrossConfigs(this->DefaultFileConfig),
+ this->CrossConfigs, defaultConfigsVec);
if (!defaultConfigs) {
std::ostringstream msg;
msg << "CMAKE_NMC_DEFAULT_CONFIGS is not a subset of "
diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h
index 0e53c0eee7..3db8356167 100644
--- a/Source/cmGlobalNinjaGenerator.h
+++ b/Source/cmGlobalNinjaGenerator.h
@@ -211,6 +211,8 @@ public:
}
const char* GetCleanTargetName() const override { return "clean"; }
+ bool SupportsCustomCommandDepfile() const override { return true; }
+
virtual cmGeneratedFileStream* GetImplFileStream(
const std::string& /*config*/) const
{
@@ -425,7 +427,7 @@ protected:
const std::string& name);
static cm::optional<std::set<std::string>> ListSubsetWithAll(
- const std::set<std::string>& defaults,
+ const std::set<std::string>& all, const std::set<std::string>& defaults,
const std::vector<std::string>& items);
virtual bool InspectConfigTypeVariables() { return true; }
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 3d5c9c4b8b..7ec4e65cad 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -2817,11 +2817,11 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
linkLibs += sep;
sep = " ";
if (libName.IsPath) {
- linkLibs += this->XCodeEscapePath(libName.Value);
+ linkLibs += this->XCodeEscapePath(libName.Value.Value);
} else if (!libName.Target ||
libName.Target->GetType() !=
cmStateEnums::INTERFACE_LIBRARY) {
- linkLibs += libName.Value;
+ linkLibs += libName.Value.Value;
}
if (libName.Target && !libName.Target->IsImported()) {
target->AddDependTarget(configName, libName.Target->GetName());
diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx
index c67358f937..d669ed7e9b 100644
--- a/Source/cmInstallCommand.cxx
+++ b/Source/cmInstallCommand.cxx
@@ -461,6 +461,10 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
std::unique_ptr<cmInstallFilesGenerator> publicHeaderGenerator;
std::unique_ptr<cmInstallFilesGenerator> resourceGenerator;
+ // Avoid selecting default destinations for PUBLIC_HEADER and
+ // PRIVATE_HEADER if any artifacts are specified.
+ bool artifactsSpecified = false;
+
// Track whether this is a namelink-only rule.
bool namelinkOnly = false;
@@ -480,11 +484,13 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
// The import library uses the ARCHIVE properties.
archiveGenerator = CreateInstallTargetGenerator(
target, archiveArgs, true, helper.Makefile->GetBacktrace());
+ artifactsSpecified = true;
}
if (!runtimeArgs.GetDestination().empty()) {
// The DLL uses the RUNTIME properties.
runtimeGenerator = CreateInstallTargetGenerator(
target, runtimeArgs, false, helper.Makefile->GetBacktrace());
+ artifactsSpecified = true;
}
if (!archiveGenerator && !runtimeGenerator) {
archiveGenerator = CreateInstallTargetGenerator(
@@ -517,6 +523,9 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
}
} else {
// The shared library uses the LIBRARY properties.
+ if (!libraryArgs.GetDestination().empty()) {
+ artifactsSpecified = true;
+ }
if (namelinkMode != cmInstallTargetGenerator::NamelinkModeOnly) {
libraryGenerator = CreateInstallTargetGenerator(
target, libraryArgs, false, helper.Makefile->GetBacktrace(),
@@ -558,6 +567,9 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
}
} else {
// Static libraries use ARCHIVE properties.
+ if (!archiveArgs.GetDestination().empty()) {
+ artifactsSpecified = true;
+ }
archiveGenerator = CreateInstallTargetGenerator(
target, archiveArgs, false, helper.Makefile->GetBacktrace(),
helper.GetArchiveDestination(&archiveArgs));
@@ -625,6 +637,9 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
}
} else {
// Executables use the RUNTIME properties.
+ if (!runtimeArgs.GetDestination().empty()) {
+ artifactsSpecified = true;
+ }
runtimeGenerator = CreateInstallTargetGenerator(
target, runtimeArgs, false, helper.Makefile->GetBacktrace(),
helper.GetRuntimeDestination(&runtimeArgs));
@@ -637,6 +652,7 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
!archiveArgs.GetDestination().empty() &&
target.IsExecutableWithExports()) {
// The import library uses the ARCHIVE properties.
+ artifactsSpecified = true;
archiveGenerator = CreateInstallTargetGenerator(
target, archiveArgs, true, helper.Makefile->GetBacktrace(), true);
}
@@ -673,9 +689,17 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
}
// Create the files install generator.
- privateHeaderGenerator = CreateInstallFilesGenerator(
- helper.Makefile, absFiles, privateHeaderArgs, false,
- helper.GetIncludeDestination(&privateHeaderArgs));
+ if (!artifactsSpecified ||
+ !privateHeaderArgs.GetDestination().empty()) {
+ privateHeaderGenerator = CreateInstallFilesGenerator(
+ helper.Makefile, absFiles, privateHeaderArgs, false,
+ helper.GetIncludeDestination(&privateHeaderArgs));
+ } else {
+ std::ostringstream e;
+ e << "INSTALL TARGETS - target " << target.GetName() << " has "
+ << "PRIVATE_HEADER files but no PRIVATE_HEADER DESTINATION.";
+ cmSystemTools::Message(e.str(), "Warning");
+ }
}
files = target.GetProperty("PUBLIC_HEADER");
@@ -687,9 +711,17 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
}
// Create the files install generator.
- publicHeaderGenerator = CreateInstallFilesGenerator(
- helper.Makefile, absFiles, publicHeaderArgs, false,
- helper.GetIncludeDestination(&publicHeaderArgs));
+ if (!artifactsSpecified ||
+ !publicHeaderArgs.GetDestination().empty()) {
+ publicHeaderGenerator = CreateInstallFilesGenerator(
+ helper.Makefile, absFiles, publicHeaderArgs, false,
+ helper.GetIncludeDestination(&publicHeaderArgs));
+ } else {
+ std::ostringstream e;
+ e << "INSTALL TARGETS - target " << target.GetName() << " has "
+ << "PUBLIC_HEADER files but no PUBLIC_HEADER DESTINATION.";
+ cmSystemTools::Message(e.str(), "Warning");
+ }
}
files = target.GetProperty("RESOURCE");
diff --git a/Source/cmLinkLineComputer.cxx b/Source/cmLinkLineComputer.cxx
index 4320010621..86ee953a21 100644
--- a/Source/cmLinkLineComputer.cxx
+++ b/Source/cmLinkLineComputer.cxx
@@ -9,7 +9,6 @@
#include "cmComputeLinkInformation.h"
#include "cmGeneratorTarget.h"
-#include "cmLinkItem.h"
#include "cmListFileCache.h"
#include "cmOutputConverter.h"
#include "cmStateDirectory.h"
@@ -85,27 +84,14 @@ void cmLinkLineComputer::ComputeLinkLibs(
BT<std::string> linkLib;
if (item.IsPath) {
linkLib.Value += cli.GetLibLinkFileFlag();
- linkLib.Value +=
- this->ConvertToOutputFormat(this->ConvertToLinkReference(item.Value));
+ linkLib.Value += this->ConvertToOutputFormat(
+ this->ConvertToLinkReference(item.Value.Value));
+ linkLib.Backtrace = item.Value.Backtrace;
} else {
- linkLib.Value += item.Value;
+ linkLib = item.Value;
}
linkLib.Value += " ";
- const cmLinkImplementation* linkImpl =
- cli.GetTarget()->GetLinkImplementation(cli.GetConfig());
-
- for (const cmLinkImplItem& iter : linkImpl->Libraries) {
- if (iter.Target != nullptr &&
- iter.Target->GetType() != cmStateEnums::INTERFACE_LIBRARY) {
- std::string libPath = iter.Target->GetLocation(cli.GetConfig());
- if (item.Value == libPath) {
- linkLib.Backtrace = iter.Backtrace;
- break;
- }
- }
- }
-
linkLibraries.emplace_back(linkLib);
}
}
diff --git a/Source/cmLinkLineDeviceComputer.cxx b/Source/cmLinkLineDeviceComputer.cxx
index 847334b20d..65ed34caa6 100644
--- a/Source/cmLinkLineDeviceComputer.cxx
+++ b/Source/cmLinkLineDeviceComputer.cxx
@@ -115,18 +115,18 @@ void cmLinkLineDeviceComputer::ComputeLinkLibraries(
// These should be passed to nvlink. Other extensions need to be left
// out because nvlink may not understand or need them. Even though it
// can tolerate '.so' or '.dylib' it cannot tolerate '.so.1'.
- if (cmHasLiteralSuffix(item.Value, ".a") ||
- cmHasLiteralSuffix(item.Value, ".lib")) {
+ if (cmHasLiteralSuffix(item.Value.Value, ".a") ||
+ cmHasLiteralSuffix(item.Value.Value, ".lib")) {
linkLib.Value += this->ConvertToOutputFormat(
- this->ConvertToLinkReference(item.Value));
+ this->ConvertToLinkReference(item.Value.Value));
}
} else if (item.Value == "-framework") {
// This is the first part of '-framework Name' where the framework
// name is specified as a following item. Ignore both.
skipItemAfterFramework = true;
continue;
- } else if (cmLinkItemValidForDevice(item.Value)) {
- linkLib.Value += item.Value;
+ } else if (cmLinkItemValidForDevice(item.Value.Value)) {
+ linkLib.Value += item.Value.Value;
}
if (emitted.insert(linkLib.Value).second) {
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 1a6b7b2821..9aa39914a2 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -1254,11 +1254,11 @@ void cmLocalVisualStudio7GeneratorInternals::OutputLibraries(
for (auto const& lib : libs) {
if (lib.IsPath) {
std::string rel =
- lg->MaybeConvertToRelativePath(currentBinDir, lib.Value);
+ lg->MaybeConvertToRelativePath(currentBinDir, lib.Value.Value);
fout << lg->ConvertToXMLOutputPath(rel) << " ";
} else if (!lib.Target ||
lib.Target->GetType() != cmStateEnums::INTERFACE_LIBRARY) {
- fout << lib.Value << " ";
+ fout << lib.Value.Value << " ";
}
}
}
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 6b45442d88..8da113e728 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -3259,13 +3259,13 @@ bool cmVisualStudio10TargetGenerator::ComputeCudaLinkOptions(
if (l.IsPath) {
std::string path = this->LocalGenerator->MaybeConvertToRelativePath(
- currentBinDir, l.Value);
+ currentBinDir, l.Value.Value);
ConvertToWindowsSlash(path);
- if (!cmVS10IsTargetsFile(l.Value)) {
+ if (!cmVS10IsTargetsFile(l.Value.Value)) {
libVec.push_back(path);
}
} else {
- libVec.push_back(l.Value);
+ libVec.push_back(l.Value.Value);
}
}
@@ -3819,9 +3819,9 @@ bool cmVisualStudio10TargetGenerator::ComputeLibOptions(
std::string currentBinDir =
this->LocalGenerator->GetCurrentBinaryDirectory();
for (cmComputeLinkInformation::Item const& l : libs) {
- if (l.IsPath && cmVS10IsTargetsFile(l.Value)) {
+ if (l.IsPath && cmVS10IsTargetsFile(l.Value.Value)) {
std::string path = this->LocalGenerator->MaybeConvertToRelativePath(
- currentBinDir, l.Value);
+ currentBinDir, l.Value.Value);
ConvertToWindowsSlash(path);
this->AddTargetsFileAndConfigPair(path, config);
}
@@ -3905,16 +3905,16 @@ void cmVisualStudio10TargetGenerator::AddLibraries(
if (l.IsPath) {
std::string path = this->LocalGenerator->MaybeConvertToRelativePath(
- currentBinDir, l.Value);
+ currentBinDir, l.Value.Value);
ConvertToWindowsSlash(path);
- if (cmVS10IsTargetsFile(l.Value)) {
+ if (cmVS10IsTargetsFile(l.Value.Value)) {
vsTargetVec.push_back(path);
} else {
libVec.push_back(path);
}
} else if (!l.Target ||
l.Target->GetType() != cmStateEnums::INTERFACE_LIBRARY) {
- libVec.push_back(l.Value);
+ libVec.push_back(l.Value.Value);
}
}
}
diff --git a/Tests/CMakeOnly/CheckStructHasMember/CMakeLists.txt b/Tests/CMakeOnly/CheckStructHasMember/CMakeLists.txt
index a584505155..859ec41720 100644
--- a/Tests/CMakeOnly/CheckStructHasMember/CMakeLists.txt
+++ b/Tests/CMakeOnly/CheckStructHasMember/CMakeLists.txt
@@ -6,7 +6,7 @@ set(CMAKE_REQUIRED_INCLUDES "${CMAKE_CURRENT_SOURCE_DIR}")
include(CheckStructHasMember)
-foreach(_config_type Release RelWithDebInfo MinSizeRel Debug)
+foreach(_config_type Release RelWithDebInfo Debug)
set(CMAKE_TRY_COMPILE_CONFIGURATION ${_config_type})
unset(CSHM_RESULT_S1_${_config_type} CACHE)
unset(CSHM_RESULT_S2_${_config_type} CACHE)
@@ -26,7 +26,7 @@ foreach(_config_type Release RelWithDebInfo MinSizeRel Debug)
endif()
endforeach()
-foreach(_config_type Release RelWithDebInfo MinSizeRel Debug)
+foreach(_config_type Release RelWithDebInfo Debug)
set(CMAKE_TRY_COMPILE_CONFIGURATION ${_config_type})
unset(CSHM_RESULT_S1_${_config_type}_C CACHE)
unset(CSHM_RESULT_S2_${_config_type}_C CACHE)
@@ -46,7 +46,7 @@ foreach(_config_type Release RelWithDebInfo MinSizeRel Debug)
endif()
endforeach()
-foreach(_config_type Release RelWithDebInfo MinSizeRel Debug)
+foreach(_config_type Release RelWithDebInfo Debug)
set(CMAKE_TRY_COMPILE_CONFIGURATION ${_config_type})
unset(CSHM_RESULT_S1_${_config_type}_CXX CACHE)
unset(CSHM_RESULT_S2_${_config_type}_CXX CACHE)
diff --git a/Tests/CMakeOnly/Test.cmake.in b/Tests/CMakeOnly/Test.cmake.in
index 0ae8af158b..c531e8bf04 100644
--- a/Tests/CMakeOnly/Test.cmake.in
+++ b/Tests/CMakeOnly/Test.cmake.in
@@ -7,6 +7,13 @@ if(make_program)
set(maybe_make_program "-DCMAKE_MAKE_PROGRAM=${make_program}")
endif()
+set(_isMultiConfig "@_isMultiConfig@")
+if(_isMultiConfig)
+ set(cfg_opts "-DCMAKE_CONFIGURATION_TYPES=Debug\\;Release\\;RelWithDebInfo")
+else()
+ set(cfg_opts)
+endif()
+
set(source_dir "@CMAKE_CURRENT_SOURCE_DIR@/${TEST_SOURCE}")
set(binary_dir "@CMAKE_CURRENT_BINARY_DIR@/${TEST}-build")
file(REMOVE_RECURSE "${binary_dir}")
@@ -16,6 +23,7 @@ execute_process(
"${source_dir}" -G "@CMAKE_GENERATOR@"
-A "@CMAKE_GENERATOR_PLATFORM@"
-T "@CMAKE_GENERATOR_TOOLSET@"
+ ${cfg_opts}
${maybe_make_program}
WORKING_DIRECTORY "${binary_dir}"
RESULT_VARIABLE result
diff --git a/Tests/CTestConfig/dashboard.cmake.in b/Tests/CTestConfig/dashboard.cmake.in
index 4bb1262c0e..34824e3bea 100644
--- a/Tests/CTestConfig/dashboard.cmake.in
+++ b/Tests/CTestConfig/dashboard.cmake.in
@@ -13,6 +13,8 @@ message("CMAKE_CTEST_COMMAND='${CMAKE_CTEST_COMMAND}'")
set(arg "")
if(NOT _isMultiConfig)
set(arg "-DCMAKE_BUILD_TYPE:STRING=@cfg@")
+else()
+ set(arg "-DCMAKE_CONFIGURATION_TYPES=Debug\\;Release\\;MinSizeRel\\;RelWithDebInfo")
endif()
message("cmake initial configure")
diff --git a/Tests/CTestConfig/script.cmake.in b/Tests/CTestConfig/script.cmake.in
index 973c7b8c4e..59c585be53 100644
--- a/Tests/CTestConfig/script.cmake.in
+++ b/Tests/CTestConfig/script.cmake.in
@@ -6,7 +6,14 @@ set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestConfig/@cfg@-script")
ctest_start(Experimental)
-ctest_configure(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE rv)
+set(_isMultiConfig "@_isMultiConfig@")
+if(_isMultiConfig)
+ set(cfg_opts "-DCMAKE_CONFIGURATION_TYPES=Debug\\;Release\\;MinSizeRel\\;RelWithDebInfo")
+else()
+ set(cfg_opts)
+endif()
+
+ctest_configure(BUILD "${CTEST_BINARY_DIRECTORY}" OPTIONS "${cfg_opts}" RETURN_VALUE rv)
if(NOT rv STREQUAL 0)
message(FATAL_ERROR "*** error in ctest_configure ***")
endif()
diff --git a/Tests/FindPython/VirtualEnv/CMakeLists.txt b/Tests/FindPython/VirtualEnv/CMakeLists.txt
index 9e8c6734f6..045a3f2433 100644
--- a/Tests/FindPython/VirtualEnv/CMakeLists.txt
+++ b/Tests/FindPython/VirtualEnv/CMakeLists.txt
@@ -10,6 +10,7 @@ if (NOT Python3_FOUND)
endif()
set (Python3_VIRTUAL_ENV "${CMAKE_CURRENT_BINARY_DIR}/py3venv")
+file (REMOVE_RECURSE "${CMAKE_CURRENT_BINARY_DIR}/py3venv")
execute_process (COMMAND "${Python3_EXECUTABLE}" -m venv "${Python3_VIRTUAL_ENV}"
RESULT_VARIABLE result
diff --git a/Tests/RunCMake/FileAPI/RunCMakeTest.cmake b/Tests/RunCMake/FileAPI/RunCMakeTest.cmake
index f8adb644a5..8cdc00cb91 100644
--- a/Tests/RunCMake/FileAPI/RunCMakeTest.cmake
+++ b/Tests/RunCMake/FileAPI/RunCMakeTest.cmake
@@ -34,6 +34,10 @@ function(check_python case)
endif()
endfunction()
+if(RunCMake_GENERATOR_IS_MULTI_CONFIG)
+ set(RunCMake_TEST_OPTIONS "-DCMAKE_CONFIGURATION_TYPES=Debug\\;Release\\;MinSizeRel\\;RelWithDebInfo")
+endif()
+
run_cmake(Nothing)
run_cmake(Empty)
run_cmake(EmptyClient)
diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandDepfile-check.cmake b/Tests/RunCMake/NinjaMultiConfig/CustomCommandDepfile-check.cmake
new file mode 100644
index 0000000000..c595b1097b
--- /dev/null
+++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandDepfile-check.cmake
@@ -0,0 +1,5 @@
+set(log "${RunCMake_BINARY_DIR}/CustomCommandDepfile-build/CMakeFiles/impl-Debug.ninja")
+file(READ "${log}" build_file)
+if(NOT "${build_file}" MATCHES "depfile = test\\.d")
+ set(RunCMake_TEST_FAILED "Log file:\n ${log}\ndoes not have expected line: depfile = test.d")
+endif()
diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandDepfile.cmake b/Tests/RunCMake/NinjaMultiConfig/CustomCommandDepfile.cmake
new file mode 100644
index 0000000000..1a42670c9b
--- /dev/null
+++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandDepfile.cmake
@@ -0,0 +1,9 @@
+add_custom_command(
+ OUTPUT main.copy.c
+ COMMAND "${CMAKE_COMMAND}" -E copy
+ "${CMAKE_CURRENT_SOURCE_DIR}/main.c"
+ main.copy.c
+ WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
+ DEPFILE "test.d"
+ )
+add_custom_target(copy ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/main.copy.c")
diff --git a/Tests/RunCMake/NinjaMultiConfig/DefaultBuildFileConfig.cmake b/Tests/RunCMake/NinjaMultiConfig/DefaultBuildFileConfig.cmake
new file mode 100644
index 0000000000..bb7b160deb
--- /dev/null
+++ b/Tests/RunCMake/NinjaMultiConfig/DefaultBuildFileConfig.cmake
@@ -0,0 +1 @@
+# Intentionally empty
diff --git a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake
index 2344158ce4..9058b11354 100644
--- a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake
+++ b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake
@@ -81,7 +81,7 @@ endfunction()
set(RunCMake_TEST_NO_CLEAN 1)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Simple-build)
-set(RunCMake_TEST_OPTIONS "-DCMAKE_NMC_DEFAULT_BUILD_FILE_CONFIG=RelWithDebInfo;-DCMAKE_NMC_CROSS_CONFIGS=all")
+set(RunCMake_TEST_OPTIONS "-DCMAKE_CONFIGURATION_TYPES=Debug\\;Release\\;MinSizeRel\\;RelWithDebInfo;-DCMAKE_NMC_DEFAULT_BUILD_FILE_CONFIG=RelWithDebInfo;-DCMAKE_NMC_CROSS_CONFIGS=all")
run_cmake_configure(Simple)
unset(RunCMake_TEST_OPTIONS)
include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake)
@@ -113,7 +113,7 @@ run_ninja(Simple default-build-file-clean-minsizerel build.ninja clean:MinSizeRe
run_ninja(Simple default-build-file-all build.ninja all)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/SimpleDefaultBuildAlias-build)
-set(RunCMake_TEST_OPTIONS "-DCMAKE_NMC_DEFAULT_BUILD_FILE_CONFIG=Release;-DCMAKE_NMC_DEFAULT_CONFIGS=all;-DCMAKE_NMC_CROSS_CONFIGS=all")
+set(RunCMake_TEST_OPTIONS "-DCMAKE_CONFIGURATION_TYPES=Debug\\;Release\\;MinSizeRel\\;RelWithDebInfo;-DCMAKE_NMC_DEFAULT_BUILD_FILE_CONFIG=Release;-DCMAKE_NMC_DEFAULT_CONFIGS=all;-DCMAKE_NMC_CROSS_CONFIGS=all")
run_cmake_configure(SimpleDefaultBuildAlias)
unset(RunCMake_TEST_OPTIONS)
include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake)
@@ -132,6 +132,13 @@ run_cmake_build(SimpleDefaultBuildAliasList all-configs "" all)
run_ninja(SimpleDefaultBuildAliasList all-relwithdebinfo build.ninja all:RelWithDebInfo)
run_ninja(SimpleDefaultBuildAliasList clean-configs build.ninja clean)
+set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/SimpleDefaultBuildAliasListCross-build)
+set(RunCMake_TEST_OPTIONS "-DCMAKE_NMC_DEFAULT_BUILD_FILE_CONFIG=RelWithDebInfo;-DCMAKE_NMC_DEFAULT_CONFIGS=all;-DCMAKE_NMC_CROSS_CONFIGS=Debug\\;Release")
+run_cmake_configure(SimpleDefaultBuildAliasListCross)
+unset(RunCMake_TEST_OPTIONS)
+include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake)
+run_ninja(SimpleDefaultBuildAliasListCross target-configs build.ninja simpleexe)
+
unset(RunCMake_TEST_BINARY_DIR)
set(RunCMake_TEST_OPTIONS "-DCMAKE_CONFIGURATION_TYPES=Debug\\;Release;-DCMAKE_NMC_CROSS_CONFIGS=Debug\\;Release\\;RelWithDebInfo")
@@ -154,6 +161,10 @@ set(RunCMake_TEST_OPTIONS "-DCMAKE_NMC_DEFAULT_BUILD_FILE_CONFIG=Release;-DCMAKE
run_cmake(InvalidDefaultConfigsNoCross)
unset(RunCMake_TEST_OPTIONS)
+set(RunCMake_TEST_OPTIONS "-DCMAKE_NMC_DEFAULT_BUILD_FILE_CONFIG=Release")
+run_cmake(DefaultBuildFileConfig)
+unset(RunCMake_TEST_OPTIONS)
+
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/SimpleNoCross-build)
run_cmake_configure(SimpleNoCross)
include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake)
@@ -188,7 +199,7 @@ include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake)
run_cmake_build(Framework framework Debug all)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CustomCommandGenerator-build)
-set(RunCMake_TEST_OPTIONS "-DCMAKE_NMC_CROSS_CONFIGS=all")
+set(RunCMake_TEST_OPTIONS "-DCMAKE_CONFIGURATION_TYPES=Debug\\;Release\\;MinSizeRel\\;RelWithDebInfo;-DCMAKE_NMC_CROSS_CONFIGS=all")
run_cmake_configure(CustomCommandGenerator)
unset(RunCMake_TEST_OPTIONS)
include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake)
@@ -220,6 +231,10 @@ run_ninja(CustomCommandsAndTargets release-postbuild build-Release.ninja SubdirP
run_cmake_build(CustomCommandsAndTargets debug-targetpostbuild Debug TopTargetPostBuild)
run_ninja(CustomCommandsAndTargets release-targetpostbuild build-Release.ninja SubdirTargetPostBuild)
+unset(RunCMake_TEST_BINARY_DIR)
+
+run_cmake(CustomCommandDepfile)
+
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/PostfixAndLocation-build)
set(RunCMake_TEST_OPTIONS "-DCMAKE_CONFIGURATION_TYPES=Debug\\;Release;-DCMAKE_NMC_CROSS_CONFIGS=all")
run_cmake_configure(PostfixAndLocation)
@@ -236,7 +251,7 @@ run_ninja(Clean release-notall build-Release.ninja exenotall)
run_cmake_build(Clean release-clean Release clean)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/AdditionalCleanFiles-build)
-set(RunCMake_TEST_OPTIONS "-DCMAKE_NMC_CROSS_CONFIGS=all")
+set(RunCMake_TEST_OPTIONS "-DCMAKE_CONFIGURATION_TYPES=Debug\\;Release\\;MinSizeRel\\;RelWithDebInfo;-DCMAKE_NMC_CROSS_CONFIGS=all")
run_cmake_configure(AdditionalCleanFiles)
unset(RunCMake_TEST_OPTIONS)
run_cmake_build(AdditionalCleanFiles release-clean Release clean)
diff --git a/Tests/RunCMake/NinjaMultiConfig/SimpleDefaultBuildAliasListCross-target-configs-ninja-check.cmake b/Tests/RunCMake/NinjaMultiConfig/SimpleDefaultBuildAliasListCross-target-configs-ninja-check.cmake
new file mode 100644
index 0000000000..b6c77abf26
--- /dev/null
+++ b/Tests/RunCMake/NinjaMultiConfig/SimpleDefaultBuildAliasListCross-target-configs-ninja-check.cmake
@@ -0,0 +1,37 @@
+check_files("${RunCMake_TEST_BINARY_DIR}"
+ INCLUDE
+ ${GENERATED_FILES}
+
+ ${TARGET_FILE_simpleexe_Debug}
+ ${TARGET_OBJECT_FILES_simpleexe_Debug}
+
+ ${TARGET_FILE_simpleshared_Debug}
+ ${TARGET_LINKER_FILE_simpleshared_Debug}
+ ${TARGET_OBJECT_FILES_simpleshared_Debug}
+
+ ${TARGET_OBJECT_FILES_simpleobj_Debug}
+
+ ${TARGET_FILE_simpleexe_Release}
+ ${TARGET_OBJECT_FILES_simpleexe_Release}
+
+ ${TARGET_FILE_simpleshared_Release}
+ ${TARGET_LINKER_FILE_simpleshared_Release}
+ ${TARGET_OBJECT_FILES_simpleshared_Release}
+
+ ${TARGET_OBJECT_FILES_simpleobj_Release}
+
+ EXCLUDE
+ ${TARGET_OBJECT_FILES_simplestatic_Debug}
+
+ ${TARGET_OBJECT_FILES_simplestatic_Release}
+
+ ${TARGET_OBJECT_FILES_simpleexe_MinSizeRel}
+ ${TARGET_OBJECT_FILES_simpleshared_MinSizeRel}
+ ${TARGET_OBJECT_FILES_simplestatic_MinSizeRel}
+ ${TARGET_OBJECT_FILES_simpleobj_MinSizeRel}
+
+ ${TARGET_OBJECT_FILES_simpleexe_RelWithDebInfo}
+ ${TARGET_OBJECT_FILES_simpleshared_RelWithDebInfo}
+ ${TARGET_OBJECT_FILES_simplestatic_RelWithDebInfo}
+ ${TARGET_OBJECT_FILES_simpleobj_RelWithDebInfo}
+ )
diff --git a/Tests/RunCMake/NinjaMultiConfig/SimpleDefaultBuildAliasListCross.cmake b/Tests/RunCMake/NinjaMultiConfig/SimpleDefaultBuildAliasListCross.cmake
new file mode 100644
index 0000000000..2a5b708621
--- /dev/null
+++ b/Tests/RunCMake/NinjaMultiConfig/SimpleDefaultBuildAliasListCross.cmake
@@ -0,0 +1 @@
+include("${CMAKE_CURRENT_SOURCE_DIR}/Simple.cmake")
diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
index f1dda54d40..342dbbcdcc 100644
--- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
+++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
@@ -78,6 +78,15 @@ endfunction()
XcodeObjcxxFlags(XcodeObjcFlags)
XcodeObjcxxFlags(XcodeObjcxxFlags)
+function(XcodeRemoveExcessiveISystem)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeRemoveExcessiveISystem-build)
+ run_cmake(XcodeRemoveExcessiveISystem)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ run_cmake_command(XcodeRemoveExcessiveISystem-build ${CMAKE_COMMAND} --build .)
+endfunction()
+
+XcodeRemoveExcessiveISystem()
+
# Isolate device tests from host architecture selection.
unset(ENV{CMAKE_OSX_ARCHITECTURES})
@@ -297,4 +306,16 @@ if(XCODE_VERSION VERSION_GREATER_EQUAL 8)
xctest_lookup_test(tvOS appletvsimulator)
endif()
+if(XCODE_VERSION VERSION_GREATER_EQUAL 8)
+ function(XcodeRemoveExcessiveISystemSDK SDK)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeRemoveExcessiveISystemSDK-${SDK}-build)
+ set(RunCMake_TEST_OPTIONS "-DCMAKE_SYSTEM_NAME=iOS")
+ run_cmake(XcodeRemoveExcessiveISystem)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ run_cmake_command(XcodeRemoveExcessiveISystemSDK-${SDK}-build ${CMAKE_COMMAND} --build . -- -sdk ${SDK})
+ endfunction()
+
+ XcodeRemoveExcessiveISystemSDK(iphoneos)
+ XcodeRemoveExcessiveISystemSDK(iphonesimulator)
+endif()
# Please add macOS-only tests above before the device-specific tests.
diff --git a/Tests/RunCMake/XcodeProject/XcodeRemoveExcessiveISystem.cmake b/Tests/RunCMake/XcodeProject/XcodeRemoveExcessiveISystem.cmake
new file mode 100644
index 0000000000..44052f035b
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/XcodeRemoveExcessiveISystem.cmake
@@ -0,0 +1,52 @@
+cmake_minimum_required (VERSION 3.14)
+
+if(NOT "$ENV{CMAKE_OSX_ARCHITECTURES}" MATCHES "[;$]")
+ set(USE_SWIFT 1)
+else()
+ set(USE_SWIFT 0)
+endif()
+
+if(IOS)
+ set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED NO)
+ set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
+ if(XCODE_VERSION VERSION_LESS 9)
+ set(USE_SWIFT 0)
+ endif()
+endif ()
+
+enable_language (CXX)
+
+if(USE_SWIFT)
+ enable_language (Swift)
+ if(NOT XCODE_VERSION VERSION_LESS 10.2)
+ set(CMAKE_Swift_LANGUAGE_VERSION 5.0)
+ elseif(NOT XCODE_VERSION VERSION_LESS 8.0)
+ set(CMAKE_Swift_LANGUAGE_VERSION 3.0)
+ endif()
+endif()
+
+# Try to find ZLIB in the SDK rather than in system locations.
+set(CMAKE_FIND_USE_PACKAGE_ROOT_PATH FALSE)
+set(CMAKE_FIND_USE_CMAKE_PATH FALSE)
+set(CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH FALSE)
+set(CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH FALSE)
+list(REMOVE_ITEM CMAKE_SYSTEM_PREFIX_PATH /usr/local /usr / /usr/X11R6 /usr/pkg /opt /sw /opt/local)
+
+find_package(ZLIB REQUIRED)
+add_library (framework_dependency STATIC)
+target_sources (framework_dependency PRIVATE use_cmath.cpp)
+target_link_libraries(framework_dependency INTERFACE ZLIB::ZLIB)
+
+add_library (framework_test SHARED use_cmath.cpp)
+if(USE_SWIFT)
+ target_sources(framework_test PRIVATE foo.swift)
+endif()
+target_link_libraries (framework_test PRIVATE framework_dependency)
+
+set_target_properties (framework_test PROPERTIES
+ FRAMEWORK TRUE
+ FRAMEWORK_VERSION A
+ MACOSX_FRAMEWORK_IDENTIFIER "framework.test"
+ VERSION "1.0"
+ SOVERSION 1.0
+ )
diff --git a/Tests/RunCMake/XcodeProject/foo.swift b/Tests/RunCMake/XcodeProject/foo.swift
new file mode 100644
index 0000000000..fb2d3dc438
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/foo.swift
@@ -0,0 +1,2 @@
+func foo() {
+}
diff --git a/Tests/RunCMake/XcodeProject/use_cmath.cpp b/Tests/RunCMake/XcodeProject/use_cmath.cpp
new file mode 100644
index 0000000000..8a58af5a18
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/use_cmath.cpp
@@ -0,0 +1,6 @@
+#include <cmath>
+
+bool foo(double arg)
+{
+ return std::isfinite(arg);
+}
diff --git a/Tests/RunCMake/file/GLOB-CONFIGURE_DEPENDS-CMP0009-RerunCMake-build-stdout.txt b/Tests/RunCMake/file/GLOB-CONFIGURE_DEPENDS-CMP0009-RerunCMake-build-stdout.txt
new file mode 100644
index 0000000000..05c9a91569
--- /dev/null
+++ b/Tests/RunCMake/file/GLOB-CONFIGURE_DEPENDS-CMP0009-RerunCMake-build-stdout.txt
@@ -0,0 +1 @@
+test2/test_folder_symlink
diff --git a/Tests/RunCMake/file/GLOB-CONFIGURE_DEPENDS-CMP0009-RerunCMake-rebuild-stdout.txt b/Tests/RunCMake/file/GLOB-CONFIGURE_DEPENDS-CMP0009-RerunCMake-rebuild-stdout.txt
new file mode 100644
index 0000000000..05c9a91569
--- /dev/null
+++ b/Tests/RunCMake/file/GLOB-CONFIGURE_DEPENDS-CMP0009-RerunCMake-rebuild-stdout.txt
@@ -0,0 +1 @@
+test2/test_folder_symlink
diff --git a/Tests/RunCMake/file/GLOB-CONFIGURE_DEPENDS-CMP0009-RerunCMake-stdout.txt b/Tests/RunCMake/file/GLOB-CONFIGURE_DEPENDS-CMP0009-RerunCMake-stdout.txt
new file mode 100644
index 0000000000..1fbac010aa
--- /dev/null
+++ b/Tests/RunCMake/file/GLOB-CONFIGURE_DEPENDS-CMP0009-RerunCMake-stdout.txt
@@ -0,0 +1 @@
+.*Running CMake on GLOB-CONFIGURE_DEPENDS-CMP0009-RerunCMake
diff --git a/Tests/RunCMake/file/GLOB-CONFIGURE_DEPENDS-CMP0009-RerunCMake.cmake b/Tests/RunCMake/file/GLOB-CONFIGURE_DEPENDS-CMP0009-RerunCMake.cmake
new file mode 100644
index 0000000000..da40534379
--- /dev/null
+++ b/Tests/RunCMake/file/GLOB-CONFIGURE_DEPENDS-CMP0009-RerunCMake.cmake
@@ -0,0 +1,10 @@
+cmake_policy(SET CMP0009 NEW)
+message(STATUS "Running CMake on GLOB-CONFIGURE_DEPENDS-CMP0009-RerunCMake")
+file(GLOB_RECURSE
+ CONTENT_LIST
+ CONFIGURE_DEPENDS
+ LIST_DIRECTORIES false
+ RELATIVE "${CMAKE_CURRENT_BINARY_DIR}"
+ "${CMAKE_CURRENT_BINARY_DIR}/test2/*"
+ )
+add_custom_target(CONTENT_ECHO ALL ${CMAKE_COMMAND} -E echo ${CONTENT_LIST})
diff --git a/Tests/RunCMake/file/RunCMakeTest.cmake b/Tests/RunCMake/file/RunCMakeTest.cmake
index 8d1b9813d6..f5461ad8a8 100644
--- a/Tests/RunCMake/file/RunCMakeTest.cmake
+++ b/Tests/RunCMake/file/RunCMakeTest.cmake
@@ -111,7 +111,7 @@ else()
set(tf_1 "${RunCMake_TEST_BINARY_DIR}/test/1.txt")
file(WRITE "${tf_1}" "1")
- message(STATUS "GLOB-RerunCMake: first configuration...")
+ message(STATUS "GLOB-CONFIGURE_DEPENDS-RerunCMake: first configuration...")
run_cmake(GLOB-CONFIGURE_DEPENDS-RerunCMake)
run_cmake_command(GLOB-CONFIGURE_DEPENDS-RerunCMake-build ${CMAKE_COMMAND} --build .)
@@ -125,10 +125,25 @@ else()
execute_process(COMMAND ${CMAKE_COMMAND} -E sleep ${fs_delay})
message(STATUS "GLOB-CONFIGURE_DEPENDS-RerunCMake: remove first test file...")
- file(REMOVE "${RunCMake_TEST_BINARY_DIR}/test/1.txt")
+ file(REMOVE "${tf_1}")
run_cmake_command(GLOB-CONFIGURE_DEPENDS-RerunCMake-rebuild_second ${CMAKE_COMMAND} --build .)
run_cmake_command(GLOB-CONFIGURE_DEPENDS-RerunCMake-nowork ${CMAKE_COMMAND} --build .)
+ if(NOT WIN32 OR CYGWIN)
+ message(STATUS "GLOB-CONFIGURE_DEPENDS-CMP0009-RerunCMake: link the first test directory into a new directory...")
+ file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}/test2")
+ execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink "${RunCMake_TEST_BINARY_DIR}/test" "${RunCMake_TEST_BINARY_DIR}/test2/test_folder_symlink")
+
+ message(STATUS "GLOB-CONFIGURE_DEPENDS-CMP0009-RerunCMake: first configuration...")
+ run_cmake(GLOB-CONFIGURE_DEPENDS-CMP0009-RerunCMake)
+ run_cmake_command(GLOB-CONFIGURE_DEPENDS-CMP0009-RerunCMake-build ${CMAKE_COMMAND} --build .)
+
+ message(STATUS "GLOB-CONFIGURE_DEPENDS-CMP0009-RerunCMake: add another file in the linked directory...")
+ set(tf_3 "${RunCMake_TEST_BINARY_DIR}/test/3.txt")
+ file(WRITE "${tf_3}" "3")
+ run_cmake_command(GLOB-CONFIGURE_DEPENDS-CMP0009-RerunCMake-rebuild ${CMAKE_COMMAND} --build .)
+ endif()
+
unset(RunCMake_TEST_BINARY_DIR)
unset(RunCMake_TEST_NO_CLEAN)
unset(RunCMake_DEFAULT_stderr)
diff --git a/Tests/RunCMake/install/TARGETS-Defaults-Cache-all-check.cmake b/Tests/RunCMake/install/TARGETS-Defaults-Cache-all-check.cmake
index 57ad6e1408..4a55cd6f0f 100644
--- a/Tests/RunCMake/install/TARGETS-Defaults-Cache-all-check.cmake
+++ b/Tests/RunCMake/install/TARGETS-Defaults-Cache-all-check.cmake
@@ -8,8 +8,7 @@ if(WIN32)
[[mybin/exe\.exe]]
[[mybin/(lib)?lib1\.dll]]
[[myinclude]]
- [[myinclude/obj4\.h]]
- [[myinclude/obj5\.h]]
+ [[myinclude/obj3\.h]]
[[mylib]]
[[mylib/(lib)?lib1\.(dll\.a|lib)]]
[[mylib/(lib)?lib2\.(a|lib)]]
@@ -24,8 +23,7 @@ elseif(CYGWIN)
[[mybin/cyglib1\.dll]]
[[mybin/exe\.exe]]
[[myinclude]]
- [[myinclude/obj4\.h]]
- [[myinclude/obj5\.h]]
+ [[myinclude/obj3\.h]]
[[mylib]]
[[mylib/liblib1\.dll\.a]]
[[mylib/liblib2\.a]]
@@ -39,8 +37,7 @@ else()
[[mybin]]
[[mybin/exe]]
[[myinclude]]
- [[myinclude/obj4\.h]]
- [[myinclude/obj5\.h]]
+ [[myinclude/obj3\.h]]
[[mylib]]
[[mylib/liblib1\.(dylib|so)]]
[[mylib/liblib2\.a]]
diff --git a/Tests/RunCMake/install/TARGETS-Defaults-Cache-stderr.txt b/Tests/RunCMake/install/TARGETS-Defaults-Cache-stderr.txt
new file mode 100644
index 0000000000..1939097040
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-Defaults-Cache-stderr.txt
@@ -0,0 +1,2 @@
+^INSTALL TARGETS - target lib3 has PRIVATE_HEADER files but no PRIVATE_HEADER DESTINATION\.
+INSTALL TARGETS - target lib4 has PUBLIC_HEADER files but no PUBLIC_HEADER DESTINATION\.$
diff --git a/Tests/RunCMake/install/TARGETS-Defaults-Cache.cmake b/Tests/RunCMake/install/TARGETS-Defaults-Cache.cmake
index bfd8c2c618..58c5273309 100644
--- a/Tests/RunCMake/install/TARGETS-Defaults-Cache.cmake
+++ b/Tests/RunCMake/install/TARGETS-Defaults-Cache.cmake
@@ -2,6 +2,7 @@ enable_language(C)
add_executable(exe main.c)
add_library(lib1 SHARED obj1.c)
+set_property(TARGET lib1 PROPERTY PUBLIC_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/obj3.h)
add_library(lib2 STATIC obj3.c)
add_library(lib3 SHARED obj4.c)
set_property(TARGET lib3 PROPERTY PRIVATE_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/obj4.h)
diff --git a/Tests/RunCMake/install/TARGETS-Defaults-all-check.cmake b/Tests/RunCMake/install/TARGETS-Defaults-all-check.cmake
index 15335b2a92..30f2266d18 100644
--- a/Tests/RunCMake/install/TARGETS-Defaults-all-check.cmake
+++ b/Tests/RunCMake/install/TARGETS-Defaults-all-check.cmake
@@ -6,8 +6,7 @@ if(WIN32)
[[include]]
[[include/obj1\.h]]
[[include/obj2\.h]]
- [[include/obj4\.h]]
- [[include/obj5\.h]]
+ [[include/obj3\.h]]
[[lib]]
[[lib/(lib)?lib1\.(dll\.a|lib)]]
[[lib/(lib)?lib2\.(a|lib)]]
@@ -24,8 +23,7 @@ elseif(CYGWIN)
[[include]]
[[include/obj1\.h]]
[[include/obj2\.h]]
- [[include/obj4\.h]]
- [[include/obj5\.h]]
+ [[include/obj3\.h]]
[[lib]]
[[lib/liblib1\.dll\.a]]
[[lib/liblib2\.a]]
@@ -41,8 +39,7 @@ else()
[[include]]
[[include/obj1\.h]]
[[include/obj2\.h]]
- [[include/obj4\.h]]
- [[include/obj5\.h]]
+ [[include/obj3\.h]]
[[lib]]
[[lib/liblib1\.(dylib|so)]]
[[lib/liblib2\.a]]
diff --git a/Tests/RunCMake/install/TARGETS-Defaults-stderr.txt b/Tests/RunCMake/install/TARGETS-Defaults-stderr.txt
new file mode 100644
index 0000000000..1939097040
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-Defaults-stderr.txt
@@ -0,0 +1,2 @@
+^INSTALL TARGETS - target lib3 has PRIVATE_HEADER files but no PRIVATE_HEADER DESTINATION\.
+INSTALL TARGETS - target lib4 has PUBLIC_HEADER files but no PUBLIC_HEADER DESTINATION\.$
diff --git a/Tests/RunCMake/install/TARGETS-Defaults.cmake b/Tests/RunCMake/install/TARGETS-Defaults.cmake
index 324aa111fe..a580657976 100644
--- a/Tests/RunCMake/install/TARGETS-Defaults.cmake
+++ b/Tests/RunCMake/install/TARGETS-Defaults.cmake
@@ -2,6 +2,7 @@ enable_language(C)
add_executable(exe main.c)
add_library(lib1 SHARED obj1.c)
+set_property(TARGET lib1 PROPERTY PUBLIC_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/obj3.h)
add_library(lib2 STATIC obj3.c)
add_library(lib3 SHARED obj4.c)
set_property(TARGET lib3 PROPERTY PRIVATE_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/obj4.h)
diff --git a/Utilities/cmlibarchive/libarchive/archive_string.c b/Utilities/cmlibarchive/libarchive/archive_string.c
index 554533ecb9..85594cc9e5 100644
--- a/Utilities/cmlibarchive/libarchive/archive_string.c
+++ b/Utilities/cmlibarchive/libarchive/archive_string.c
@@ -735,7 +735,8 @@ archive_string_append_from_wcs_in_codepage(struct archive_string *as,
else
dp = &defchar_used;
count = WideCharToMultiByte(to_cp, 0, ws, wslen,
- as->s + as->length, (int)as->buffer_length-1, NULL, dp);
+ as->s + as->length,
+ (int)as->buffer_length - as->length - 1, NULL, dp);
if (count == 0 &&
GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
/* Expand the MBS buffer and retry. */
@@ -1512,8 +1513,10 @@ get_current_codepage(void)
p = strrchr(locale, '.');
if (p == NULL)
return (GetACP());
+ if (strcmp(p+1, "utf8") == 0)
+ return CP_UTF8;
cp = my_atoi(p+1);
- if (cp <= 0)
+ if ((int)cp <= 0)
return (GetACP());
return (cp);
}