Imported Upstream version 3.16.5 upstream/3.16.5
authorDongHun Kwak <dh0128.kwak@samsung.com>
Fri, 8 Oct 2021 00:19:30 +0000 (09:19 +0900)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Fri, 8 Oct 2021 00:19:30 +0000 (09:19 +0900)
23 files changed:
Help/release/3.16.rst
Modules/Compiler/NVIDIA-CUDA.cmake
Modules/FindPkgConfig.cmake
Modules/FindPython/Support.cmake
Source/CMakeVersion.cmake
Source/cmComputeLinkDepends.cxx
Source/cmComputeLinkDepends.h
Source/cmComputeLinkInformation.cxx
Source/cmComputeLinkInformation.h
Source/cmGlobalXCodeGenerator.cxx
Source/cmInstallCommand.cxx
Source/cmLinkLineComputer.cxx
Source/cmLinkLineDeviceComputer.cxx
Source/cmLocalVisualStudio7Generator.cxx
Source/cmNinjaNormalTargetGenerator.cxx
Source/cmVisualStudio10TargetGenerator.cxx
Tests/RunCMake/install/TARGETS-Defaults-Cache-all-check.cmake
Tests/RunCMake/install/TARGETS-Defaults-Cache-stderr.txt [new file with mode: 0644]
Tests/RunCMake/install/TARGETS-Defaults-Cache.cmake
Tests/RunCMake/install/TARGETS-Defaults-all-check.cmake
Tests/RunCMake/install/TARGETS-Defaults-stderr.txt [new file with mode: 0644]
Tests/RunCMake/install/TARGETS-Defaults.cmake
Utilities/cmlibarchive/libarchive/archive_string.c

index 0d1cc1e..e2d6788 100644 (file)
@@ -277,3 +277,29 @@ Other Changes
 * When using :variable:`CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS` on Windows the
   auto-generated exports are now updated only when the object files
   providing the symbols are updated.
+
+Updates
+=======
+
+Changes made since CMake 3.16.0 include the following.
+
+3.16.2
+------
+
+* CMake 3.16.0 and 3.16.1 processed ``.hh`` files with :prop_tgt:`AUTOMOC`.
+  This was a behavior change from CMake 3.15 and below that can break
+  existing projects, so it has been reverted as of 3.16.2.
+
+3.16.5
+------
+
+* The :module:`FindPython`, :module:`FindPython2`, and :module:`FindPython3`
+  modules no longer create cache entries for ``Python{,2,3}_LIBRARY_RELEASE``
+  and ``Python{,2,3}_LIBRARY_DEBUG``.  Those values are always computed from
+  other results and so should not be cached.  The entries were created by
+  CMake 3.16.0 through 3.16.4 but were always ``FORCE``-set and could not
+  be meaningfully edited by users.
+
+  Additionally, the modules no longer expose their internal ``_Python*``
+  cache entries publicly.  CMake 3.16.0 through 3.16.4 accidentally
+  made them visible as advanced cache entries.
index b59deda..ae40100 100644 (file)
@@ -43,6 +43,6 @@ set(CMAKE_CUDA_USE_RESPONSE_FILE_FOR_LIBRARIES 0)
 set(CMAKE_CUDA_USE_RESPONSE_FILE_FOR_OBJECTS 0)
 
 if (CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL "9.0")
-  set(CMAKE_CUDA_RESPONSE_FILE_LINK_FLAG "--options-file ")
+  set(CMAKE_CUDA_RESPONSE_FILE_DEVICE_LINK_FLAG "--options-file ")
   set(CMAKE_CUDA_RESPONSE_FILE_FLAG "--options-file ")
 endif()
index 5162a44..bd1bc7c 100644 (file)
@@ -20,6 +20,10 @@ following variables will also be set:
 
 #]========================================]
 
+cmake_policy(PUSH)
+cmake_policy(SET CMP0054 NEW) # if() quoted variables not dereferenced
+cmake_policy(SET CMP0057 NEW) # if IN_LIST
+
 ### Common stuff ####
 set(PKG_CONFIG_VERSION 1)
 
@@ -770,3 +774,5 @@ Variables Affecting Behavior
 ### Local Variables:
 ### mode: cmake
 ### End:
+
+cmake_policy(POP)
index 219a885..67db4d3 100644 (file)
@@ -52,6 +52,48 @@ macro (_PYTHON_DISPLAY_FAILURE _PYTHON_MSG)
 endmacro()
 
 
+function (_PYTHON_MARK_AS_INTERNAL)
+  foreach (var IN LISTS ARGV)
+    if (DEFINED CACHE{${var}})
+      set_property (CACHE ${var} PROPERTY TYPE INTERNAL)
+    endif()
+  endforeach()
+endfunction()
+
+
+macro (_PYTHON_SELECT_LIBRARY_CONFIGURATIONS _PYTHON_BASENAME)
+  if(NOT DEFINED ${_PYTHON_BASENAME}_LIBRARY_RELEASE)
+    set(${_PYTHON_BASENAME}_LIBRARY_RELEASE "${_PYTHON_BASENAME}_LIBRARY_RELEASE-NOTFOUND")
+  endif()
+  if(NOT DEFINED ${_PYTHON_BASENAME}_LIBRARY_DEBUG)
+    set(${_PYTHON_BASENAME}_LIBRARY_DEBUG "${_PYTHON_BASENAME}_LIBRARY_DEBUG-NOTFOUND")
+  endif()
+
+  get_property(_PYTHON_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
+  if (${_PYTHON_BASENAME}_LIBRARY_DEBUG AND ${_PYTHON_BASENAME}_LIBRARY_RELEASE AND
+      NOT ${_PYTHON_BASENAME}_LIBRARY_DEBUG STREQUAL ${_PYTHON_BASENAME}_LIBRARY_RELEASE AND
+      (_PYTHON_isMultiConfig OR CMAKE_BUILD_TYPE))
+    # if the generator is multi-config or if CMAKE_BUILD_TYPE is set for
+    # single-config generators, set optimized and debug libraries
+    set (${_PYTHON_BASENAME}_LIBRARY "")
+    foreach (_PYTHON_libname IN LISTS ${_PYTHON_BASENAME}_LIBRARY_RELEASE )
+      list( APPEND ${_PYTHON_BASENAME}_LIBRARY optimized "${_PYTHON_libname}" )
+    endforeach()
+    foreach (_PYTHON_libname IN LISTS ${_PYTHON_BASENAME}_LIBRARY_DEBUG )
+      list( APPEND ${_PYTHON_BASENAME}_LIBRARY debug "${_PYTHON_libname}" )
+    endforeach()
+  elseif (${_PYTHON_BASENAME}_LIBRARY_RELEASE)
+    set (${_PYTHON_BASENAME}_LIBRARY "${${_PYTHON_BASENAME}_LIBRARY_RELEASE}")
+  elseif (${_PYTHON_BASENAME}_LIBRARY_DEBUG)
+    set (${_PYTHON_BASENAME}_LIBRARY "${${_PYTHON_BASENAME}_LIBRARY_DEBUG}")
+  else()
+    set (${_PYTHON_BASENAME}_LIBRARY "${_PYTHON_BASENAME}_LIBRARY-NOTFOUND")
+  endif()
+
+  set (${_PYTHON_BASENAME}_LIBRARIES "${${_PYTHON_BASENAME}_LIBRARY}")
+endmacro()
+
+
 macro (_PYTHON_FIND_FRAMEWORKS)
   set (${_PYTHON_PREFIX}_FRAMEWORKS)
   if (CMAKE_HOST_APPLE OR APPLE)
@@ -412,7 +454,7 @@ function (_PYTHON_VALIDATE_INTERPRETER)
 
   if (_PVI_CHECK_EXISTS AND NOT EXISTS "${_${_PYTHON_PREFIX}_EXECUTABLE}")
     # interpreter does not exist anymore
-    set_property (CACHE _${_PYTHON_PREFIX}_EXECUTABLE PROPERTY VALUE "_${_PYTHON_PREFIX}_EXECUTABLE-NOTFOUND")
+    set_property (CACHE _${_PYTHON_PREFIX}_EXECUTABLE PROPERTY VALUE "${_PYTHON_PREFIX}_EXECUTABLE-NOTFOUND")
     return()
   endif()
 
@@ -430,7 +472,7 @@ function (_PYTHON_VALIDATE_INTERPRETER)
     endif()
     if (NOT abi IN_LIST _${_PYTHON_PREFIX}_ABIFLAGS)
       # incompatible ABI
-      set_property (CACHE _${_PYTHON_PREFIX}_EXECUTABLE PROPERTY VALUE "_${_PYTHON_PREFIX}_EXECUTABLE-NOTFOUND")
+      set_property (CACHE _${_PYTHON_PREFIX}_EXECUTABLE PROPERTY VALUE "${_PYTHON_PREFIX}_EXECUTABLE-NOTFOUND")
       return()
     endif()
   endif()
@@ -447,7 +489,7 @@ function (_PYTHON_VALIDATE_INTERPRETER)
                      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
-      set_property (CACHE _${_PYTHON_PREFIX}_EXECUTABLE PROPERTY VALUE "_${_PYTHON_PREFIX}_EXECUTABLE-NOTFOUND")
+      set_property (CACHE _${_PYTHON_PREFIX}_EXECUTABLE PROPERTY VALUE "${_PYTHON_PREFIX}_EXECUTABLE-NOTFOUND")
       return()
     endif()
   else()
@@ -462,7 +504,7 @@ function (_PYTHON_VALIDATE_INTERPRETER)
                        OUTPUT_STRIP_TRAILING_WHITESPACE)
       if (result OR NOT version EQUAL _${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR)
         # interpreter not usable or has wrong major version
-        set_property (CACHE _${_PYTHON_PREFIX}_EXECUTABLE PROPERTY VALUE "_${_PYTHON_PREFIX}_EXECUTABLE-NOTFOUND")
+        set_property (CACHE _${_PYTHON_PREFIX}_EXECUTABLE PROPERTY VALUE "${_PYTHON_PREFIX}_EXECUTABLE-NOTFOUND")
         return()
       endif()
     endif()
@@ -479,7 +521,7 @@ function (_PYTHON_VALIDATE_INTERPRETER)
                      OUTPUT_STRIP_TRAILING_WHITESPACE)
     if (result OR NOT size EQUAL CMAKE_SIZEOF_VOID_P)
       # interpreter not usable or has wrong architecture
-      set_property (CACHE _${_PYTHON_PREFIX}_EXECUTABLE PROPERTY VALUE "_${_PYTHON_PREFIX}_EXECUTABLE-NOTFOUND")
+      set_property (CACHE _${_PYTHON_PREFIX}_EXECUTABLE PROPERTY VALUE "${_PYTHON_PREFIX}_EXECUTABLE-NOTFOUND")
       return()
     endif()
   endif()
@@ -503,7 +545,7 @@ function (_PYTHON_VALIDATE_COMPILER expected_version)
 
   if (_PVC_CHECK_EXISTS AND NOT EXISTS "${_${_PYTHON_PREFIX}_COMPILER}")
     # Compiler does not exist anymore
-    set_property (CACHE _${_PYTHON_PREFIX}_COMPILER PROPERTY VALUE "_${_PYTHON_PREFIX}_COMPILER-NOTFOUND")
+    set_property (CACHE _${_PYTHON_PREFIX}_COMPILER PROPERTY VALUE "${_PYTHON_PREFIX}_COMPILER-NOTFOUND")
     return()
   endif()
 
@@ -529,7 +571,7 @@ function (_PYTHON_VALIDATE_COMPILER expected_version)
 
   if (result OR (_PVC_EXACT AND NOT version VERSION_EQUAL expected_version) OR (version VERSION_LESS expected_version))
     # Compiler not usable or has wrong version
-    set_property (CACHE _${_PYTHON_PREFIX}_COMPILER PROPERTY VALUE "_${_PYTHON_PREFIX}_COMPILER-NOTFOUND")
+    set_property (CACHE _${_PYTHON_PREFIX}_COMPILER PROPERTY VALUE "${_PYTHON_PREFIX}_COMPILER-NOTFOUND")
   endif()
 endfunction()
 
@@ -548,11 +590,11 @@ function (_PYTHON_VALIDATE_LIBRARY)
 
   if (_PVL_CHECK_EXISTS AND NOT EXISTS "${_${_PYTHON_PREFIX}_LIBRARY_RELEASE}")
     # library does not exist anymore
-    set_property (CACHE _${_PYTHON_PREFIX}_LIBRARY_RELEASE PROPERTY VALUE "_${_PYTHON_PREFIX}_LIBRARY_RELEASE-NOTFOUND")
+    set_property (CACHE _${_PYTHON_PREFIX}_LIBRARY_RELEASE PROPERTY VALUE "${_PYTHON_PREFIX}_LIBRARY_RELEASE-NOTFOUND")
     if (WIN32)
-      set_property (CACHE _${_PYTHON_PREFIX}_LIBRARY_DEBUG PROPERTY VALUE "_${_PYTHON_PREFIX}_LIBRARY_DEBUG-NOTFOUND")
+      set_property (CACHE _${_PYTHON_PREFIX}_LIBRARY_DEBUG PROPERTY VALUE "${_PYTHON_PREFIX}_LIBRARY_DEBUG-NOTFOUND")
     endif()
-    set_property (CACHE _${_PYTHON_PREFIX}_INCLUDE_DIR PROPERTY VALUE "_${_PYTHON_PREFIX}_INCLUDE_DIR-NOTFOUND")
+    set_property (CACHE _${_PYTHON_PREFIX}_INCLUDE_DIR PROPERTY VALUE "${_PYTHON_PREFIX}_INCLUDE_DIR-NOTFOUND")
     return()
   endif()
 
@@ -561,26 +603,28 @@ function (_PYTHON_VALIDATE_LIBRARY)
 
   if (DEFINED _${_PYTHON_PREFIX}_FIND_ABI AND NOT lib_ABI IN_LIST _${_PYTHON_PREFIX}_ABIFLAGS)
     # incompatible ABI
-    set_property (CACHE _${_PYTHON_PREFIX}_LIBRARY_RELEASE PROPERTY VALUE "_${_PYTHON_PREFIX}_LIBRARY_RELEASE-NOTFOUND")
+    set_property (CACHE _${_PYTHON_PREFIX}_LIBRARY_RELEASE PROPERTY VALUE "${_PYTHON_PREFIX}_LIBRARY_RELEASE-NOTFOUND")
   else()
     if (expected_version)
       if ((_PVL_EXACT AND NOT lib_VERSION VERSION_EQUAL expected_version) OR (lib_VERSION VERSION_LESS expected_version))
         # library has wrong version
-        set_property (CACHE _${_PYTHON_PREFIX}_LIBRARY_RELEASE PROPERTY VALUE "_${_PYTHON_PREFIX}_LIBRARY_RELEASE-NOTFOUND")
+        set_property (CACHE _${_PYTHON_PREFIX}_LIBRARY_RELEASE PROPERTY VALUE "${_PYTHON_PREFIX}_LIBRARY_RELEASE-NOTFOUND")
       endif()
     else()
       if (NOT lib_VERSION_MAJOR VERSION_EQUAL _${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR)
         # library has wrong major version
-        set_property (CACHE _${_PYTHON_PREFIX}_LIBRARY_RELEASE PROPERTY VALUE "_${_PYTHON_PREFIX}_LIBRARY_RELEASE-NOTFOUND")
+        set_property (CACHE _${_PYTHON_PREFIX}_LIBRARY_RELEASE PROPERTY VALUE "${_PYTHON_PREFIX}_LIBRARY_RELEASE-NOTFOUND")
       endif()
     endif()
   endif()
 
   if (NOT _${_PYTHON_PREFIX}_LIBRARY_RELEASE)
     if (WIN32)
-      set_property (CACHE _${_PYTHON_PREFIX}_LIBRARY_DEBUG PROPERTY VALUE "_${_PYTHON_PREFIX}_LIBRARY_DEBUG-NOTFOUND")
+      set_property (CACHE _${_PYTHON_PREFIX}_LIBRARY_DEBUG PROPERTY VALUE "${_PYTHON_PREFIX}_LIBRARY_DEBUG-NOTFOUND")
     endif()
-    set_property (CACHE _${_PYTHON_PREFIX}_INCLUDE_DIR PROPERTY VALUE "_${_PYTHON_PREFIX}_INCLUDE_DIR-NOTFOUND")
+    unset (_${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE CACHE)
+    unset (_${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG CACHE)
+    set_property (CACHE _${_PYTHON_PREFIX}_INCLUDE_DIR PROPERTY VALUE "${_PYTHON_PREFIX}_INCLUDE_DIR-NOTFOUND")
   endif()
 endfunction()
 
@@ -599,7 +643,7 @@ function (_PYTHON_VALIDATE_INCLUDE_DIR)
 
   if (_PVID_CHECK_EXISTS AND NOT EXISTS "${_${_PYTHON_PREFIX}_INCLUDE_DIR}")
     # include file does not exist anymore
-    set_property (CACHE _${_PYTHON_PREFIX}_INCLUDE_DIR PROPERTY VALUE "_${_PYTHON_PREFIX}_INCLUDE_DIR-NOTFOUND")
+    set_property (CACHE _${_PYTHON_PREFIX}_INCLUDE_DIR PROPERTY VALUE "${_PYTHON_PREFIX}_INCLUDE_DIR-NOTFOUND")
     return()
   endif()
 
@@ -608,17 +652,17 @@ function (_PYTHON_VALIDATE_INCLUDE_DIR)
 
   if (DEFINED _${_PYTHON_PREFIX}_FIND_ABI AND NOT inc_ABI IN_LIST _${_PYTHON_PREFIX}_ABIFLAGS)
     # incompatible ABI
-    set_property (CACHE _${_PYTHON_PREFIX}_INCLUDE_DIR PROPERTY VALUE "_${_PYTHON_PREFIX}_INCLUDE_DIR-NOTFOUND")
+    set_property (CACHE _${_PYTHON_PREFIX}_INCLUDE_DIR PROPERTY VALUE "${_PYTHON_PREFIX}_INCLUDE_DIR-NOTFOUND")
   else()
     if (expected_version)
       if ((_PVID_EXACT AND NOT inc_VERSION VERSION_EQUAL expected_version) OR (inc_VERSION VERSION_LESS expected_version))
         # include dir has wrong version
-        set_property (CACHE _${_PYTHON_PREFIX}_INCLUDE_DIR PROPERTY VALUE "_${_PYTHON_PREFIX}_INCLUDE_DIR-NOTFOUND")
+        set_property (CACHE _${_PYTHON_PREFIX}_INCLUDE_DIR PROPERTY VALUE "${_PYTHON_PREFIX}_INCLUDE_DIR-NOTFOUND")
       endif()
     else()
       if (NOT inc_VERSION_MAJOR VERSION_EQUAL _${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR)
         # include dir has wrong major version
-        set_property (CACHE _${_PYTHON_PREFIX}_INCLUDE_DIR PROPERTY VALUE "_${_PYTHON_PREFIX}_INCLUDE_DIR-NOTFOUND")
+        set_property (CACHE _${_PYTHON_PREFIX}_INCLUDE_DIR PROPERTY VALUE "${_PYTHON_PREFIX}_INCLUDE_DIR-NOTFOUND")
       endif()
     endif()
   endif()
@@ -1254,8 +1298,8 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
     unset (${_PYTHON_PREFIX}_INTERPRETER_ID)
   endif()
 
-  mark_as_advanced (_${_PYTHON_PREFIX}_EXECUTABLE
-                    _${_PYTHON_PREFIX}_INTERPRETER_SIGNATURE)
+  _python_mark_as_internal (_${_PYTHON_PREFIX}_EXECUTABLE
+                            _${_PYTHON_PREFIX}_INTERPRETER_SIGNATURE)
 endif()
 
 
@@ -1447,8 +1491,8 @@ if ("Compiler" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
     unset (${_PYTHON_PREFIX}_COMPILER_ID)
   endif()
 
-  mark_as_advanced (_${_PYTHON_PREFIX}_COMPILER
-                    _${_PYTHON_PREFIX}_COMPILER_SIGNATURE)
+  _python_mark_as_internal (_${_PYTHON_PREFIX}_COMPILER
+                            _${_PYTHON_PREFIX}_COMPILER_SIGNATURE)
 endif()
 
 
@@ -1457,9 +1501,9 @@ endif()
 if ("Development" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
     AND NOT ${_PYTHON_PREFIX}_INTERPRETER_ID STREQUAL "IronPython")
   list (APPEND _${_PYTHON_PREFIX}_CACHED_VARS _${_PYTHON_PREFIX}_LIBRARY_RELEASE
-                                              ${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE
+                                              _${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE
                                               _${_PYTHON_PREFIX}_LIBRARY_DEBUG
-                                              ${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG
+                                              _${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG
                                               _${_PYTHON_PREFIX}_INCLUDE_DIR)
   if (${_PYTHON_PREFIX}_FIND_REQUIRED_Development)
     list (APPEND _${_PYTHON_PREFIX}_REQUIRED_VARS ${_PYTHON_PREFIX}_LIBRARIES
@@ -1470,10 +1514,10 @@ if ("Development" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
     # compute development signature and check validity of definition
     string (MD5 __${_PYTHON_PREFIX}_DEVELOPMENT_SIGNATURE "${_${_PYTHON_PREFIX}_SIGNATURE}:${_${_PYTHON_PREFIX}_LIBRARY_RELEASE}:${_${_PYTHON_PREFIX}_INCLUDE_DIR}")
     if (WIN32 AND NOT DEFINED _${_PYTHON_PREFIX}_LIBRARY_DEBUG)
-      set (_${_PYTHON_PREFIX}_LIBRARY_DEBUG "_${_PYTHON_PREFIX}_LIBRARY_DEBUG-NOTFOUND" CACHE INTERNAL "")
+      set (_${_PYTHON_PREFIX}_LIBRARY_DEBUG "${_PYTHON_PREFIX}_LIBRARY_DEBUG-NOTFOUND" CACHE INTERNAL "")
     endif()
     if (NOT DEFINED _${_PYTHON_PREFIX}_INCLUDE_DIR)
-      set (_${_PYTHON_PREFIX}_INCLUDE_DIR "_${_PYTHON_PREFIX}_INCLUDE_DIR-NOTFOUND" CACHE INTERNAL "")
+      set (_${_PYTHON_PREFIX}_INCLUDE_DIR "${_PYTHON_PREFIX}_INCLUDE_DIR-NOTFOUND" CACHE INTERNAL "")
     endif()
     if (__${_PYTHON_PREFIX}_DEVELOPMENT_SIGNATURE STREQUAL _${_PYTHON_PREFIX}_DEVELOPMENT_SIGNATURE)
       # check version validity
@@ -1914,10 +1958,10 @@ if ("Development" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
   # finalize library version information
   _python_get_version (LIBRARY PREFIX _${_PYTHON_PREFIX}_)
 
-  set (${_PYTHON_PREFIX}_LIBRARY_RELEASE "${_${_PYTHON_PREFIX}_LIBRARY_RELEASE}" CACHE FILEPATH "Path to a library." FORCE)
+  set (${_PYTHON_PREFIX}_LIBRARY_RELEASE "${_${_PYTHON_PREFIX}_LIBRARY_RELEASE}")
 
   if (_${_PYTHON_PREFIX}_LIBRARY_RELEASE AND NOT EXISTS "${_${_PYTHON_PREFIX}_LIBRARY_RELEASE}")
-    set_property (CACHE _${_PYTHON_PREFIX}_LIBRARY_RELEASE PROPERTY VALUE "_${_PYTHON_PREFIX}_LIBRARY_RELEASE-NOTFOUND")
+    set_property (CACHE _${_PYTHON_PREFIX}_LIBRARY_RELEASE PROPERTY VALUE "${_PYTHON_PREFIX}_LIBRARY_RELEASE-NOTFOUND")
   endif()
 
   set (_${_PYTHON_PREFIX}_HINTS "${${_PYTHON_PREFIX}_ROOT_DIR}" ENV ${_PYTHON_PREFIX}_ROOT_DIR)
@@ -1939,7 +1983,7 @@ if ("Development" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
     _python_get_names (_${_PYTHON_PREFIX}_LIB_NAMES VERSION ${_${_PYTHON_PREFIX}_VERSION} WIN32 POSIX LIBRARY)
     get_filename_component (_${_PYTHON_PREFIX}_PATH "${_${_PYTHON_PREFIX}_LIBRARY_RELEASE}" DIRECTORY)
     get_filename_component (_${_PYTHON_PREFIX}_PATH2 "${_${_PYTHON_PREFIX}_PATH}" DIRECTORY)
-    _python_find_runtime_library (${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE
+    _python_find_runtime_library (_${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE
                                   NAMES ${_${_PYTHON_PREFIX}_LIB_NAMES}
                                   NAMES_PER_DIR
                                   HINTS "${_${_PYTHON_PREFIX}_PATH}" "${_${_PYTHON_PREFIX}_PATH2}" ${_${_PYTHON_PREFIX}_HINTS}
@@ -1949,7 +1993,7 @@ if ("Development" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
     _python_get_names (_${_PYTHON_PREFIX}_LIB_NAMES_DEBUG VERSION ${_${_PYTHON_PREFIX}_VERSION} WIN32 DEBUG)
     get_filename_component (_${_PYTHON_PREFIX}_PATH "${_${_PYTHON_PREFIX}_LIBRARY_DEBUG}" DIRECTORY)
     get_filename_component (_${_PYTHON_PREFIX}_PATH2 "${_${_PYTHON_PREFIX}_PATH}" DIRECTORY)
-    _python_find_runtime_library (${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG
+    _python_find_runtime_library (_${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG
                                   NAMES ${_${_PYTHON_PREFIX}_LIB_NAMES_DEBUG}
                                   NAMES_PER_DIR
                                   HINTS "${_${_PYTHON_PREFIX}_PATH}" "${_${_PYTHON_PREFIX}_PATH2}" ${_${_PYTHON_PREFIX}_HINTS}
@@ -2049,7 +2093,7 @@ if ("Development" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
   set (${_PYTHON_PREFIX}_INCLUDE_DIRS "${_${_PYTHON_PREFIX}_INCLUDE_DIR}")
 
   if (_${_PYTHON_PREFIX}_INCLUDE_DIR AND NOT EXISTS "${_${_PYTHON_PREFIX}_INCLUDE_DIR}")
-    set_property (CACHE _${_PYTHON_PREFIX}_INCLUDE_DIR PROPERTY VALUE "_${_PYTHON_PREFIX}_INCLUDE_DIR-NOTFOUND")
+    set_property (CACHE _${_PYTHON_PREFIX}_INCLUDE_DIR PROPERTY VALUE "${_PYTHON_PREFIX}_INCLUDE_DIR-NOTFOUND")
   endif()
 
   if (_${_PYTHON_PREFIX}_INCLUDE_DIR)
@@ -2071,27 +2115,29 @@ if ("Development" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
   endif()
 
   # define public variables
-  set (${_PYTHON_PREFIX}_LIBRARY_DEBUG "${_${_PYTHON_PREFIX}_LIBRARY_DEBUG}" CACHE FILEPATH "Path to a library." FORCE)
-
-  include (${CMAKE_CURRENT_LIST_DIR}/../SelectLibraryConfigurations.cmake)
-  select_library_configurations (${_PYTHON_PREFIX})
-  if (${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE)
-    set (${_PYTHON_PREFIX}_RUNTIME_LIBRARY "${${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE}")
-  elseif (${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG)
-    set (${_PYTHON_PREFIX}_RUNTIME_LIBRARY "${${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG}")
+  set (${_PYTHON_PREFIX}_LIBRARY_DEBUG "${_${_PYTHON_PREFIX}_LIBRARY_DEBUG}")
+  _python_select_library_configurations (${_PYTHON_PREFIX})
+
+  set (${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE "${_${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE}")
+  set (${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG "${_${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG}")
+
+  if (_${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE)
+    set (${_PYTHON_PREFIX}_RUNTIME_LIBRARY "${_${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE}")
+  elseif (_${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG)
+    set (${_PYTHON_PREFIX}_RUNTIME_LIBRARY "${_${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG}")
   else()
     set (${_PYTHON_PREFIX}_RUNTIME_LIBRARY "${_PYTHON_PREFIX}_RUNTIME_LIBRARY-NOTFOUND")
   endif()
 
   _python_set_library_dirs (${_PYTHON_PREFIX}_LIBRARY_DIRS
-                            ${_PYTHON_PREFIX}_LIBRARY_RELEASE ${_PYTHON_PREFIX}_LIBRARY_DEBUG)
+                            _${_PYTHON_PREFIX}_LIBRARY_RELEASE _${_PYTHON_PREFIX}_LIBRARY_DEBUG)
   if (UNIX)
-    if (${_PYTHON_PREFIX}_LIBRARY_RELEASE MATCHES "${CMAKE_SHARED_LIBRARY_SUFFIX}$")
+    if (_${_PYTHON_PREFIX}_LIBRARY_RELEASE MATCHES "${CMAKE_SHARED_LIBRARY_SUFFIX}$")
       set (${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DIRS ${${_PYTHON_PREFIX}_LIBRARY_DIRS})
     endif()
   else()
       _python_set_library_dirs (${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DIRS
-                                ${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE ${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG)
+                                _${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE _${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG)
   endif()
 
   if (_${_PYTHON_PREFIX}_LIBRARY_RELEASE AND _${_PYTHON_PREFIX}_INCLUDE_DIR)
@@ -2125,12 +2171,12 @@ if ("Development" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
     set (CMAKE_FIND_LIBRARY_SUFFIXES ${_${_PYTHON_PREFIX}_CMAKE_FIND_LIBRARY_SUFFIXES})
   endif()
 
-  mark_as_advanced (_${_PYTHON_PREFIX}_LIBRARY_RELEASE
-                    _${_PYTHON_PREFIX}_LIBRARY_DEBUG
-                    ${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE
-                    ${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG
-                    _${_PYTHON_PREFIX}_INCLUDE_DIR
-                    _${_PYTHON_PREFIX}_DEVELOPMENT_SIGNATURE)
+  _python_mark_as_internal (_${_PYTHON_PREFIX}_LIBRARY_RELEASE
+                            _${_PYTHON_PREFIX}_LIBRARY_DEBUG
+                            _${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE
+                            _${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG
+                            _${_PYTHON_PREFIX}_INCLUDE_DIR
+                            _${_PYTHON_PREFIX}_DEVELOPMENT_SIGNATURE)
 endif()
 
 if ("NumPy" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS AND ${_PYTHON_PREFIX}_Interpreter_FOUND)
@@ -2172,7 +2218,7 @@ if ("NumPy" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS AND ${_PYTHON_PREFIX}_Inte
   set (${_PYTHON_PREFIX}_NumPy_INCLUDE_DIRS "${_${_PYTHON_PREFIX}_NumPy_INCLUDE_DIR}")
 
   if(_${_PYTHON_PREFIX}_NumPy_INCLUDE_DIR AND NOT EXISTS "${_${_PYTHON_PREFIX}_NumPy_INCLUDE_DIR}")
-    set_property (CACHE _${_PYTHON_PREFIX}_NumPy_INCLUDE_DIR PROPERTY VALUE "_${_PYTHON_PREFIX}_NumPy_INCLUDE_DIR-NOTFOUND")
+    set_property (CACHE _${_PYTHON_PREFIX}_NumPy_INCLUDE_DIR PROPERTY VALUE "${_PYTHON_PREFIX}_NumPy_INCLUDE_DIR-NOTFOUND")
   endif()
 
   if (_${_PYTHON_PREFIX}_NumPy_INCLUDE_DIR)
@@ -2201,7 +2247,8 @@ if ("NumPy" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS AND ${_PYTHON_PREFIX}_Inte
     unset (_${_PYTHON_PREFIX}_NUMPY_SIGNATURE CACHE)
   endif()
 
-  mark_as_advanced (_${_PYTHON_PREFIX}_NumPy_INCLUDE_DIR)
+  _python_mark_as_internal (_${_PYTHON_PREFIX}_NumPy_INCLUDE_DIR
+                            _${_PYTHON_PREFIX}_NUMPY_SIGNATURE)
 endif()
 
 # final validation
index 2797a65..010c8d6 100644 (file)
@@ -1,7 +1,7 @@
 # CMake version number components.
 set(CMake_VERSION_MAJOR 3)
 set(CMake_VERSION_MINOR 16)
-set(CMake_VERSION_PATCH 4)
+set(CMake_VERSION_PATCH 5)
 #set(CMake_VERSION_RC 0)
 set(CMake_VERSION_IS_DIRTY 0)
 
@@ -21,7 +21,7 @@ endif()
 
 if(NOT CMake_VERSION_NO_GIT)
   # If this source was exported by 'git archive', use its commit info.
-  set(git_info [==[44b8937b76 CMake 3.16.4]==])
+  set(git_info [==[b7d8c91822 CMake 3.16.5]==])
 
   # Otherwise, try to identify the current development source version.
   if(NOT git_info MATCHES "^([0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]?[0-9a-f]?)[0-9a-f]* "
index 7a9e2b7..ccef9c8 100644 (file)
@@ -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");
index 645189a..43bfd1d 100644 (file)
@@ -15,6 +15,7 @@
 
 #include "cmGraphAdjacencyList.h"
 #include "cmLinkItem.h"
+#include "cmListFileCache.h"
 #include "cmTargetLinkLibraryType.h"
 
 class cmComputeComponentGraph;
@@ -39,7 +40,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;
index 8773d10..f3dd840 100644 (file)
@@ -603,7 +603,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.
@@ -629,7 +629,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
@@ -640,7 +641,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!
@@ -652,8 +653,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
@@ -664,23 +666,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.
@@ -689,7 +691,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.
@@ -708,12 +710,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;
@@ -737,7 +739,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);
   }
 
@@ -994,7 +996,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.
@@ -1015,7 +1017,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;
   }
 
@@ -1023,23 +1025,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;
   }
 
@@ -1049,9 +1051,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;
     }
   }
@@ -1063,10 +1065,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);
@@ -1077,8 +1079,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.
@@ -1142,7 +1144,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
@@ -1154,14 +1156,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
@@ -1184,7 +1186,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",
@@ -1197,7 +1199,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",
@@ -1210,7 +1212,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",
@@ -1227,19 +1229,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
@@ -1269,7 +1271,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);
index 92ab83b..ee74ccd 100644 (file)
 
 #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.
@@ -35,13 +35,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;
   };
@@ -74,8 +74,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;
@@ -146,10 +147,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);
index 3002b2a..aee475b 100644 (file)
@@ -2812,11 +2812,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());
index 0c52cc5..e511196 100644 (file)
@@ -460,6 +460,10 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
     cmInstallFilesGenerator* publicHeaderGenerator = nullptr;
     cmInstallFilesGenerator* resourceGenerator = nullptr;
 
+    // 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;
 
@@ -479,11 +483,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 == nullptr) && (runtimeGenerator == nullptr)) {
             archiveGenerator = CreateInstallTargetGenerator(
@@ -516,6 +522,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(),
@@ -557,6 +566,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));
@@ -624,6 +636,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));
@@ -636,6 +651,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);
         }
@@ -672,9 +688,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");
@@ -686,9 +710,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");
index 0dc6236..3d516f8 100644 (file)
@@ -9,7 +9,6 @@
 
 #include "cmComputeLinkInformation.h"
 #include "cmGeneratorTarget.h"
-#include "cmLinkItem.h"
 #include "cmListFileCache.h"
 #include "cmOutputConverter.h"
 #include "cmStateDirectory.h"
@@ -79,27 +78,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);
   }
 }
index 847334b..65ed34c 100644 (file)
@@ -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) {
index f19549d..e771a4a 100644 (file)
@@ -1256,11 +1256,11 @@ void cmLocalVisualStudio7GeneratorInternals::OutputLibraries(
   for (auto const& lib : libs) {
     if (lib.IsPath) {
       std::string rel =
-        lg->MaybeConvertToRelativePath(currentBinDir, lib.Value.c_str());
+        lg->MaybeConvertToRelativePath(currentBinDir, lib.Value.Value.c_str());
       fout << lg->ConvertToXMLOutputPath(rel.c_str()) << " ";
     } else if (!lib.Target ||
                lib.Target->GetType() != cmStateEnums::INTERFACE_LIBRARY) {
-      fout << lib.Value << " ";
+      fout << lib.Value.Value << " ";
     }
   }
 }
index beedef4..a458cac 100644 (file)
@@ -178,7 +178,7 @@ void cmNinjaNormalTargetGenerator::WriteDeviceLinkRule(bool useResponseFile)
 
     // build response file name
     std::string responseFlag = this->GetMakefile()->GetSafeDefinition(
-      "CMAKE_CUDA_RESPONSE_FILE_LINK_FLAG");
+      "CMAKE_CUDA_RESPONSE_FILE_DEVICE_LINK_FLAG");
 
     if (!useResponseFile || responseFlag.empty()) {
       vars.Objects = "$in";
@@ -286,7 +286,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile)
 
     if (flag) {
       responseFlag = flag;
-    } else if (this->TargetLinkLanguage != "CUDA") {
+    } else {
       responseFlag = "@";
     }
 
index 5857477..f220ea5 100644 (file)
@@ -3233,13 +3233,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);
       }
     }
 
@@ -3804,9 +3804,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);
     }
@@ -3890,16 +3890,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);
     }
   }
 }
index 57ad6e1..4a55cd6 100644 (file)
@@ -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 (file)
index 0000000..1939097
--- /dev/null
@@ -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\.$
index bfd8c2c..58c5273 100644 (file)
@@ -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)
index 15335b2..30f2266 100644 (file)
@@ -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 (file)
index 0000000..1939097
--- /dev/null
@@ -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\.$
index 324aa11..a580657 100644 (file)
@@ -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)
index 554533e..85594cc 100644 (file)
@@ -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);
 }