summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJinWang An <jinwang.an@samsung.com>2022-12-27 17:20:07 +0900
committerJinWang An <jinwang.an@samsung.com>2022-12-27 17:20:07 +0900
commiteca8e526ac4322878cf56b68577e60eb848172fb (patch)
tree25e1530af91e2392352b5db6391878b4b126ccb6
parent309c331b5acb2d1303e09642820f6d95632f95a6 (diff)
downloadcmake-eca8e526ac4322878cf56b68577e60eb848172fb.tar.gz
cmake-eca8e526ac4322878cf56b68577e60eb848172fb.tar.bz2
cmake-eca8e526ac4322878cf56b68577e60eb848172fb.zip
Imported Upstream version 3.22.2upstream/3.22.2
-rw-r--r--Help/release/3.22.rst13
-rw-r--r--Modules/CMakeCCompilerId.c.in2
-rw-r--r--Modules/CMakeCXXCompilerId.cpp.in2
-rw-r--r--Modules/CMakeDetermineASMCompiler.cmake2
-rw-r--r--Modules/CMakeDetermineCompilerId.cmake8
-rw-r--r--Modules/Compiler/MSVC-C.cmake2
-rw-r--r--Modules/Compiler/MSVC-CXX.cmake2
-rw-r--r--Modules/FindBoost.cmake33
-rw-r--r--Modules/FindGLUT.cmake2
-rw-r--r--Modules/FindPython/Support.cmake2
-rw-r--r--Modules/FindPythonInterp.cmake2
-rw-r--r--Modules/FindPythonLibs.cmake2
-rw-r--r--Modules/FortranCInterface/CMakeLists.txt13
-rw-r--r--Modules/Platform/Android-Common.cmake2
-rw-r--r--Source/CMakeVersion.cmake4
-rw-r--r--Source/cmFileCommand.cxx11
-rw-r--r--Source/cmStandardLevelResolver.cxx5
-rw-r--r--Templates/MSBuild/FlagTables/v143_Link.json7
-rw-r--r--Tests/FindGLUT/Test/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/CompileFeatures/CMP0128Common.cmake (renamed from Tests/RunCMake/CompileFeatures/ExtensionsStandardUnset.cmake)1
-rw-r--r--Tests/RunCMake/CompileFeatures/CMP0128NewExtensionsStandardDefault-build-check.cmake (renamed from Tests/RunCMake/CompileFeatures/ExtensionsStandardDefault-build-check.cmake)0
-rw-r--r--Tests/RunCMake/CompileFeatures/CMP0128NewExtensionsStandardDefault.cmake2
-rw-r--r--Tests/RunCMake/CompileFeatures/CMP0128NewExtensionsStandardUnset-build-check.cmake (renamed from Tests/RunCMake/CompileFeatures/ExtensionsStandardUnset-build-check.cmake)0
-rw-r--r--Tests/RunCMake/CompileFeatures/CMP0128NewExtensionsStandardUnset.cmake1
-rw-r--r--Tests/RunCMake/CompileFeatures/CMP0128NewNoUnnecessaryFlag-build-check.cmake (renamed from Tests/RunCMake/CompileFeatures/NoUnnecessaryFlag-build-check.cmake)0
-rw-r--r--Tests/RunCMake/CompileFeatures/CMP0128NewNoUnnecessaryFlag.cmake2
-rw-r--r--Tests/RunCMake/CompileFeatures/CMP0128OldSameStandard-build-check.cmake12
-rw-r--r--Tests/RunCMake/CompileFeatures/CMP0128OldSameStandard.cmake1
-rw-r--r--Tests/RunCMake/CompileFeatures/CMP0128WarnMatch.cmake2
-rw-r--r--Tests/RunCMake/CompileFeatures/CMP0128WarnUnset.cmake2
-rw-r--r--Tests/RunCMake/CompileFeatures/ExtensionsStandardDefault.cmake9
-rw-r--r--Tests/RunCMake/CompileFeatures/NoUnnecessaryFlag.cmake9
-rw-r--r--Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake36
-rw-r--r--Tests/RunCMake/VS10Project/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/VS10Project/VsControlFlowGuardLinkSetting-check.cmake40
-rw-r--r--Tests/RunCMake/VS10Project/VsControlFlowGuardLinkSetting.cmake7
-rw-r--r--Tests/RunCMake/file/READ_ELF-stderr.txt21
-rw-r--r--Tests/RunCMake/file/READ_ELF.cmake2
38 files changed, 193 insertions, 71 deletions
diff --git a/Help/release/3.22.rst b/Help/release/3.22.rst
index fcb655d19..a82d39695 100644
--- a/Help/release/3.22.rst
+++ b/Help/release/3.22.rst
@@ -142,3 +142,16 @@ Other Changes
This became available as of VS 16.10 (toolchain version 14.29.30037).
* The :cpack_gen:`CPack NSIS Generator` now requires NSIS 3.03 or later.
+
+3.22.1
+------
+
+This version made no changes to documented features or interfaces.
+Some implementation updates were made to support ecosystem changes
+and/or fix regressions.
+
+3.22.2
+------
+
+* The ``OLD`` behavior of :policy:`CMP0128` was fixed to add flags even when
+ the specified standard matches the compiler default.
diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in
index 30ad9824e..0cb8724fb 100644
--- a/Modules/CMakeCCompilerId.c.in
+++ b/Modules/CMakeCCompilerId.c.in
@@ -61,7 +61,7 @@ const char* info_language_standard_default =
const char* info_language_extensions_default = "INFO" ":" "extensions_default["
/* !defined(_MSC_VER) to exclude Clang's MSVC compatibility mode. */
-#if (defined(__clang__) || defined(__GNUC__) || \
+#if (defined(__clang__) || defined(__GNUC__) || defined(__xlC__) || \
defined(__TI_COMPILER_VERSION__)) && \
!defined(__STRICT_ANSI__) && !defined(_MSC_VER)
"ON"
diff --git a/Modules/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in
index e7a548742..4904249ad 100644
--- a/Modules/CMakeCXXCompilerId.cpp.in
+++ b/Modules/CMakeCXXCompilerId.cpp.in
@@ -67,7 +67,7 @@ const char* info_language_standard_default = "INFO" ":" "standard_default["
const char* info_language_extensions_default = "INFO" ":" "extensions_default["
/* !defined(_MSC_VER) to exclude Clang's MSVC compatibility mode. */
-#if (defined(__clang__) || defined(__GNUC__) || \
+#if (defined(__clang__) || defined(__GNUC__) || defined(__xlC__) || \
defined(__TI_COMPILER_VERSION__)) && \
!defined(__STRICT_ANSI__) && !defined(_MSC_VER)
"ON"
diff --git a/Modules/CMakeDetermineASMCompiler.cmake b/Modules/CMakeDetermineASMCompiler.cmake
index a1814b7dd..d03cbef01 100644
--- a/Modules/CMakeDetermineASMCompiler.cmake
+++ b/Modules/CMakeDetermineASMCompiler.cmake
@@ -104,7 +104,7 @@ if(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
list(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS ARMCC)
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_ARMCC )
- set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_ARMCC "(ARM Compiler)|(ARM Assembler)")
+ set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_ARMCC "(ARM Compiler)|(ARM Assembler)|(Arm Compiler)")
list(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS NASM)
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_NASM "-v")
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index c62cb7d24..916f60c81 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -320,15 +320,13 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS}
set(id_cl "$(CLToolExe)")
elseif(CMAKE_VS_PLATFORM_TOOLSET MATCHES "v[0-9]+_clang_.*")
set(id_cl clang.exe)
- # Executable names have been chosen according documentation
- # URL: (https://software.intel.com/content/www/us/en/develop/documentation/get-started-with-dpcpp-compiler/top.html#top_GUID-A9B4C91D-97AC-450D-9742-9D895BC8AEE1)
elseif(CMAKE_VS_PLATFORM_TOOLSET MATCHES "Intel")
if(CMAKE_VS_PLATFORM_TOOLSET MATCHES "DPC\\+\\+ Compiler")
set(id_cl dpcpp.exe)
- elseif(CMAKE_VS_PLATFORM_TOOLSET MATCHES "C\\+\\+ Compiler 2021")
- set(id_cl icx.exe)
- elseif(CMAKE_VS_PLATFORM_TOOLSET MATCHES "C\\+\\+ Compiler")
+ elseif(CMAKE_VS_PLATFORM_TOOLSET MATCHES "C\\+\\+ Compiler ([8-9]\\.|1[0-9]\\.|XE)")
set(id_cl icl.exe)
+ elseif(CMAKE_VS_PLATFORM_TOOLSET MATCHES "C\\+\\+ Compiler")
+ set(id_cl icx.exe)
endif()
else()
set(id_cl cl.exe)
diff --git a/Modules/Compiler/MSVC-C.cmake b/Modules/Compiler/MSVC-C.cmake
index a53df4664..df3691c69 100644
--- a/Modules/Compiler/MSVC-C.cmake
+++ b/Modules/Compiler/MSVC-C.cmake
@@ -77,6 +77,6 @@ endif()
# The `/external:I` flag was made non-experimental in 19.29.30036.3.
if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 19.29.30036.3)
- set(CMAKE_INCLUDE_SYSTEM_FLAG_C "-external:I ")
+ set(CMAKE_INCLUDE_SYSTEM_FLAG_C "-external:I")
set(_CMAKE_INCLUDE_SYSTEM_FLAG_C_WARNING "-external:W0 ")
endif ()
diff --git a/Modules/Compiler/MSVC-CXX.cmake b/Modules/Compiler/MSVC-CXX.cmake
index bcaec69e8..17cbc3c5c 100644
--- a/Modules/Compiler/MSVC-CXX.cmake
+++ b/Modules/Compiler/MSVC-CXX.cmake
@@ -84,6 +84,6 @@ endif()
# The `/external:I` flag was made non-experimental in 19.29.30036.3.
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.29.30036.3)
- set(CMAKE_INCLUDE_SYSTEM_FLAG_CXX "-external:I ")
+ set(CMAKE_INCLUDE_SYSTEM_FLAG_CXX "-external:I")
set(_CMAKE_INCLUDE_SYSTEM_FLAG_CXX_WARNING "-external:W0 ")
endif ()
diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake
index 38faca24a..c3142d66a 100644
--- a/Modules/FindBoost.cmake
+++ b/Modules/FindBoost.cmake
@@ -390,7 +390,7 @@ cmake_policy(SET CMP0102 NEW) # if mark_as_advanced(non_cache_var)
function(_boost_get_existing_target component target_var)
set(names "${component}")
- if(component MATCHES "^([a-z_]*)(python|numpy)([1-9])\\.?([0-9])?$")
+ if(component MATCHES "^([a-z_]*)(python|numpy)([1-9])\\.?([0-9]+)?$")
# handle pythonXY and numpyXY versioned components and also python X.Y, mpi_python etc.
list(APPEND names
"${CMAKE_MATCH_1}${CMAKE_MATCH_2}" # python
@@ -407,7 +407,7 @@ function(_boost_get_existing_target component target_var)
if(TARGET "${prefix}::${name}")
# The target may be an INTERFACE library that wraps around a single other
# target for compatibility. Unwrap this layer so we can extract real info.
- if("${name}" MATCHES "^(python|numpy|mpi_python)([1-9])([0-9])$")
+ if("${name}" MATCHES "^(python|numpy|mpi_python)([1-9])([0-9]+)$")
set(name_nv "${CMAKE_MATCH_1}")
if(TARGET "${prefix}::${name_nv}")
get_property(type TARGET "${prefix}::${name}" PROPERTY TYPE)
@@ -430,7 +430,7 @@ endfunction()
function(_boost_get_canonical_target_name component target_var)
string(TOLOWER "${component}" component)
- if(component MATCHES "^([a-z_]*)(python|numpy)([1-9])\\.?([0-9])?$")
+ if(component MATCHES "^([a-z_]*)(python|numpy)([1-9])\\.?([0-9]+)?$")
# handle pythonXY and numpyXY versioned components and also python X.Y, mpi_python etc.
set(${target_var} "Boost::${CMAKE_MATCH_1}${CMAKE_MATCH_2}" PARENT_SCOPE)
else()
@@ -1004,7 +1004,7 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret)
# against the new release.
# Handle Python version suffixes
- if(component MATCHES "^(python|mpi_python|numpy)([0-9][0-9]?|[0-9]\\.[0-9])\$")
+ if(component MATCHES "^(python|mpi_python|numpy)([0-9][0-9]?|[0-9]\\.[0-9]+)\$")
set(component "${CMAKE_MATCH_1}")
set(component_python_version "${CMAKE_MATCH_2}")
endif()
@@ -1350,7 +1350,7 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret)
set(_Boost_TIMER_DEPENDENCIES chrono)
set(_Boost_WAVE_DEPENDENCIES filesystem serialization thread chrono date_time atomic)
set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
- else()
+ elseif(Boost_VERSION_STRING VERSION_LESS 1.78.0)
set(_Boost_CONTRACT_DEPENDENCIES thread chrono)
set(_Boost_COROUTINE_DEPENDENCIES context)
set(_Boost_FIBER_DEPENDENCIES context)
@@ -1365,7 +1365,22 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret)
set(_Boost_TIMER_DEPENDENCIES chrono)
set(_Boost_WAVE_DEPENDENCIES filesystem serialization thread chrono atomic)
set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
- if(Boost_VERSION_STRING VERSION_GREATER_EQUAL 1.78.0 AND NOT Boost_NO_WARN_NEW_VERSIONS)
+ else()
+ set(_Boost_CONTRACT_DEPENDENCIES thread chrono)
+ set(_Boost_COROUTINE_DEPENDENCIES context)
+ set(_Boost_FIBER_DEPENDENCIES context)
+ set(_Boost_IOSTREAMS_DEPENDENCIES regex)
+ set(_Boost_JSON_DEPENDENCIES container)
+ set(_Boost_LOG_DEPENDENCIES log_setup filesystem thread regex chrono atomic)
+ set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l)
+ set(_Boost_MPI_DEPENDENCIES serialization)
+ set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization)
+ set(_Boost_NUMPY_DEPENDENCIES python${component_python_version})
+ set(_Boost_THREAD_DEPENDENCIES chrono atomic)
+ set(_Boost_TIMER_DEPENDENCIES chrono)
+ set(_Boost_WAVE_DEPENDENCIES filesystem serialization thread chrono atomic)
+ set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
+ if(Boost_VERSION_STRING VERSION_GREATER_EQUAL 1.79.0 AND NOT Boost_NO_WARN_NEW_VERSIONS)
message(WARNING "New Boost version may have incorrect or missing dependencies and imported targets")
endif()
endif()
@@ -1393,7 +1408,7 @@ endfunction()
#
function(_Boost_COMPONENT_HEADERS component _hdrs)
# Handle Python version suffixes
- if(component MATCHES "^(python|mpi_python|numpy)([0-9][0-9]?|[0-9]\\.[0-9])\$")
+ if(component MATCHES "^(python|mpi_python|numpy)([0-9]+|[0-9]\\.[0-9]+)\$")
set(component "${CMAKE_MATCH_1}")
set(component_python_version "${CMAKE_MATCH_2}")
endif()
@@ -1638,7 +1653,7 @@ else()
# _Boost_COMPONENT_HEADERS. See the instructions at the top of
# _Boost_COMPONENT_DEPENDENCIES.
set(_Boost_KNOWN_VERSIONS ${Boost_ADDITIONAL_VERSIONS}
- "1.77.0" "1.77" "1.76.0" "1.76" "1.75.0" "1.75" "1.74.0" "1.74"
+ "1.78.0" "1.78" "1.77.0" "1.77" "1.76.0" "1.76" "1.75.0" "1.75" "1.74.0" "1.74"
"1.73.0" "1.73" "1.72.0" "1.72" "1.71.0" "1.71" "1.70.0" "1.70" "1.69.0" "1.69"
"1.68.0" "1.68" "1.67.0" "1.67" "1.66.0" "1.66" "1.65.1" "1.65.0" "1.65"
"1.64.0" "1.64" "1.63.0" "1.63" "1.62.0" "1.62" "1.61.0" "1.61" "1.60.0" "1.60"
@@ -2150,7 +2165,7 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS})
if(${COMPONENT} MATCHES "^(python|mpi_python|numpy)([0-9])\$")
set(COMPONENT_UNVERSIONED "${CMAKE_MATCH_1}")
set(COMPONENT_PYTHON_VERSION_MAJOR "${CMAKE_MATCH_2}")
- elseif(${COMPONENT} MATCHES "^(python|mpi_python|numpy)([0-9])\\.?([0-9])\$")
+ elseif(${COMPONENT} MATCHES "^(python|mpi_python|numpy)([0-9])\\.?([0-9]+)\$")
set(COMPONENT_UNVERSIONED "${CMAKE_MATCH_1}")
set(COMPONENT_PYTHON_VERSION_MAJOR "${CMAKE_MATCH_2}")
set(COMPONENT_PYTHON_VERSION_MINOR "${CMAKE_MATCH_3}")
diff --git a/Modules/FindGLUT.cmake b/Modules/FindGLUT.cmake
index dd0975d39..636f1ea3b 100644
--- a/Modules/FindGLUT.cmake
+++ b/Modules/FindGLUT.cmake
@@ -71,6 +71,8 @@ find_package(PkgConfig)
if(PKG_CONFIG_FOUND)
pkg_check_modules(GLUT glut)
if(GLUT_FOUND)
+ # In the non-pkg-config code path we only provide GLUT_INCLUDE_DIR.
+ set(GLUT_INCLUDE_DIR "${GLUT_INCLUDE_DIRS}")
_add_glut_target_simple()
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLUT REQUIRED_VARS GLUT_FOUND)
return()
diff --git a/Modules/FindPython/Support.cmake b/Modules/FindPython/Support.cmake
index ce25cfc70..b7a0ef6bd 100644
--- a/Modules/FindPython/Support.cmake
+++ b/Modules/FindPython/Support.cmake
@@ -22,7 +22,7 @@ if (NOT DEFINED _${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR)
message (FATAL_ERROR "FindPython: INTERNAL ERROR")
endif()
if (_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR EQUAL "3")
- set(_${_PYTHON_PREFIX}_VERSIONS 3.10 3.9 3.8 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
+ set(_${_PYTHON_PREFIX}_VERSIONS 3.11 3.10 3.9 3.8 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
elseif (_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR EQUAL "2")
set(_${_PYTHON_PREFIX}_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0)
else()
diff --git a/Modules/FindPythonInterp.cmake b/Modules/FindPythonInterp.cmake
index efe0f1190..4fc40c89d 100644
--- a/Modules/FindPythonInterp.cmake
+++ b/Modules/FindPythonInterp.cmake
@@ -54,7 +54,7 @@ unset(_Python_NAMES)
set(_PYTHON1_VERSIONS 1.6 1.5)
set(_PYTHON2_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0)
-set(_PYTHON3_VERSIONS 3.10 3.9 3.8 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
+set(_PYTHON3_VERSIONS 3.11 3.10 3.9 3.8 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
if(PythonInterp_FIND_VERSION)
if(PythonInterp_FIND_VERSION_COUNT GREATER 1)
diff --git a/Modules/FindPythonLibs.cmake b/Modules/FindPythonLibs.cmake
index 396f0d2ed..c0caf347b 100644
--- a/Modules/FindPythonLibs.cmake
+++ b/Modules/FindPythonLibs.cmake
@@ -79,7 +79,7 @@ set(CMAKE_FIND_FRAMEWORK LAST)
set(_PYTHON1_VERSIONS 1.6 1.5)
set(_PYTHON2_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0)
-set(_PYTHON3_VERSIONS 3.10 3.9 3.8 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
+set(_PYTHON3_VERSIONS 3.11 3.10 3.9 3.8 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
if(PythonLibs_FIND_VERSION)
if(PythonLibs_FIND_VERSION_COUNT GREATER 1)
diff --git a/Modules/FortranCInterface/CMakeLists.txt b/Modules/FortranCInterface/CMakeLists.txt
index 13e4498ad..ce0bc10c8 100644
--- a/Modules/FortranCInterface/CMakeLists.txt
+++ b/Modules/FortranCInterface/CMakeLists.txt
@@ -102,6 +102,19 @@ set_property(TARGET symbols PROPERTY POSITION_INDEPENDENT_CODE 1)
add_executable(FortranCInterface main.F call_sub.f ${call_mod})
target_link_libraries(FortranCInterface PUBLIC symbols)
+# If IPO is enabled here, GCC gfortran >= 12.0 will obfuscate
+# the strings of the return values in the compiled executable,
+# which we use to regex match against later.
+# The static libraries must be build with IPO and non-IPO objects,
+# as that will ensure the verify step will operate on IPO objects,
+# if requested by the system compiler flags.
+if(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" AND
+ CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER_EQUAL 12)
+ target_compile_options(FortranCInterface PRIVATE "-fno-lto")
+ target_compile_options(myfort PRIVATE "-flto=auto" "-ffat-lto-objects")
+ target_compile_options(symbols PRIVATE "-flto=auto" "-ffat-lto-objects")
+endif()
+
file(GENERATE OUTPUT exe-$<CONFIG>.cmake CONTENT [[
set(FortranCInterface_EXE "$<TARGET_FILE:FortranCInterface>")
]])
diff --git a/Modules/Platform/Android-Common.cmake b/Modules/Platform/Android-Common.cmake
index 39da93300..f1deaca63 100644
--- a/Modules/Platform/Android-Common.cmake
+++ b/Modules/Platform/Android-Common.cmake
@@ -56,7 +56,7 @@ if(CMAKE_ANDROID_STL_TYPE)
if(_ANDROID_STL_EXCEPTIONS OR _ANDROID_STL_RTTI)
string(APPEND CMAKE_${lang}_STANDARD_LIBRARIES " -lc++abi")
if(CMAKE_SYSTEM_VERSION LESS 21)
- list(APPEND CMAKE_${lang}_STANDARD_LIBRARIES "-landroid_support")
+ string(APPEND CMAKE_${lang}_STANDARD_LIBRARIES " -landroid_support")
endif()
endif()
endmacro()
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index c8d203bf3..f938d9b52 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,7 +1,7 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 22)
-set(CMake_VERSION_PATCH 1)
+set(CMake_VERSION_PATCH 2)
#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 [==[aa6a33fe54 CMake 3.22.1]==])
+ set(git_info [==[8428e39ed9 CMake 3.22.2]==])
# 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]* "
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index fd0595d88..c3ae22893 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -1213,9 +1213,14 @@ bool HandleReadElfCommand(std::vector<std::string> const& args,
cmELF elf(fileNameArg.c_str());
if (!elf) {
- status.SetError(cmStrCat("READ_ELF given FILE \"", fileNameArg,
- "\" that is not a valid ELF file."));
- return false;
+ if (arguments.Error.empty()) {
+ status.SetError(cmStrCat("READ_ELF given FILE:\n ", fileNameArg,
+ "\nthat is not a valid ELF file."));
+ return false;
+ }
+ status.GetMakefile().AddDefinition(arguments.Error,
+ "not a valid ELF file");
+ return true;
}
if (!arguments.RPath.empty()) {
diff --git a/Source/cmStandardLevelResolver.cxx b/Source/cmStandardLevelResolver.cxx
index 61416e063..acc2ed298 100644
--- a/Source/cmStandardLevelResolver.cxx
+++ b/Source/cmStandardLevelResolver.cxx
@@ -206,8 +206,9 @@ struct StandardLevelComputer
// If the standard requested is older than the compiler's default or the
// extension mode doesn't match then we need to use a flag.
- if (stdIt < defaultStdIt ||
- (cmp0128 == cmPolicies::NEW && ext != defaultExt)) {
+ if ((cmp0128 != cmPolicies::NEW && stdIt <= defaultStdIt) ||
+ (cmp0128 == cmPolicies::NEW &&
+ (stdIt < defaultStdIt || ext != defaultExt))) {
auto offset = std::distance(cm::cbegin(stds), stdIt);
return cmStrCat("CMAKE_", this->Language, stdsStrings[offset], "_", type,
"_COMPILE_OPTION");
diff --git a/Templates/MSBuild/FlagTables/v143_Link.json b/Templates/MSBuild/FlagTables/v143_Link.json
index 71d58f885..4422f55bd 100644
--- a/Templates/MSBuild/FlagTables/v143_Link.json
+++ b/Templates/MSBuild/FlagTables/v143_Link.json
@@ -978,13 +978,6 @@
"flags": []
},
{
- "name": "LinkControlFlowGuard",
- "switch": "guard:cf",
- "comment": "Control Flow Guard",
- "value": "true",
- "flags": []
- },
- {
"name": "LinkGuardEHContMetadata",
"switch": "guard:ehcont",
"comment": "Enable EH Continuation Metadata",
diff --git a/Tests/FindGLUT/Test/CMakeLists.txt b/Tests/FindGLUT/Test/CMakeLists.txt
index 0f4e53673..f6440b250 100644
--- a/Tests/FindGLUT/Test/CMakeLists.txt
+++ b/Tests/FindGLUT/Test/CMakeLists.txt
@@ -9,7 +9,7 @@ target_link_libraries(testglut_tgt GLUT::GLUT)
add_test(NAME testglut_tgt COMMAND testglut_tgt)
add_executable(testglut_var main.c)
-target_include_directories(testglut_var PRIVATE ${GLUT_INCLUDE_DIRS})
+target_include_directories(testglut_var PRIVATE ${GLUT_INCLUDE_DIR})
target_link_libraries(testglut_var PRIVATE ${GLUT_LIBRARIES})
add_test(NAME testglut_var COMMAND testglut_var)
diff --git a/Tests/RunCMake/CompileFeatures/ExtensionsStandardUnset.cmake b/Tests/RunCMake/CompileFeatures/CMP0128Common.cmake
index 99bb3f069..b309d746a 100644
--- a/Tests/RunCMake/CompileFeatures/ExtensionsStandardUnset.cmake
+++ b/Tests/RunCMake/CompileFeatures/CMP0128Common.cmake
@@ -4,5 +4,4 @@ enable_language(@lang@)
string(REPLACE "${CMAKE_START_TEMP_FILE}" "" CMAKE_@lang@_COMPILE_OBJECT "${CMAKE_@lang@_COMPILE_OBJECT}")
string(REPLACE "${CMAKE_END_TEMP_FILE}" "" CMAKE_@lang@_COMPILE_OBJECT "${CMAKE_@lang@_COMPILE_OBJECT}")
-set(CMAKE_@lang@_EXTENSIONS @extensions_opposite@)
add_library(foo "@RunCMake_SOURCE_DIR@/empty.@ext@")
diff --git a/Tests/RunCMake/CompileFeatures/ExtensionsStandardDefault-build-check.cmake b/Tests/RunCMake/CompileFeatures/CMP0128NewExtensionsStandardDefault-build-check.cmake
index 4e85397f4..4e85397f4 100644
--- a/Tests/RunCMake/CompileFeatures/ExtensionsStandardDefault-build-check.cmake
+++ b/Tests/RunCMake/CompileFeatures/CMP0128NewExtensionsStandardDefault-build-check.cmake
diff --git a/Tests/RunCMake/CompileFeatures/CMP0128NewExtensionsStandardDefault.cmake b/Tests/RunCMake/CompileFeatures/CMP0128NewExtensionsStandardDefault.cmake
new file mode 100644
index 000000000..5b7358a8e
--- /dev/null
+++ b/Tests/RunCMake/CompileFeatures/CMP0128NewExtensionsStandardDefault.cmake
@@ -0,0 +1,2 @@
+set(CMAKE_@lang@_EXTENSIONS @extensions_opposite@)
+set(CMAKE_@lang@_STANDARD @standard_default@)
diff --git a/Tests/RunCMake/CompileFeatures/ExtensionsStandardUnset-build-check.cmake b/Tests/RunCMake/CompileFeatures/CMP0128NewExtensionsStandardUnset-build-check.cmake
index abe293c34..abe293c34 100644
--- a/Tests/RunCMake/CompileFeatures/ExtensionsStandardUnset-build-check.cmake
+++ b/Tests/RunCMake/CompileFeatures/CMP0128NewExtensionsStandardUnset-build-check.cmake
diff --git a/Tests/RunCMake/CompileFeatures/CMP0128NewExtensionsStandardUnset.cmake b/Tests/RunCMake/CompileFeatures/CMP0128NewExtensionsStandardUnset.cmake
new file mode 100644
index 000000000..6923c1192
--- /dev/null
+++ b/Tests/RunCMake/CompileFeatures/CMP0128NewExtensionsStandardUnset.cmake
@@ -0,0 +1 @@
+set(CMAKE_@lang@_EXTENSIONS @extensions_opposite@)
diff --git a/Tests/RunCMake/CompileFeatures/NoUnnecessaryFlag-build-check.cmake b/Tests/RunCMake/CompileFeatures/CMP0128NewNoUnnecessaryFlag-build-check.cmake
index 4f767fabd..4f767fabd 100644
--- a/Tests/RunCMake/CompileFeatures/NoUnnecessaryFlag-build-check.cmake
+++ b/Tests/RunCMake/CompileFeatures/CMP0128NewNoUnnecessaryFlag-build-check.cmake
diff --git a/Tests/RunCMake/CompileFeatures/CMP0128NewNoUnnecessaryFlag.cmake b/Tests/RunCMake/CompileFeatures/CMP0128NewNoUnnecessaryFlag.cmake
new file mode 100644
index 000000000..73c06414e
--- /dev/null
+++ b/Tests/RunCMake/CompileFeatures/CMP0128NewNoUnnecessaryFlag.cmake
@@ -0,0 +1,2 @@
+set(CMAKE_@lang@_EXTENSIONS @extensions_default@)
+set(CMAKE_@lang@_STANDARD @standard_default@)
diff --git a/Tests/RunCMake/CompileFeatures/CMP0128OldSameStandard-build-check.cmake b/Tests/RunCMake/CompileFeatures/CMP0128OldSameStandard-build-check.cmake
new file mode 100644
index 000000000..8074b9d3c
--- /dev/null
+++ b/Tests/RunCMake/CompileFeatures/CMP0128OldSameStandard-build-check.cmake
@@ -0,0 +1,12 @@
+foreach(flag @flags@)
+ string(FIND "${actual_stdout}" "${flag}" position)
+
+ if(NOT position EQUAL -1)
+ set(found TRUE)
+ break()
+ endif()
+endforeach()
+
+if(NOT found)
+ set(RunCMake_TEST_FAILED "No compile flags from \"@flags@\" found for LANG_STANDARD=default.")
+endif()
diff --git a/Tests/RunCMake/CompileFeatures/CMP0128OldSameStandard.cmake b/Tests/RunCMake/CompileFeatures/CMP0128OldSameStandard.cmake
new file mode 100644
index 000000000..3be0f10b2
--- /dev/null
+++ b/Tests/RunCMake/CompileFeatures/CMP0128OldSameStandard.cmake
@@ -0,0 +1 @@
+set(CMAKE_@lang@_STANDARD @standard_default@)
diff --git a/Tests/RunCMake/CompileFeatures/CMP0128WarnMatch.cmake b/Tests/RunCMake/CompileFeatures/CMP0128WarnMatch.cmake
index 0a5606ac7..7974093e7 100644
--- a/Tests/RunCMake/CompileFeatures/CMP0128WarnMatch.cmake
+++ b/Tests/RunCMake/CompileFeatures/CMP0128WarnMatch.cmake
@@ -1,7 +1,5 @@
-enable_language(@lang@)
cmake_policy(SET CMP0128 OLD)
set(CMAKE_POLICY_WARNING_CMP0128 ON)
set(CMAKE_@lang@_EXTENSIONS @extensions_default@)
set(CMAKE_@lang@_STANDARD @standard_default@)
-add_library(foo "@RunCMake_SOURCE_DIR@/empty.@ext@")
diff --git a/Tests/RunCMake/CompileFeatures/CMP0128WarnUnset.cmake b/Tests/RunCMake/CompileFeatures/CMP0128WarnUnset.cmake
index cd7af2c00..33425a162 100644
--- a/Tests/RunCMake/CompileFeatures/CMP0128WarnUnset.cmake
+++ b/Tests/RunCMake/CompileFeatures/CMP0128WarnUnset.cmake
@@ -1,6 +1,4 @@
-enable_language(@lang@)
cmake_policy(SET CMP0128 OLD)
set(CMAKE_POLICY_WARNING_CMP0128 ON)
set(CMAKE_@lang@_EXTENSIONS @extensions_opposite@)
-add_library(foo "@RunCMake_SOURCE_DIR@/empty.@ext@")
diff --git a/Tests/RunCMake/CompileFeatures/ExtensionsStandardDefault.cmake b/Tests/RunCMake/CompileFeatures/ExtensionsStandardDefault.cmake
deleted file mode 100644
index 32578d1f9..000000000
--- a/Tests/RunCMake/CompileFeatures/ExtensionsStandardDefault.cmake
+++ /dev/null
@@ -1,9 +0,0 @@
-enable_language(@lang@)
-
-# Make sure the compile command is not hidden.
-string(REPLACE "${CMAKE_START_TEMP_FILE}" "" CMAKE_@lang@_COMPILE_OBJECT "${CMAKE_@lang@_COMPILE_OBJECT}")
-string(REPLACE "${CMAKE_END_TEMP_FILE}" "" CMAKE_@lang@_COMPILE_OBJECT "${CMAKE_@lang@_COMPILE_OBJECT}")
-
-set(CMAKE_@lang@_EXTENSIONS @extensions_opposite@)
-set(CMAKE_@lang@_STANDARD @standard_default@)
-add_library(foo "@RunCMake_SOURCE_DIR@/empty.@ext@")
diff --git a/Tests/RunCMake/CompileFeatures/NoUnnecessaryFlag.cmake b/Tests/RunCMake/CompileFeatures/NoUnnecessaryFlag.cmake
deleted file mode 100644
index 8ef3a7206..000000000
--- a/Tests/RunCMake/CompileFeatures/NoUnnecessaryFlag.cmake
+++ /dev/null
@@ -1,9 +0,0 @@
-enable_language(@lang@)
-
-# Make sure the compile command is not hidden.
-string(REPLACE "${CMAKE_START_TEMP_FILE}" "" CMAKE_@lang@_COMPILE_OBJECT "${CMAKE_@lang@_COMPILE_OBJECT}")
-string(REPLACE "${CMAKE_END_TEMP_FILE}" "" CMAKE_@lang@_COMPILE_OBJECT "${CMAKE_@lang@_COMPILE_OBJECT}")
-
-set(CMAKE_@lang@_EXTENSIONS @extensions_default@)
-set(CMAKE_@lang@_STANDARD @standard_default@)
-add_library(foo "@RunCMake_SOURCE_DIR@/empty.@ext@")
diff --git a/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake b/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake
index ebd981b3d..ad9619e9f 100644
--- a/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake
@@ -35,11 +35,13 @@ elseif (cxx_std_98 IN_LIST CXX_FEATURES AND cxx_std_11 IN_LIST CXX_FEATURES)
endif()
configure_file("${RunCMake_SOURCE_DIR}/CMakeLists.txt" "${RunCMake_BINARY_DIR}/CMakeLists.txt" COPYONLY)
+file(READ "${RunCMake_SOURCE_DIR}/CMP0128Common.cmake" cmp0128_common)
function(test_build)
set(test ${name}-${lang})
- configure_file("${RunCMake_SOURCE_DIR}/${name}.cmake" "${RunCMake_BINARY_DIR}/${test}.cmake" @ONLY)
+ file(READ "${RunCMake_SOURCE_DIR}/${name}.cmake" cmake)
+ file(CONFIGURE OUTPUT "${RunCMake_BINARY_DIR}/${test}.cmake" CONTENT "${cmake}${cmp0128_common}" @ONLY)
if(EXISTS "${RunCMake_SOURCE_DIR}/${name}-build-check.cmake")
configure_file("${RunCMake_SOURCE_DIR}/${name}-build-check.cmake" "${RunCMake_BINARY_DIR}/${test}-build-check.cmake" @ONLY)
endif()
@@ -68,7 +70,24 @@ macro(mangle_flags variable)
list(APPEND flags "${result}")
endmacro()
-function(test_extensions_opposite)
+function(test_cmp0128_old_same_standard)
+ if(extensions_default)
+ set(flag_ext "_EXT")
+ endif()
+
+ set(flag "${${lang}${${lang}_STANDARD_DEFAULT}${flag_ext}_FLAG}")
+
+ if(NOT flag)
+ return()
+ endif()
+
+ mangle_flags(flag)
+
+ set(name CMP0128OldSameStandard)
+ test_build(--verbose)
+endfunction()
+
+function(test_cmp0128_new_extensions_opposite)
if(extensions_opposite)
set(flag_ext "_EXT")
endif()
@@ -83,16 +102,16 @@ function(test_extensions_opposite)
# Make sure we enable/disable extensions when:
# 1. LANG_STANDARD is unset.
- set(name ExtensionsStandardUnset)
+ set(name CMP0128NewExtensionsStandardUnset)
set(RunCMake_TEST_OPTIONS -DCMAKE_POLICY_DEFAULT_CMP0128=NEW)
test_build(--verbose)
# 2. LANG_STANDARD matches CMAKE_LANG_STANDARD_DEFAULT.
- set(name ExtensionsStandardDefault)
+ set(name CMP0128NewExtensionsStandardDefault)
test_build(--verbose)
endfunction()
-function(test_no_unnecessary_flag)
+function(test_cmp0128_new_no_unnecessary_flag)
set(standard_flag "${${lang}${${lang}_STANDARD_DEFAULT}_FLAG}")
set(extension_flag "${${lang}${${lang}_STANDARD_DEFAULT}_EXT_FLAG}")
@@ -103,7 +122,7 @@ function(test_no_unnecessary_flag)
mangle_flags(standard_flag)
mangle_flags(extension_flag)
- set(name NoUnnecessaryFlag)
+ set(name CMP0128NewNoUnnecessaryFlag)
set(RunCMake_TEST_OPTIONS -DCMAKE_POLICY_DEFAULT_CMP0128=NEW)
test_build(--verbose)
endfunction()
@@ -144,8 +163,9 @@ function(test_lang lang ext)
set(extensions_opposite ON)
endif()
- test_extensions_opposite()
- test_no_unnecessary_flag()
+ test_cmp0128_new_extensions_opposite()
+ test_cmp0128_new_no_unnecessary_flag()
+ test_cmp0128_old_same_standard()
test_cmp0128_warn_match()
test_cmp0128_warn_unset()
endfunction()
diff --git a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake
index d5ed136ac..e11a24a96 100644
--- a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake
+++ b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake
@@ -41,6 +41,7 @@ run_cmake(VsDeployEnabled)
run_cmake(VsSettings)
run_cmake(VsSourceSettingsTool)
run_cmake(VsPlatformToolset)
+run_cmake(VsControlFlowGuardLinkSetting)
run_cmake(VsWinRTByDefault)
diff --git a/Tests/RunCMake/VS10Project/VsControlFlowGuardLinkSetting-check.cmake b/Tests/RunCMake/VS10Project/VsControlFlowGuardLinkSetting-check.cmake
new file mode 100644
index 000000000..c13858bd9
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/VsControlFlowGuardLinkSetting-check.cmake
@@ -0,0 +1,40 @@
+set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/ControlFlowGuardProject.vcxproj")
+if(NOT EXISTS "${vcProjectFile}")
+ set(RunCMake_TEST_FAILED "Project file ControlFlowGuardProject.vcxproj does not exist.")
+ return()
+endif()
+
+set(Is_in_link_section 0)
+set(HAS_ControlFlowGuardSetting 0)
+
+file(STRINGS "${vcProjectFile}" lines)
+foreach(line IN LISTS lines)
+ if(line MATCHES "^ *<LinkControlFlowGuard>([^<>]+)</LinkControlFlowGuard>")
+ set(RunCMake_TEST_FAILED "Project file ControlFlowGuardProject.vcxproj contains the invalid <LinkControlFlowGuard> link property.")
+ return()
+ break()
+ endif()
+ if(line MATCHES "^ *<Link>")
+ # The start of the link section of the vcxproj file
+ set(Is_in_link_section 1)
+ continue()
+ endif()
+ if(line MATCHES "^ *</Link>")
+ # The end of the link section of the vcxproj file
+ set(Is_in_link_section 0)
+ continue()
+ endif()
+ if(Is_in_link_section)
+ if(line MATCHES "^ *<AdditionalOptions>([^<>]+)</AdditionalOptions>")
+ if("${CMAKE_MATCH_1}" MATCHES ".*/guard:cf.*")
+ set(HAS_ControlFlowGuardSetting 1)
+ break()
+ endif()
+ endif()
+ endif()
+endforeach()
+
+if(NOT HAS_ControlFlowGuardSetting)
+ set(RunCMake_TEST_FAILED "Project file ControlFlowGuardProject.vcxproj does not have '/guard:cf' specified in the <AdditionalOptions> property.")
+ return()
+endif()
diff --git a/Tests/RunCMake/VS10Project/VsControlFlowGuardLinkSetting.cmake b/Tests/RunCMake/VS10Project/VsControlFlowGuardLinkSetting.cmake
new file mode 100644
index 000000000..31e69acd3
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/VsControlFlowGuardLinkSetting.cmake
@@ -0,0 +1,7 @@
+enable_language(CXX)
+
+# Add the Control Flow Guard compiler and linker option
+add_compile_options("/guard:cf")
+string(APPEND CMAKE_SHARED_LINKER_FLAGS " /guard:cf")
+
+add_library(ControlFlowGuardProject SHARED foo.cpp)
diff --git a/Tests/RunCMake/file/READ_ELF-stderr.txt b/Tests/RunCMake/file/READ_ELF-stderr.txt
index 7b328049b..fd02ca194 100644
--- a/Tests/RunCMake/file/READ_ELF-stderr.txt
+++ b/Tests/RunCMake/file/READ_ELF-stderr.txt
@@ -1,2 +1,19 @@
-.*file READ_ELF must be called with at least three additional arguments\.
-.*file READ_ELF given FILE "XXX" that does not exist\.
+^CMake Error at READ_ELF.cmake:1 \(file\):
+ file READ_ELF must be called with at least three additional arguments\.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
++
+CMake Error at READ_ELF.cmake:2 \(file\):
+ file READ_ELF given FILE "XXX" that does not exist\.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
++
+CMake Error at READ_ELF.cmake:4 \(file\):
+ file READ_ELF given FILE:
+
+ [^
+]*/Tests/RunCMake/file/READ_ELF.cmake
+
+ that is not a valid ELF file\.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/file/READ_ELF.cmake b/Tests/RunCMake/file/READ_ELF.cmake
index cd02c9b62..8778fc2c8 100644
--- a/Tests/RunCMake/file/READ_ELF.cmake
+++ b/Tests/RunCMake/file/READ_ELF.cmake
@@ -1,2 +1,4 @@
file(READ_ELF XXX)
file(READ_ELF XXX RPATH YYY)
+file(READ_ELF ${CMAKE_CURRENT_LIST_FILE} RPATH YYY CAPTURE_ERROR err)
+file(READ_ELF ${CMAKE_CURRENT_LIST_FILE} RPATH YYY)