summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Help/command/string.rst2
-rw-r--r--Help/release/3.23.rst6
-rw-r--r--Help/release/3.24.rst11
-rw-r--r--Modules/CPackIFW.cmake1
-rw-r--r--Modules/CUDA/architectures.cmake6
-rw-r--r--Modules/Compiler/Intel.cmake14
-rw-r--r--Modules/Compiler/IntelLLVM.cmake12
-rw-r--r--Modules/Compiler/LLVMFlang-Fortran.cmake2
-rw-r--r--Modules/Compiler/NVHPC.cmake2
-rw-r--r--Modules/Compiler/NVIDIA-CUDA.cmake2
-rw-r--r--Modules/FindJNI.cmake4
-rw-r--r--Modules/FindMatlab.cmake7
-rw-r--r--Modules/Internal/CPack/NSIS.template.in19
-rw-r--r--Modules/Platform/Android.cmake6
-rw-r--r--Modules/Platform/Windows-LLVMFlang-Fortran.cmake3
-rw-r--r--Source/CMakeVersion.cmake4
-rw-r--r--Source/CPack/cpack.cxx4
-rw-r--r--Source/CTest/cmCTestBuildHandler.cxx35
-rw-r--r--Source/Checks/cm_cxx_features.cmake4
-rw-r--r--Source/Checks/cm_cxx_filesystem.cxx11
-rw-r--r--Source/cmComputeLinkInformation.cxx12
-rw-r--r--Source/cmCoreTryCompile.cxx6
-rw-r--r--Source/cmFileCommand.cxx10
-rw-r--r--Source/cmGlobalGenerator.cxx3
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx13
-rw-r--r--Source/cmGlobalNinjaGenerator.h1
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx23
-rw-r--r--Source/cmLocalGenerator.cxx10
-rw-r--r--Source/cmStringAlgorithms.cxx32
-rw-r--r--Source/cmStringAlgorithms.h10
-rw-r--r--Source/cmVSSetupHelper.cxx23
-rw-r--r--Tests/CMakeLib/testStringAlgorithms.cxx35
-rw-r--r--Tests/CMakeLists.txt2
-rw-r--r--Tests/Fortran/CMakeLists.txt2
-rw-r--r--Tests/FortranC/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/Framework/FrameworkMultiConfigPostfix.cmake5
-rw-r--r--Tests/RunCMake/Ninja/Intl-build-check.cmake5
-rw-r--r--Tests/RunCMake/Ninja/Intl-common.cmake1
-rw-r--r--Tests/RunCMake/Ninja/Intl.cmake7
-rw-r--r--Tests/RunCMake/Ninja/RunCMakeTest.cmake9
-rw-r--r--Tests/RunCMake/ParseImplicitData/linux-Fortran-LLVMFlang-15.0.0.input43
-rw-r--r--Tests/RunCMake/ParseImplicitLinkInfo/ParseImplicitLinkInfo.cmake1
-rw-r--r--Tests/RunCMake/ParseImplicitLinkInfo/results/linux-Fortran-LLVMFlang-15.0.0.output2
-rw-r--r--Tests/RunCMake/XcodeProject/RunCMakeTest.cmake45
-rw-r--r--Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined-install-check.cmake11
-rw-r--r--Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined.cmake10
-rw-r--r--Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch-install-check.cmake6
-rw-r--r--Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch.cmake10
-rw-r--r--Tests/RunCMake/ctest_build/CMakeLists.txt.in2
-rw-r--r--Tests/RunCMake/ctest_build/NinjaLauncherSingleBuildFailure-check.cmake23
-rw-r--r--Tests/RunCMake/ctest_build/NinjaLauncherSingleBuildFailure-result.txt1
-rw-r--r--Tests/RunCMake/ctest_build/NinjaLauncherSingleBuildFailure-stderr.txt1
-rw-r--r--Tests/RunCMake/ctest_build/RunCMakeTest.cmake16
-rw-r--r--Tests/RunCMake/ctest_build/error.c1
-rw-r--r--Tests/RunCMake/try_compile/CMP0128-NEW.cmake7
-rw-r--r--Tests/RunCMake/try_compile/CMP0128-WARN.cmake7
-rw-r--r--Tests/RunCMake/try_compile/CMP0128-common.cmake31
-rw-r--r--Tests/RunCMake/try_compile/Inspect.cmake4
-rw-r--r--Tests/RunCMake/try_compile/RunCMakeTest.cmake18
-rw-r--r--Utilities/std/cm/filesystem16
60 files changed, 509 insertions, 112 deletions
diff --git a/Help/command/string.rst b/Help/command/string.rst
index b1ca2cb80..86cbd2ece 100644
--- a/Help/command/string.rst
+++ b/Help/command/string.rst
@@ -491,6 +491,8 @@ specifiers:
The second of the current minute. 60 represents a leap second. (00-60)
``%f``
+ .. versionadded:: 3.23
+
The microsecond of the current second (000000-999999).
``%U``
diff --git a/Help/release/3.23.rst b/Help/release/3.23.rst
index 69898e957..47b1869ac 100644
--- a/Help/release/3.23.rst
+++ b/Help/release/3.23.rst
@@ -310,9 +310,9 @@ Changes made since CMake 3.23.0 include the following.
The old ``CPACK_PACKAGEMAKER_CHOICES`` variable is now also set to the
same content as it was before, but it is formally deprecated.
-3.23.3
-------
+3.23.3, 3.23.4, 3.23.5
+----------------------
-* This version made no changes to documented features or interfaces.
+* These versions made no changes to documented features or interfaces.
Some implementation updates were made to support ecosystem changes
and/or fix regressions.
diff --git a/Help/release/3.24.rst b/Help/release/3.24.rst
index 3857c5d26..9317e51ae 100644
--- a/Help/release/3.24.rst
+++ b/Help/release/3.24.rst
@@ -365,3 +365,14 @@ Changes made since CMake 3.24.0 include the following.
* These versions made no changes to documented features or interfaces.
Some implementation updates were made to support ecosystem changes
and/or fix regressions.
+
+3.24.3
+------
+
+* The ``LLVMFlang`` Fortran compiler support added in 3.24.0 has been extended:
+
+ * It now supports mixed-language linking between Fortran and C or CXX.
+ * It now supports the GNU ABI (MinGW) on Windows, but not yet the MSVC ABI.
+
+* Some implementation updates were made to support ecosystem changes
+ and/or fix regressions.
diff --git a/Modules/CPackIFW.cmake b/Modules/CPackIFW.cmake
index 003cf3ffa..a4bfe1d25 100644
--- a/Modules/CPackIFW.cmake
+++ b/Modules/CPackIFW.cmake
@@ -439,6 +439,7 @@ set(_CPACK_IFW_PREFIXES
"QtIFW-")
set(_CPACK_IFW_VERSIONS
+ "4.4"
"4.3"
"4.2"
"4.1"
diff --git a/Modules/CUDA/architectures.cmake b/Modules/CUDA/architectures.cmake
index 79c125271..d64692046 100644
--- a/Modules/CUDA/architectures.cmake
+++ b/Modules/CUDA/architectures.cmake
@@ -45,6 +45,12 @@ if(CMAKE_CUDA_COMPILER_TOOLKIT_VERSION VERSION_GREATER_EQUAL 11.4
list(APPEND CMAKE_CUDA_ARCHITECTURES_ALL 87)
endif()
+if(CMAKE_CUDA_COMPILER_TOOLKIT_VERSION VERSION_GREATER_EQUAL 11.8
+ AND (NOT CMAKE_CUDA_COMPILER_ID STREQUAL "Clang"))
+ list(APPEND CMAKE_CUDA_ARCHITECTURES_ALL 89 90)
+ list(APPEND CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR 90)
+endif()
+
# only generate jit code for the newest arch for all/all-major
list(POP_BACK CMAKE_CUDA_ARCHITECTURES_ALL _latest_arch)
list(TRANSFORM CMAKE_CUDA_ARCHITECTURES_ALL APPEND "-real")
diff --git a/Modules/Compiler/Intel.cmake b/Modules/Compiler/Intel.cmake
index 20989d2ca..642e58a61 100644
--- a/Modules/Compiler/Intel.cmake
+++ b/Modules/Compiler/Intel.cmake
@@ -13,7 +13,11 @@ include(Compiler/CMakeCommonCompilerMacros)
if(CMAKE_HOST_WIN32)
# MSVC-like
macro(__compiler_intel lang)
- set(CMAKE_${lang}_COMPILE_OPTIONS_WARNING_AS_ERROR "-Werror-all")
+ if("x${lang}" STREQUAL "xFortran")
+ set(CMAKE_${lang}_COMPILE_OPTIONS_WARNING_AS_ERROR "-warn:errors")
+ else()
+ set(CMAKE_${lang}_COMPILE_OPTIONS_WARNING_AS_ERROR "-Werror-all")
+ endif()
endmacro()
else()
# GNU-like
@@ -25,7 +29,6 @@ else()
string(APPEND CMAKE_${lang}_FLAGS_MINSIZEREL_INIT " -Os")
string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -O3")
string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " -O2 -g")
- set(CMAKE_${lang}_COMPILE_OPTIONS_WARNING_AS_ERROR "-Werror-all")
set(CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND "${CMAKE_${lang}_COMPILER}")
if(CMAKE_${lang}_COMPILER_ARG1)
@@ -35,7 +38,9 @@ else()
endif()
list(APPEND CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND "-QdM" "-P" "-Za" "${CMAKE_ROOT}/Modules/CMakeCXXCompilerABI.cpp")
- if(NOT "x${lang}" STREQUAL "xFortran")
+ if("x${lang}" STREQUAL "xFortran")
+ set(CMAKE_${lang}_COMPILE_OPTIONS_WARNING_AS_ERROR "-warn" "errors")
+ else()
# Precompile Headers
set(CMAKE_PCH_EXTENSION .pchi)
set(CMAKE_LINK_PCH ON)
@@ -43,6 +48,9 @@ else()
set(CMAKE_${lang}_COMPILE_OPTIONS_INVALID_PCH -Winvalid-pch)
set(CMAKE_${lang}_COMPILE_OPTIONS_USE_PCH -Wno-pch-messages -pch-use <PCH_FILE> -include <PCH_HEADER>)
set(CMAKE_${lang}_COMPILE_OPTIONS_CREATE_PCH -Wno-pch-messages -pch-create <PCH_FILE> -include <PCH_HEADER>)
+
+ # COMPILE_WARNING_AS_ERROR
+ set(CMAKE_${lang}_COMPILE_OPTIONS_WARNING_AS_ERROR "-Werror-all")
endif()
endmacro()
endif()
diff --git a/Modules/Compiler/IntelLLVM.cmake b/Modules/Compiler/IntelLLVM.cmake
index c344f3259..c5800dc94 100644
--- a/Modules/Compiler/IntelLLVM.cmake
+++ b/Modules/Compiler/IntelLLVM.cmake
@@ -18,7 +18,9 @@ set(__pch_header_OBJCXX "objective-c++-header")
if(CMAKE_HOST_WIN32)
# MSVC-like
macro(__compiler_intel_llvm lang)
- if(NOT "x${lang}" STREQUAL "xFortran")
+ if("x${lang}" STREQUAL "xFortran")
+ set(CMAKE_${lang}_COMPILE_OPTIONS_WARNING_AS_ERROR "-warn:errors")
+ else()
set(CMAKE_${lang}_COMPILE_OPTIONS_INVALID_PCH -Winvalid-pch)
set(CMAKE_${lang}_COMPILE_OPTIONS_WARNING_AS_ERROR "-WX")
endif()
@@ -39,7 +41,6 @@ else()
set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-fPIE")
set(CMAKE_${lang}_LINK_OPTIONS_PIE ${CMAKE_${lang}_COMPILE_OPTIONS_PIE} "-pie")
set(CMAKE_${lang}_LINK_OPTIONS_NO_PIE "-no-pie")
- set(CMAKE_${lang}_COMPILE_OPTIONS_WARNING_AS_ERROR "-Werror")
set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-fPIC")
set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared")
@@ -81,7 +82,9 @@ else()
list(APPEND CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND "--target=${CMAKE_${lang}_COMPILER_TARGET}")
endif()
- if(NOT "x${lang}" STREQUAL "xFortran")
+ if("x${lang}" STREQUAL "xFortran")
+ set(CMAKE_${lang}_COMPILE_OPTIONS_WARNING_AS_ERROR "-warn" "errors")
+ else()
# Precompile Headers
set(CMAKE_PCH_EXTENSION .pch)
set(CMAKE_PCH_PROLOGUE "#pragma clang system_header")
@@ -89,6 +92,9 @@ else()
set(CMAKE_${lang}_COMPILE_OPTIONS_INVALID_PCH -Winvalid-pch)
set(CMAKE_${lang}_COMPILE_OPTIONS_USE_PCH -Xclang -include-pch -Xclang <PCH_FILE> -Xclang -include -Xclang <PCH_HEADER>)
set(CMAKE_${lang}_COMPILE_OPTIONS_CREATE_PCH -Xclang -emit-pch -Xclang -include -Xclang <PCH_HEADER> -x ${__pch_header_${lang}})
+
+ # COMPILE_WARNING_AS_ERROR
+ set(CMAKE_${lang}_COMPILE_OPTIONS_WARNING_AS_ERROR "-Werror")
endif()
endmacro()
endif()
diff --git a/Modules/Compiler/LLVMFlang-Fortran.cmake b/Modules/Compiler/LLVMFlang-Fortran.cmake
index 7e9ba5ecb..651bf51a5 100644
--- a/Modules/Compiler/LLVMFlang-Fortran.cmake
+++ b/Modules/Compiler/LLVMFlang-Fortran.cmake
@@ -1,3 +1,5 @@
+set(CMAKE_Fortran_VERBOSE_FLAG "-v")
+
set(CMAKE_Fortran_SUBMODULE_SEP "-")
set(CMAKE_Fortran_SUBMODULE_EXT ".mod")
diff --git a/Modules/Compiler/NVHPC.cmake b/Modules/Compiler/NVHPC.cmake
index 957dacd38..474ac80ef 100644
--- a/Modules/Compiler/NVHPC.cmake
+++ b/Modules/Compiler/NVHPC.cmake
@@ -13,5 +13,5 @@ include(Compiler/PGI)
macro(__compiler_nvhpc lang)
# Logic specific to NVHPC.
set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-isystem ")
- set(CMAKE_${lang}_COMPILE_OPTIONS_WARNING_AS_ERROR "-Werror all-warnings")
+ set(CMAKE_${lang}_COMPILE_OPTIONS_WARNING_AS_ERROR "-Werror" "all-warnings")
endmacro()
diff --git a/Modules/Compiler/NVIDIA-CUDA.cmake b/Modules/Compiler/NVIDIA-CUDA.cmake
index 2e3ae2c3d..e07d15202 100644
--- a/Modules/Compiler/NVIDIA-CUDA.cmake
+++ b/Modules/Compiler/NVIDIA-CUDA.cmake
@@ -31,7 +31,7 @@ endif()
if (CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 10.2.89)
# Starting in 10.2, nvcc supported treating all warnings as errors
- set(CMAKE_CUDA_COMPILE_OPTIONS_WARNING_AS_ERROR "-Werror all-warnings")
+ set(CMAKE_CUDA_COMPILE_OPTIONS_WARNING_AS_ERROR "-Werror" "all-warnings")
endif()
if (CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 10.2.89)
diff --git a/Modules/FindJNI.cmake b/Modules/FindJNI.cmake
index e93b91e2b..64163b008 100644
--- a/Modules/FindJNI.cmake
+++ b/Modules/FindJNI.cmake
@@ -107,7 +107,7 @@ include(FindPackageHandleStandardArgs)
if(NOT JNI_FIND_COMPONENTS)
if(ANDROID)
- if(CMAKE_ANDROID_API LESS 31)
+ if(CMAKE_SYSTEM_VERSION LESS 31)
# There are no components for Android NDK
set(JNI_FIND_COMPONENTS)
else()
@@ -125,7 +125,7 @@ else()
# On Android, if JVM was requested we need to find NativeHelper as well which
# is an implicit dependency of JVM allowing to provide uniform access to basic
# JVM/DVM functionality.
- if(ANDROID AND CMAKE_ANDROID_API GREATER_EQUAL 31 AND JVM IN_LIST JNI_FIND_COMPONENTS)
+ if(ANDROID AND CMAKE_SYSTEM_VERSION GREATER_EQUAL 31 AND JVM IN_LIST JNI_FIND_COMPONENTS)
if(NOT NativeHelper IN_LIST JNI_FIND_COMPONENTS)
list(APPEND JNI_FIND_COMPONENTS NativeHelper)
# NativeHelper is required only if JVM was requested as such.
diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake
index 48ef5eb68..470ebe0ea 100644
--- a/Modules/FindMatlab.cmake
+++ b/Modules/FindMatlab.cmake
@@ -288,6 +288,7 @@ if(NOT MATLAB_ADDITIONAL_VERSIONS)
endif()
set(MATLAB_VERSIONS_MAPPING
+ "R2022b=9.13"
"R2022a=9.12"
"R2021b=9.11"
"R2021a=9.10"
@@ -1741,7 +1742,11 @@ endif()
if(APPLE)
set(_matlab_bin_prefix "mac") # i should be for intel
set(_matlab_bin_suffix_32bits "i")
- set(_matlab_bin_suffix_64bits "i64")
+ if(CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64")
+ set(_matlab_bin_suffix_64bits "a64")
+ else()
+ set(_matlab_bin_suffix_64bits "i64")
+ endif()
elseif(UNIX)
set(_matlab_bin_prefix "gln")
set(_matlab_bin_suffix_32bits "x86")
diff --git a/Modules/Internal/CPack/NSIS.template.in b/Modules/Internal/CPack/NSIS.template.in
index 42a44d96c..21753afe7 100644
--- a/Modules/Internal/CPack/NSIS.template.in
+++ b/Modules/Internal/CPack/NSIS.template.in
@@ -931,11 +931,20 @@ Function .onInit
;Run the uninstaller
uninst:
ClearErrors
- StrCpy $2 $0 1
- StrCmp '"' $2 0 +3 ; checks if string is quoted (CPack before v3.20.6 did not quote it)
- ExecWait '$0 /S'
- Goto +2
- ExecWait '"$0" /S'
+ # $0 should _always_ be quoted, however older versions of CMake did not
+ # do this. We'll conditionally remove the begin/end quotes.
+ # Remove first char if quote
+ StrCpy $2 $0 1 0 # copy first char
+ StrCmp $2 "$\"" 0 +2 # if char is quote
+ StrCpy $0 $0 "" 1 # remove first char
+ # Remove last char if quote
+ StrCpy $2 $0 1 -1 # copy last char
+ StrCmp $2 "$\"" 0 +2 # if char is quote
+ StrCpy $0 $0 -1 # remove last char
+
+ StrLen $2 "\@CPACK_NSIS_UNINSTALL_NAME@.exe"
+ StrCpy $3 $0 -$2 # remove "\@CPACK_NSIS_UNINSTALL_NAME@.exe" from UninstallString to get path
+ ExecWait '"$0" /S _?=$3' ;Do not copy the uninstaller to a temp file
IfErrors uninst_failed inst
uninst_failed:
diff --git a/Modules/Platform/Android.cmake b/Modules/Platform/Android.cmake
index 6944e3220..09a12ccb5 100644
--- a/Modules/Platform/Android.cmake
+++ b/Modules/Platform/Android.cmake
@@ -13,6 +13,12 @@ if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Android")
return()
endif()
+# NDK organizes API level specific libraries in numbered subdirectories. To
+# avoid incorrect inclusion of libraries below the targeted API level, disable
+# architecture specific path suffixes by default.
+set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB32_PATHS OFF)
+set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS OFF)
+
# Conventionally Android does not use versioned soname
# But in modern versions it is acceptable
if(NOT DEFINED CMAKE_PLATFORM_NO_VERSIONED_SONAME)
diff --git a/Modules/Platform/Windows-LLVMFlang-Fortran.cmake b/Modules/Platform/Windows-LLVMFlang-Fortran.cmake
new file mode 100644
index 000000000..64dc0da99
--- /dev/null
+++ b/Modules/Platform/Windows-LLVMFlang-Fortran.cmake
@@ -0,0 +1,3 @@
+include(Platform/Windows-GNU)
+__windows_compiler_gnu(Fortran)
+# TODO: MSVC ABI Support
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 665feebc4..be3ae8f72 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 24)
-set(CMake_VERSION_PATCH 2)
+set(CMake_VERSION_PATCH 3)
#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 [==[31f835410e CMake 3.24.2]==])
+ set(git_info [==[c974557598 CMake 3.24.3]==])
# 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/CPack/cpack.cxx b/Source/CPack/cpack.cxx
index 221f7ddbb..165036843 100644
--- a/Source/CPack/cpack.cxx
+++ b/Source/CPack/cpack.cxx
@@ -165,8 +165,8 @@ int main(int argc, char const* const* argv)
CommandArgument{ "--debug", CommandArgument::Values::Zero, debugLambda },
CommandArgument{ "--config", CommandArgument::Values::One,
CommandArgument::setToValue(cpackConfigFile) },
- CommandArgument{ "--trace", CommandArgument::Values::One, traceLambda },
- CommandArgument{ "--trace-expand", CommandArgument::Values::One,
+ CommandArgument{ "--trace", CommandArgument::Values::Zero, traceLambda },
+ CommandArgument{ "--trace-expand", CommandArgument::Values::Zero,
traceExpandLambda },
CommandArgument{ "-C", CommandArgument::Values::One,
CommandArgument::setToValue(cpackBuildConfig) },
diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx
index 2aba79d38..66c30c017 100644
--- a/Source/CTest/cmCTestBuildHandler.cxx
+++ b/Source/CTest/cmCTestBuildHandler.cxx
@@ -893,16 +893,31 @@ int cmCTestBuildHandler::RunMakeCommand(const std::string& command,
// If there was an error running command, report that on the
// dashboard.
if (this->UseCTestLaunch) {
- cmCTestLaunchReporter reporter;
- reporter.RealArgs = args;
- reporter.ComputeFileNames();
- reporter.ExitCode = *retVal;
- reporter.Process = cp;
- // Use temporary BuildLog file to populate this error for CDash.
- ofs.flush();
- reporter.LogOut = this->LogFileNames["Build"];
- reporter.LogOut += ".tmp";
- reporter.WriteXML();
+ // For launchers, do not record this top-level error if other
+ // more granular build errors have already been captured.
+ bool launcherXMLFound = false;
+ cmsys::Directory launchDir;
+ launchDir.Load(this->CTestLaunchDir);
+ unsigned long n = launchDir.GetNumberOfFiles();
+ for (unsigned long i = 0; i < n; ++i) {
+ const char* fname = launchDir.GetFile(i);
+ if (cmHasLiteralSuffix(fname, ".xml")) {
+ launcherXMLFound = true;
+ break;
+ }
+ }
+ if (!launcherXMLFound) {
+ cmCTestLaunchReporter reporter;
+ reporter.RealArgs = args;
+ reporter.ComputeFileNames();
+ reporter.ExitCode = *retVal;
+ reporter.Process = cp;
+ // Use temporary BuildLog file to populate this error for CDash.
+ ofs.flush();
+ reporter.LogOut = this->LogFileNames["Build"];
+ reporter.LogOut += ".tmp";
+ reporter.WriteXML();
+ }
} else {
cmCTestBuildErrorWarning errorwarning;
errorwarning.LineNumber = 0;
diff --git a/Source/Checks/cm_cxx_features.cmake b/Source/Checks/cm_cxx_features.cmake
index c88f5a376..73e7ef244 100644
--- a/Source/Checks/cm_cxx_features.cmake
+++ b/Source/Checks/cm_cxx_features.cmake
@@ -80,9 +80,7 @@ if(CMake_HAVE_CXX_MAKE_UNIQUE)
set(CMake_HAVE_CXX_UNIQUE_PTR 1)
endif()
cm_check_cxx_feature(unique_ptr)
-if (NOT CMAKE_CXX_STANDARD LESS "17"
- AND NOT MSYS # FIXME: RunCMake.cmake_path cases crash with MSYS std::filesystem
- )
+if (NOT CMAKE_CXX_STANDARD LESS "17")
if (NOT CMAKE_CROSSCOMPILING OR CMAKE_CROSSCOMPILING_EMULATOR)
cm_check_cxx_feature(filesystem TRY_RUN)
else()
diff --git a/Source/Checks/cm_cxx_filesystem.cxx b/Source/Checks/cm_cxx_filesystem.cxx
index ae8acc56a..732f28f39 100644
--- a/Source/Checks/cm_cxx_filesystem.cxx
+++ b/Source/Checks/cm_cxx_filesystem.cxx
@@ -23,5 +23,16 @@ int main()
}
#endif
+ // If std::string is copy-on-write, the std::filesystem::path
+ // implementation may accidentally trigger a reallocation and compute
+ // an offset between two allocations, leading to undefined behavior.
+#if defined(__GLIBCXX__) && \
+ (!defined(_GLIBCXX_USE_CXX11_ABI) || !_GLIBCXX_USE_CXX11_ABI)
+ std::string p5s1 = "/path";
+ std::string p5s2 = std::move(p5s1);
+ std::filesystem::path p5 = std::string(p5s2);
+ p5.remove_filename();
+#endif
+
return 0;
}
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index 850b7a3e4..cda70fc1a 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -368,6 +368,10 @@ cmComputeLinkInformation::cmComputeLinkInformation(
LibraryFeatureDescriptor{ "__CMAKE_LINK_EXECUTABLE",
cmStrCat(this->LoaderFlag, "<LIBRARY>") });
}
+ // To link framewortk using a full path
+ this->LibraryFeatureDescriptors.emplace(
+ "__CMAKE_LINK_FRAMEWORK",
+ LibraryFeatureDescriptor{ "__CMAKE_LINK_FRAMEWORK", "<LIBRARY>" });
// Check the platform policy for missing soname case.
this->NoSONameUsesPath =
@@ -1560,12 +1564,6 @@ void cmComputeLinkInformation::AddTargetItem(LinkEntry const& entry)
this->OldLinkDirItems.push_back(item.Value);
}
- if (target->IsFrameworkOnApple() && this->GlobalGenerator->IsXcode() &&
- entry.Feature == DEFAULT) {
- // ensure FRAMEWORK feature is loaded
- this->AddLibraryFeature("FRAMEWORK");
- }
-
if (target->IsFrameworkOnApple() && !this->GlobalGenerator->IsXcode()) {
// Add the framework directory and the framework item itself
auto fwItems = this->GlobalGenerator->SplitFrameworkPath(item.Value, true);
@@ -1597,7 +1595,7 @@ void cmComputeLinkInformation::AddTargetItem(LinkEntry const& entry)
this->FindLibraryFeature(
entry.Feature == DEFAULT
? (target->IsFrameworkOnApple() && this->GlobalGenerator->IsXcode()
- ? "FRAMEWORK"
+ ? "__CMAKE_LINK_FRAMEWORK"
: "__CMAKE_LINK_LIBRARY")
: entry.Feature));
}
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index 5418e7cac..b1d37a6ff 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -582,6 +582,12 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
fprintf(fout, "cmake_policy(SET CMP0126 OLD)\n");
}
+ /* Set language extensions policy to match outer project. */
+ if (this->Makefile->GetPolicyStatus(cmPolicies::CMP0128) !=
+ cmPolicies::NEW) {
+ fprintf(fout, "cmake_policy(SET CMP0128 OLD)\n");
+ }
+
std::string projectLangs;
for (std::string const& li : testLangs) {
projectLangs += " " + li;
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 7d0534747..3c234a69e 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -200,13 +200,19 @@ bool HandleReadCommand(std::vector<std::string> const& args,
// is there a limit?
std::string::size_type sizeLimit = std::string::npos;
if (!arguments.Limit.empty()) {
- std::istringstream(arguments.Limit) >> sizeLimit;
+ unsigned long long limit;
+ if (cmStrToULongLong(arguments.Limit, &limit)) {
+ sizeLimit = static_cast<std::string::size_type>(limit);
+ }
}
// is there an offset?
cmsys::ifstream::off_type offset = 0;
if (!arguments.Offset.empty()) {
- std::istringstream(arguments.Offset) >> offset;
+ long long off;
+ if (cmStrToLongLong(arguments.Offset, &off)) {
+ offset = static_cast<cmsys::ifstream::off_type>(off);
+ }
}
file.seekg(offset, std::ios::beg); // explicit ios::beg for IBM VisualAge 6
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 254220b24..0fe55f048 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -50,6 +50,7 @@
#include "cmState.h"
#include "cmStateDirectory.h"
#include "cmStateTypes.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmValue.h"
#include "cmVersion.h"
@@ -2570,7 +2571,7 @@ cmGlobalGenerator::SplitFrameworkPath(const std::string& path,
auto name = frameworkPath.match(3);
auto libname =
cmSystemTools::GetFilenameWithoutExtension(frameworkPath.match(6));
- if (!libname.empty() && name != libname) {
+ if (!libname.empty() && !cmHasPrefix(libname, name)) {
return cm::nullopt;
}
return std::pair<std::string, std::string>{ frameworkPath.match(2), name };
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index acaed3672..6248f09a5 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -1025,19 +1025,6 @@ bool cmGlobalNinjaGenerator::OpenBuildFileStreams()
return false;
}
- // New buffer size 8 MiB
- constexpr auto buildFileStreamBufferSize = 8 * 1024 * 1024;
-
- // Ensure the buffer is allocated
- if (!this->BuildFileStreamBuffer) {
- this->BuildFileStreamBuffer =
- cm::make_unique<char[]>(buildFileStreamBufferSize);
- }
-
- // Enlarge the internal buffer of the `BuildFileStream`
- this->BuildFileStream->rdbuf()->pubsetbuf(this->BuildFileStreamBuffer.get(),
- buildFileStreamBufferSize);
-
// Write a comment about this file.
*this->BuildFileStream
<< "# This file contains all the build statements describing the\n"
diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h
index aa2df4d5c..03387a88f 100644
--- a/Source/cmGlobalNinjaGenerator.h
+++ b/Source/cmGlobalNinjaGenerator.h
@@ -529,7 +529,6 @@ private:
/// The file containing the build statement. (the relationship of the
/// compilation DAG).
std::unique_ptr<cmGeneratedFileStream> BuildFileStream;
- std::unique_ptr<char[]> BuildFileStreamBuffer;
/// The file containing the rule statements. (The action attached to each
/// edge of the compilation DAG).
std::unique_ptr<cmGeneratedFileStream> RulesFileStream;
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index b9bbb67c4..23c365a4f 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -2393,8 +2393,13 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
// Add preprocessor definitions for this target and configuration.
BuildObjectListOrString ppDefs(this, true);
- this->AppendDefines(
- ppDefs, "CMAKE_INTDIR=\"$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\"");
+ if (languages.count("Swift")) {
+ // FIXME: Xcode warns that Swift does not support definition values.
+ // C/CXX sources mixed in Swift targets will not see CMAKE_INTDIR.
+ } else {
+ this->AppendDefines(
+ ppDefs, "CMAKE_INTDIR=\"$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\"");
+ }
if (const std::string* exportMacro = gtgt->GetExportMacro()) {
// Add the export symbol definition for shared library objects.
this->AppendDefines(ppDefs, exportMacro->c_str());
@@ -3813,9 +3818,17 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
// an implicit search path, so we need it
libPaths.Add("-F " + this->XCodeEscapePath(fwItems->first));
}
- libPaths.Add(
- libName.GetFormattedItem(this->XCodeEscapePath(fwItems->second))
- .Value);
+ if (libName.GetFeatureName() == "__CMAKE_LINK_FRAMEWORK"_s) {
+ // use the full path
+ libPaths.Add(
+ libName.GetFormattedItem(this->XCodeEscapePath(cleanPath))
+ .Value);
+ } else {
+ libPaths.Add(
+ libName
+ .GetFormattedItem(this->XCodeEscapePath(fwItems->second))
+ .Value);
+ }
} else {
libPaths.Add(
libName.GetFormattedItem(this->XCodeEscapePath(cleanPath))
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 67c8bf225..99bd05fdb 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1028,10 +1028,14 @@ void cmLocalGenerator::AddCompileOptions(std::vector<BT<std::string>>& flags,
// Add Warning as errors flags
if (!this->GetCMakeInstance()->GetIgnoreWarningAsError()) {
const cmValue wError = target->GetProperty("COMPILE_WARNING_AS_ERROR");
- const cmValue wErrorFlag = this->Makefile->GetDefinition(
+ const cmValue wErrorOpts = this->Makefile->GetDefinition(
cmStrCat("CMAKE_", lang, "_COMPILE_OPTIONS_WARNING_AS_ERROR"));
- if (wError.IsOn() && wErrorFlag.IsSet()) {
- flags.emplace_back(wErrorFlag);
+ if (wError.IsOn() && wErrorOpts.IsSet()) {
+ std::string wErrorFlags;
+ this->AppendCompileOptions(wErrorFlags, *wErrorOpts);
+ if (!wErrorFlags.empty()) {
+ flags.emplace_back(std::move(wErrorFlags));
+ }
}
}
diff --git a/Source/cmStringAlgorithms.cxx b/Source/cmStringAlgorithms.cxx
index 1bb680819..f73c85413 100644
--- a/Source/cmStringAlgorithms.cxx
+++ b/Source/cmStringAlgorithms.cxx
@@ -250,6 +250,38 @@ bool cmStrToULong(std::string const& str, unsigned long* value)
return cmStrToULong(str.c_str(), value);
}
+bool cmStrToLongLong(const char* str, long long* value)
+{
+ errno = 0;
+ char* endp;
+ *value = strtoll(str, &endp, 10);
+ return (*endp == '\0') && (endp != str) && (errno == 0);
+}
+
+bool cmStrToLongLong(std::string const& str, long long* value)
+{
+ return cmStrToLongLong(str.c_str(), value);
+}
+
+bool cmStrToULongLong(const char* str, unsigned long long* value)
+{
+ errno = 0;
+ char* endp;
+ while (cmIsSpace(*str)) {
+ ++str;
+ }
+ if (*str == '-') {
+ return false;
+ }
+ *value = strtoull(str, &endp, 10);
+ return (*endp == '\0') && (endp != str) && (errno == 0);
+}
+
+bool cmStrToULongLong(std::string const& str, unsigned long long* value)
+{
+ return cmStrToULongLong(str.c_str(), value);
+}
+
template <typename Range>
std::size_t getJoinedLength(Range const& rng, cm::string_view separator)
{
diff --git a/Source/cmStringAlgorithms.h b/Source/cmStringAlgorithms.h
index 492e588bb..83938bc24 100644
--- a/Source/cmStringAlgorithms.h
+++ b/Source/cmStringAlgorithms.h
@@ -303,3 +303,13 @@ bool cmStrToLong(std::string const& str, long* value);
* integer */
bool cmStrToULong(const char* str, unsigned long* value);
bool cmStrToULong(std::string const& str, unsigned long* value);
+
+/** Converts a string to long long. Expects that the whole string
+ * is an integer */
+bool cmStrToLongLong(const char* str, long long* value);
+bool cmStrToLongLong(std::string const& str, long long* value);
+
+/** Converts a string to unsigned long long. Expects that the whole string
+ * is an integer */
+bool cmStrToULongLong(const char* str, unsigned long long* value);
+bool cmStrToULongLong(std::string const& str, unsigned long long* value);
diff --git a/Source/cmVSSetupHelper.cxx b/Source/cmVSSetupHelper.cxx
index 1a3e72ea0..8764f210c 100644
--- a/Source/cmVSSetupHelper.cxx
+++ b/Source/cmVSSetupHelper.cxx
@@ -300,13 +300,32 @@ bool cmVSSetupAPIHelper::IsEWDKEnabled()
return false;
}
+#if !defined(CMAKE_BOOTSTRAP)
+namespace {
+std::string FindVsWhereCommand()
+{
+ std::string vswhere;
+ static const char* programFiles[] = { "ProgramFiles(x86)", "ProgramFiles" };
+ for (const char* pf : programFiles) {
+ if (cmSystemTools::GetEnv(pf, vswhere)) {
+ vswhere += "/Microsoft Visual Studio/Installer/vswhere.exe";
+ if (cmSystemTools::FileExists(vswhere)) {
+ return vswhere;
+ }
+ }
+ }
+ vswhere = "vswhere.exe";
+ return vswhere;
+}
+}
+#endif
+
bool cmVSSetupAPIHelper::EnumerateVSInstancesWithVswhere(
std::vector<VSInstanceInfo>& VSInstances)
{
#if !defined(CMAKE_BOOTSTRAP)
// Construct vswhere command to get installed VS instances in JSON format
- std::string vswhereExe = getenv("ProgramFiles(x86)") +
- std::string(R"(\Microsoft Visual Studio\Installer\vswhere.exe)");
+ std::string vswhereExe = FindVsWhereCommand();
std::vector<std::string> vswhereCmd = { vswhereExe, "-format", "json" };
// Execute vswhere command and capture JSON output
diff --git a/Tests/CMakeLib/testStringAlgorithms.cxx b/Tests/CMakeLib/testStringAlgorithms.cxx
index c2706c1f9..1e6b6118e 100644
--- a/Tests/CMakeLib/testStringAlgorithms.cxx
+++ b/Tests/CMakeLib/testStringAlgorithms.cxx
@@ -227,6 +227,41 @@ int testStringAlgorithms(int /*unused*/, char* /*unused*/ [])
}
// ----------------------------------------------------------------------
+ // Test cmStrToLongLong
+ {
+ long long value;
+ assert_ok(cmStrToLongLong("1", &value) && value == 1,
+ "cmStrToLongLong parses a positive decimal integer.");
+ assert_ok(cmStrToLongLong(" 1", &value) && value == 1,
+ "cmStrToLongLong parses a decimal integer after whitespace.");
+
+ assert_ok(cmStrToLongLong("-1", &value) && value == -1,
+ "cmStrToLongLong parses a negative decimal integer.");
+ assert_ok(
+ cmStrToLongLong(" -1", &value) && value == -1,
+ "cmStrToLongLong parses a negative decimal integer after whitespace.");
+
+ assert_ok(!cmStrToLongLong("1x", &value),
+ "cmStrToLongLong rejects trailing content.");
+ }
+
+ // ----------------------------------------------------------------------
+ // Test cmStrToULongLong
+ {
+ unsigned long long value;
+ assert_ok(cmStrToULongLong("1", &value) && value == 1,
+ "cmStrToULongLong parses a decimal integer.");
+ assert_ok(cmStrToULongLong(" 1", &value) && value == 1,
+ "cmStrToULongLong parses a decimal integer after whitespace.");
+ assert_ok(!cmStrToULongLong("-1", &value),
+ "cmStrToULongLong rejects a negative number.");
+ assert_ok(!cmStrToULongLong(" -1", &value),
+ "cmStrToULongLong rejects a negative number after whitespace.");
+ assert_ok(!cmStrToULongLong("1x", &value),
+ "cmStrToULongLong rejects trailing content.");
+ }
+
+ // ----------------------------------------------------------------------
// Test cmStrLen
{
constexpr auto len = cmStrLen("Hello world!");
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 24e98f492..3e400c2f3 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -1574,6 +1574,7 @@ if(BUILD_TESTING)
)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ExternalProject")
set_tests_properties(ExternalProject PROPERTIES
+ ENVIRONMENT GIT_ALLOW_PROTOCOL=file
RUN_SERIAL 1
TIMEOUT ${CMAKE_LONG_TEST_TIMEOUT})
@@ -2656,6 +2657,7 @@ if(BUILD_TESTING)
-P "${CMake_BINARY_DIR}/Tests/CTestUpdateGIT.cmake"
)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${CTestUpdateGIT_DIR}")
+ set_property(TEST CTest.UpdateGIT PROPERTY ENVIRONMENT GIT_ALLOW_PROTOCOL=file)
endif()
# Test CTest Update with HG
diff --git a/Tests/Fortran/CMakeLists.txt b/Tests/Fortran/CMakeLists.txt
index cdc08c4d7..0fede2567 100644
--- a/Tests/Fortran/CMakeLists.txt
+++ b/Tests/Fortran/CMakeLists.txt
@@ -123,7 +123,7 @@ endfunction()
# if the id's match or the compilers are compatible, then
# call the test_fortran_c_interface_module function
if("${CMAKE_Fortran_COMPILER_ID}:${CMAKE_C_COMPILER_ID}" MATCHES
- "(Intel(LLVM)?:MSVC|Absoft:GNU)"
+ "(Intel(LLVM)?:MSVC|Absoft:GNU|LLVMFlang:(GNU|Clang))"
OR ("${CMAKE_Fortran_COMPILER_ID}" STREQUAL "${CMAKE_C_COMPILER_ID}" ))
test_fortran_c_interface_module()
else()
diff --git a/Tests/FortranC/CMakeLists.txt b/Tests/FortranC/CMakeLists.txt
index 83c27296a..1403aa0d5 100644
--- a/Tests/FortranC/CMakeLists.txt
+++ b/Tests/FortranC/CMakeLists.txt
@@ -3,7 +3,7 @@ project(FortranC C Fortran)
# Skip this test for compilers not known to be compatible.
if(NOT (CMAKE_C_COMPILER_ID STREQUAL CMAKE_Fortran_COMPILER_ID OR
- "${CMAKE_C_COMPILER_ID}-${CMAKE_Fortran_COMPILER_ID}" MATCHES "^(MSVC-Intel)$"))
+ "${CMAKE_C_COMPILER_ID}-${CMAKE_Fortran_COMPILER_ID}" MATCHES "^(MSVC-Intel|(GNU|Clang)-LLVMFlang)$"))
message(STATUS "${CMAKE_C_COMPILER_ID} C and ${CMAKE_Fortran_COMPILER_ID} Fortran not known to be compatible!")
return()
endif()
diff --git a/Tests/RunCMake/Framework/FrameworkMultiConfigPostfix.cmake b/Tests/RunCMake/Framework/FrameworkMultiConfigPostfix.cmake
index 51e627d6d..3afda4d7b 100644
--- a/Tests/RunCMake/Framework/FrameworkMultiConfigPostfix.cmake
+++ b/Tests/RunCMake/Framework/FrameworkMultiConfigPostfix.cmake
@@ -23,3 +23,8 @@ string(APPEND content
"set(target_file_name ${target_name})\n")
file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/FrameworkMultiConfigPostfixInfo.cmake
CONTENT "${content}")
+
+
+# Try to link this framework to ensure postfix is correctly handled
+add_library(otherlib SHARED foo.c)
+target_link_libraries(otherlib PRIVATE ${target_name})
diff --git a/Tests/RunCMake/Ninja/Intl-build-check.cmake b/Tests/RunCMake/Ninja/Intl-build-check.cmake
new file mode 100644
index 000000000..77f013c7e
--- /dev/null
+++ b/Tests/RunCMake/Ninja/Intl-build-check.cmake
@@ -0,0 +1,5 @@
+include(${RunCMake_SOURCE_DIR}/Intl-common.cmake)
+set(output "${RunCMake_TEST_BINARY_DIR}/${intl}-output.txt")
+if(NOT EXISTS "${output}")
+ set(RunCMake_TEST_FAILED "Expected output does not exist:\n ${output}")
+endif()
diff --git a/Tests/RunCMake/Ninja/Intl-common.cmake b/Tests/RunCMake/Ninja/Intl-common.cmake
new file mode 100644
index 000000000..770397681
--- /dev/null
+++ b/Tests/RunCMake/Ninja/Intl-common.cmake
@@ -0,0 +1 @@
+set(intl "intl-ë®")
diff --git a/Tests/RunCMake/Ninja/Intl.cmake b/Tests/RunCMake/Ninja/Intl.cmake
new file mode 100644
index 000000000..50e4ee41e
--- /dev/null
+++ b/Tests/RunCMake/Ninja/Intl.cmake
@@ -0,0 +1,7 @@
+include(Intl-common.cmake)
+set(input "${CMAKE_CURRENT_BINARY_DIR}/${intl}-input.txt")
+set(output "${CMAKE_CURRENT_BINARY_DIR}/${intl}-output.txt")
+file(WRITE "${input}" "${intl}\n")
+add_custom_command(OUTPUT "${output}"
+ COMMAND ${CMAKE_COMMAND} -E copy "${input}" "${output}")
+add_custom_target(drive ALL DEPENDS "${output}")
diff --git a/Tests/RunCMake/Ninja/RunCMakeTest.cmake b/Tests/RunCMake/Ninja/RunCMakeTest.cmake
index 2a5b55620..0825666a0 100644
--- a/Tests/RunCMake/Ninja/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Ninja/RunCMakeTest.cmake
@@ -33,6 +33,15 @@ function(run_NinjaToolMissing)
endfunction()
run_NinjaToolMissing()
+function(run_Intl)
+ run_cmake(Intl)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Intl-build)
+ set(RunCMake_TEST_OUTPUT_MERGE 1)
+ run_cmake_command(Intl-build ${CMAKE_COMMAND} --build .)
+endfunction()
+run_Intl()
+
function(run_NoWorkToDo)
run_cmake(NoWorkToDo)
set(RunCMake_TEST_NO_CLEAN 1)
diff --git a/Tests/RunCMake/ParseImplicitData/linux-Fortran-LLVMFlang-15.0.0.input b/Tests/RunCMake/ParseImplicitData/linux-Fortran-LLVMFlang-15.0.0.input
new file mode 100644
index 000000000..5a53c882a
--- /dev/null
+++ b/Tests/RunCMake/ParseImplicitData/linux-Fortran-LLVMFlang-15.0.0.input
@@ -0,0 +1,43 @@
+CMAKE_LANG=Fortran
+CMAKE_LINKER=/usr/bin/ld
+CMAKE_Fortran_COMPILER_ABI=
+CMAKE_Fortran_COMPILER_AR=
+CMAKE_Fortran_COMPILER_ARCHITECTURE_ID=
+CMAKE_Fortran_COMPILER_EXTERNAL_TOOLCHAIN=
+CMAKE_Fortran_COMPILER_ID=LLVMFlang
+CMAKE_Fortran_COMPILER_LAUNCHER=
+CMAKE_Fortran_COMPILER_LOADED=1
+CMAKE_Fortran_COMPILER_RANLIB=
+CMAKE_Fortran_COMPILER_TARGET=
+CMAKE_Fortran_COMPILER_VERSION=15.0.0
+CMAKE_Fortran_COMPILER_VERSION_INTERAL=
+Change Dir: /tmp/ii/CMakeFiles/CMakeTmp
+
+Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_2e9b9/fast && /usr/bin/gmake -f CMakeFiles/cmTC_2e9b9.dir/build.make CMakeFiles/cmTC_2e9b9.dir/build
+gmake[1]: Entering directory '/tmp/ii/CMakeFiles/CMakeTmp'
+Building Fortran object CMakeFiles/cmTC_2e9b9.dir/CMakeFortranCompilerABI.F.o
+/usr/bin/flang-new -v -c /tmp/CMake/Modules/CMakeFortranCompilerABI.F -o CMakeFiles/cmTC_2e9b9.dir/CMakeFortranCompilerABI.F.o
+flang-new version 15.0.0 (Fedora 15.0.0-4.fc38)
+Target: x86_64-redhat-linux-gnu
+Thread model: posix
+InstalledDir: /usr/bin
+Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-redhat-linux/12
+Selected GCC installation: /usr/bin/../lib/gcc/x86_64-redhat-linux/12
+Candidate multilib: .@m64
+Candidate multilib: 32@m32
+Selected multilib: .@m64
+ "/usr/bin/flang-new" -fc1 -triple x86_64-redhat-linux-gnu -emit-obj -o CMakeFiles/cmTC_2e9b9.dir/CMakeFortranCompilerABI.F.o -x f95-cpp-input /tmp/CMake/Modules/CMakeFortranCompilerABI.F
+Linking Fortran executable cmTC_2e9b9
+/tmp/CMake/bin/cmake -E cmake_link_script CMakeFiles/cmTC_2e9b9.dir/link.txt --verbose=1
+/usr/bin/flang-new -v CMakeFiles/cmTC_2e9b9.dir/CMakeFortranCompilerABI.F.o -o cmTC_2e9b9
+flang-new version 15.0.0 (Fedora 15.0.0-4.fc38)
+Target: x86_64-redhat-linux-gnu
+Thread model: posix
+InstalledDir: /usr/bin
+Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-redhat-linux/12
+Selected GCC installation: /usr/bin/../lib/gcc/x86_64-redhat-linux/12
+Candidate multilib: .@m64
+Candidate multilib: 32@m32
+Selected multilib: .@m64
+ "/usr/bin/ld" --hash-style=gnu --build-id --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o cmTC_2e9b9 /usr/bin/../lib/gcc/x86_64-redhat-linux/12/../../../../lib64/crt1.o /usr/bin/../lib/gcc/x86_64-redhat-linux/12/../../../../lib64/crti.o /usr/bin/../lib/gcc/x86_64-redhat-linux/12/crtbegin.o -L/usr/bin/../lib/gcc/x86_64-redhat-linux/12 -L/usr/bin/../lib/gcc/x86_64-redhat-linux/12/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/lib -L/usr/lib CMakeFiles/cmTC_2e9b9.dir/CMakeFortranCompilerABI.F.o -lFortran_main -lFortranRuntime -lFortranDecimal -lm -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/bin/../lib/gcc/x86_64-redhat-linux/12/crtend.o /usr/bin/../lib/gcc/x86_64-redhat-linux/12/../../../../lib64/crtn.o
+gmake[1]: Leaving directory '/tmp/ii/CMakeFiles/CMakeTmp'
diff --git a/Tests/RunCMake/ParseImplicitLinkInfo/ParseImplicitLinkInfo.cmake b/Tests/RunCMake/ParseImplicitLinkInfo/ParseImplicitLinkInfo.cmake
index 51c88325f..1410eae78 100644
--- a/Tests/RunCMake/ParseImplicitLinkInfo/ParseImplicitLinkInfo.cmake
+++ b/Tests/RunCMake/ParseImplicitLinkInfo/ParseImplicitLinkInfo.cmake
@@ -38,6 +38,7 @@ set(targets
linux-C-XL-16.1.0.0 linux-CXX-XL-16.1.0.0
linux-CUDA-NVIDIA-10.1.168-CLANG linux-CUDA-NVIDIA-10.1.168-XLClang-v
linux-CUDA-NVIDIA-9.2.148-GCC
+ linux-Fortran-LLVMFlang-15.0.0
linux-custom_clang-C-Clang-13.0.0 linux-custom_clang-CXX-Clang-13.0.0
mingw.org-C-GNU-4.9.3 mingw.org-CXX-GNU-4.9.3
netbsd-C-GNU-4.8.5 netbsd-CXX-GNU-4.8.5
diff --git a/Tests/RunCMake/ParseImplicitLinkInfo/results/linux-Fortran-LLVMFlang-15.0.0.output b/Tests/RunCMake/ParseImplicitLinkInfo/results/linux-Fortran-LLVMFlang-15.0.0.output
new file mode 100644
index 000000000..cea8a687b
--- /dev/null
+++ b/Tests/RunCMake/ParseImplicitLinkInfo/results/linux-Fortran-LLVMFlang-15.0.0.output
@@ -0,0 +1,2 @@
+libs=Fortran_main;FortranRuntime;FortranDecimal;m;gcc;gcc_s;c;gcc;gcc_s
+dirs=/usr/lib/gcc/x86_64-redhat-linux/12;/usr/lib64;/lib64;/lib;/usr/lib
diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
index d20f5a61a..128a9dcab 100644
--- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
+++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
@@ -290,30 +290,33 @@ if(XCODE_VERSION VERSION_GREATER_EQUAL 6)
unset(RunCMake_TEST_OPTIONS)
# XcodeIOSInstallCombinedPrune
- set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeIOSInstallCombinedPrune-build)
- set(RunCMake_TEST_NO_CLEAN 1)
- set(RunCMake_TEST_OPTIONS
- "-DCMAKE_SYSTEM_NAME=iOS"
- "-DCMAKE_IOS_INSTALL_COMBINED=YES"
- "-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_TEST_BINARY_DIR}/_install")
+ # FIXME(#24011): Xcode 14 removed support for older architectures the test needs.
+ if(XCODE_VERSION VERSION_LESS 14)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeIOSInstallCombinedPrune-build)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ set(RunCMake_TEST_OPTIONS
+ "-DCMAKE_SYSTEM_NAME=iOS"
+ "-DCMAKE_IOS_INSTALL_COMBINED=YES"
+ "-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_TEST_BINARY_DIR}/_install")
- file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
- file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
+ file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
+ file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
- run_cmake(XcodeIOSInstallCombinedPrune)
- run_cmake_command(XcodeIOSInstallCombinedPrune-build ${CMAKE_COMMAND} --build .)
- if(XCODE_VERSION VERSION_LESS 12)
- run_cmake_command(XcodeIOSInstallCombinedPrune-install ${CMAKE_COMMAND} --build . --target install)
+ run_cmake(XcodeIOSInstallCombinedPrune)
+ run_cmake_command(XcodeIOSInstallCombinedPrune-build ${CMAKE_COMMAND} --build .)
+ if(XCODE_VERSION VERSION_LESS 12)
+ run_cmake_command(XcodeIOSInstallCombinedPrune-install ${CMAKE_COMMAND} --build . --target install)
+ endif()
+ # --build defaults to Debug, --install defaults to Release, so we have to
+ # specify the configuration explicitly
+ run_cmake_command(XcodeIOSInstallCombinedPrune-cmakeinstall
+ ${CMAKE_COMMAND} --install . --config Debug
+ )
+
+ unset(RunCMake_TEST_BINARY_DIR)
+ unset(RunCMake_TEST_NO_CLEAN)
+ unset(RunCMake_TEST_OPTIONS)
endif()
- # --build defaults to Debug, --install defaults to Release, so we have to
- # specify the configuration explicitly
- run_cmake_command(XcodeIOSInstallCombinedPrune-cmakeinstall
- ${CMAKE_COMMAND} --install . --config Debug
- )
-
- unset(RunCMake_TEST_BINARY_DIR)
- unset(RunCMake_TEST_NO_CLEAN)
- unset(RunCMake_TEST_OPTIONS)
# XcodeIOSInstallCombinedSingleArch
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeIOSInstallCombinedSingleArch-build)
diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined-install-check.cmake b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined-install-check.cmake
index 53b885d29..60bc0d8fc 100644
--- a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined-install-check.cmake
+++ b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined-install-check.cmake
@@ -9,11 +9,18 @@ function(verify_architectures file)
return()
endif()
- string(REGEX MATCHALL "\narchitecture [^ \n\t()]+" architectures ${otool_out})
+ string(REGEX MATCHALL "\narchitecture [^ \n\t()]+" architectures "${otool_out}")
string(REPLACE "\narchitecture " "" actual "${architectures}")
list(SORT actual)
- set(expected arm64 armv7 i386 x86_64)
+ if(XCODE_VERSION VERSION_LESS 14)
+ set(maybe_armv7 armv7)
+ set(maybe_i386 i386)
+ else()
+ set(maybe_armv7 "")
+ set(maybe_i386 "")
+ endif()
+ set(expected arm64 ${maybe_armv7} ${maybe_i386} x86_64)
if(NOT actual STREQUAL expected)
message(SEND_ERROR
diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined.cmake b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined.cmake
index 19f8e2fb4..8426148b8 100644
--- a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined.cmake
+++ b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined.cmake
@@ -2,7 +2,13 @@ cmake_minimum_required(VERSION 3.3)
project(IOSInstallCombined CXX)
-if(XCODE_VERSION VERSION_GREATER_EQUAL 9)
+set(maybe_armv7 armv7)
+set(maybe_i386 i386)
+if(XCODE_VERSION VERSION_GREATER_EQUAL 14)
+ set(CMAKE_OSX_DEPLOYMENT_TARGET 16)
+ set(maybe_armv7 "")
+ set(maybe_i386 "")
+elseif(XCODE_VERSION VERSION_GREATER_EQUAL 9)
set(CMAKE_OSX_DEPLOYMENT_TARGET 10)
endif()
@@ -16,7 +22,7 @@ set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "")
set(CMAKE_XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT "dwarf")
set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "NO")
-set(CMAKE_OSX_ARCHITECTURES "armv7;arm64;i386;x86_64")
+set(CMAKE_OSX_ARCHITECTURES ${maybe_armv7} arm64 ${maybe_i386} x86_64)
add_executable(foo_app MACOSX_BUNDLE main.cpp)
install(TARGETS foo_app BUNDLE DESTINATION bin)
diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch-install-check.cmake b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch-install-check.cmake
index 3c11ae0ee..db8f869f3 100644
--- a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch-install-check.cmake
+++ b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch-install-check.cmake
@@ -12,7 +12,11 @@ function(verify_architecture file)
string(REGEX MATCHALL "is architecture: [^ \n\t]+" architecture "${lipo_out}")
string(REGEX REPLACE "is architecture: " "" actual "${architecture}")
- set(expected armv7)
+ if(XCODE_VERSION VERSION_GREATER_EQUAL 14)
+ set(expected arm64)
+ else()
+ set(expected armv7)
+ endif()
if(NOT actual STREQUAL expected)
message(SEND_ERROR
diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch.cmake b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch.cmake
index 974ae47eb..5177ec2c8 100644
--- a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch.cmake
+++ b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch.cmake
@@ -2,7 +2,11 @@ cmake_minimum_required(VERSION 3.3)
project(XcodeIOSInstallCombinedSingleArch CXX)
-if(XCODE_VERSION VERSION_GREATER_EQUAL 9)
+set(iphoneos_arch armv7)
+if(XCODE_VERSION VERSION_GREATER_EQUAL 14)
+ set(CMAKE_OSX_DEPLOYMENT_TARGET 16)
+ set(iphoneos_arch arm64)
+elseif(XCODE_VERSION VERSION_GREATER_EQUAL 9)
set(CMAKE_OSX_DEPLOYMENT_TARGET 10)
endif()
@@ -17,8 +21,8 @@ install(TARGETS foo DESTINATION lib)
set_target_properties(
foo
PROPERTIES
- XCODE_ATTRIBUTE_ARCHS[sdk=iphoneos*] armv7
- XCODE_ATTRIBUTE_VALID_ARCHS[sdk=iphoneos*] armv7
+ XCODE_ATTRIBUTE_ARCHS[sdk=iphoneos*] ${iphoneos_arch}
+ XCODE_ATTRIBUTE_VALID_ARCHS[sdk=iphoneos*] ${iphoneos_arch}
XCODE_ATTRIBUTE_ARCHS[sdk=iphonesimulator*] ""
XCODE_ATTRIBUTE_VALID_ARCHS[sdk=iphonesimulator*] ""
)
diff --git a/Tests/RunCMake/ctest_build/CMakeLists.txt.in b/Tests/RunCMake/ctest_build/CMakeLists.txt.in
index 133ae3662..4a067fa50 100644
--- a/Tests/RunCMake/ctest_build/CMakeLists.txt.in
+++ b/Tests/RunCMake/ctest_build/CMakeLists.txt.in
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.1)
@CASE_CMAKELISTS_PREFIX_CODE@
-project(CTestBuild@CASE_NAME@ NONE)
+project(CTestBuild@CASE_NAME@ @LANG@)
include(CTest)
add_test(NAME RunCMakeVersion COMMAND "${CMAKE_COMMAND}" --version)
@CASE_CMAKELISTS_SUFFIX_CODE@
diff --git a/Tests/RunCMake/ctest_build/NinjaLauncherSingleBuildFailure-check.cmake b/Tests/RunCMake/ctest_build/NinjaLauncherSingleBuildFailure-check.cmake
new file mode 100644
index 000000000..7089d7000
--- /dev/null
+++ b/Tests/RunCMake/ctest_build/NinjaLauncherSingleBuildFailure-check.cmake
@@ -0,0 +1,23 @@
+file(GLOB build_xml_file "${RunCMake_TEST_BINARY_DIR}/Testing/*/Build.xml")
+if(build_xml_file)
+ file(READ "${build_xml_file}" build_xml LIMIT 8192)
+ string(FIND "${build_xml}" [[This should not be compiled]] expected_failure_pos)
+ if(expected_failure_pos EQUAL "-1")
+ string(REPLACE "\n" "\n " build_xml " ${build_xml}")
+ set(RunCMake_TEST_FAILED
+ "Build.xml does not have expected error message:\n${build_xml}"
+ )
+ else()
+ string(SUBSTRING "${build_xml}" "${expected_failure_pos}" -1 remaining_xml)
+ string(FIND "${remaining_xml}" [[<Failure type="Error">]] unexpected_failure_pos)
+ if(NOT unexpected_failure_pos EQUAL "-1")
+ string(SUBSTRING "${remaining_xml}" "${unexpected_failure_pos}" -1 error_msg_xml)
+ string(REPLACE "\n" "\n " error_msg_xml " ${error_msg_xml}")
+ set(RunCMake_TEST_FAILED
+ "Build.xml contains unexpected extra <Failure> elements:\n${error_msg_xml}"
+ )
+ endif()
+ endif()
+else()
+ set(RunCMake_TEST_FAILED "Build.xml not found")
+endif()
diff --git a/Tests/RunCMake/ctest_build/NinjaLauncherSingleBuildFailure-result.txt b/Tests/RunCMake/ctest_build/NinjaLauncherSingleBuildFailure-result.txt
new file mode 100644
index 000000000..b57e2deb7
--- /dev/null
+++ b/Tests/RunCMake/ctest_build/NinjaLauncherSingleBuildFailure-result.txt
@@ -0,0 +1 @@
+(-1|255)
diff --git a/Tests/RunCMake/ctest_build/NinjaLauncherSingleBuildFailure-stderr.txt b/Tests/RunCMake/ctest_build/NinjaLauncherSingleBuildFailure-stderr.txt
new file mode 100644
index 000000000..bbe9410a1
--- /dev/null
+++ b/Tests/RunCMake/ctest_build/NinjaLauncherSingleBuildFailure-stderr.txt
@@ -0,0 +1 @@
+^Error\(s\) when building project
diff --git a/Tests/RunCMake/ctest_build/RunCMakeTest.cmake b/Tests/RunCMake/ctest_build/RunCMakeTest.cmake
index e94a55d27..6f1b4b6f4 100644
--- a/Tests/RunCMake/ctest_build/RunCMakeTest.cmake
+++ b/Tests/RunCMake/ctest_build/RunCMakeTest.cmake
@@ -1,5 +1,6 @@
include(RunCTest)
+set(LANG NONE)
set(CASE_CTEST_BUILD_ARGS "")
set(RunCMake_USE_LAUNCHERS TRUE)
set(RunCMake_USE_CUSTOM_BUILD_COMMAND FALSE)
@@ -70,3 +71,18 @@ set(RunCMake_USE_LAUNCHERS FALSE)
set(RunCMake_BUILD_COMMAND "${COLOR_WARNING}")
run_ctest(IgnoreColor)
unset(RunCMake_BUILD_COMMAND)
+
+set(RunCMake_USE_CUSTOM_BUILD_COMMAND FALSE)
+if(RunCMake_GENERATOR MATCHES "Ninja")
+ function(run_NinjaLauncherSingleBuildFailure)
+ set(LANG C)
+ set(RunCMake_USE_LAUNCHERS TRUE)
+ set(RunCMake_TEST_SOURCE_DIR "${RunCMake_BINARY_DIR}/NinjaLauncherSingleBuildFailure")
+ configure_file("${RunCMake_SOURCE_DIR}/error.c" "${RunCMake_TEST_SOURCE_DIR}/error.c" COPYONLY)
+ set(CASE_CMAKELISTS_SUFFIX_CODE [=[
+ add_executable(error error.c)
+ ]=])
+ run_ctest(NinjaLauncherSingleBuildFailure)
+ endfunction()
+ run_NinjaLauncherSingleBuildFailure()
+endif()
diff --git a/Tests/RunCMake/ctest_build/error.c b/Tests/RunCMake/ctest_build/error.c
new file mode 100644
index 000000000..f10e68700
--- /dev/null
+++ b/Tests/RunCMake/ctest_build/error.c
@@ -0,0 +1 @@
+#error "This should not be compiled"
diff --git a/Tests/RunCMake/try_compile/CMP0128-NEW.cmake b/Tests/RunCMake/try_compile/CMP0128-NEW.cmake
new file mode 100644
index 000000000..20e389a7d
--- /dev/null
+++ b/Tests/RunCMake/try_compile/CMP0128-NEW.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0128 NEW)
+set(check_cxx_std "
+#if __cplusplus > 199711L && __cplusplus <= 201103L
+# error Compiler is incorrectly in C++11 mode.
+#endif
+")
+include(CMP0128-common.cmake)
diff --git a/Tests/RunCMake/try_compile/CMP0128-WARN.cmake b/Tests/RunCMake/try_compile/CMP0128-WARN.cmake
new file mode 100644
index 000000000..266bd22ae
--- /dev/null
+++ b/Tests/RunCMake/try_compile/CMP0128-WARN.cmake
@@ -0,0 +1,7 @@
+
+set(check_cxx_std "
+#if __cplusplus <= 199711L || __cplusplus > 201103L
+# error Compiler is incorrectly not in C++11 mode.
+#endif
+")
+include(CMP0128-common.cmake)
diff --git a/Tests/RunCMake/try_compile/CMP0128-common.cmake b/Tests/RunCMake/try_compile/CMP0128-common.cmake
new file mode 100644
index 000000000..0b8a12bc5
--- /dev/null
+++ b/Tests/RunCMake/try_compile/CMP0128-common.cmake
@@ -0,0 +1,31 @@
+cmake_policy(SET CMP0067 NEW)
+enable_language(CXX)
+
+# Isolate the one try_compile below in the error log.
+set(CMakeError_log "${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log")
+file(REMOVE "${CMakeError_log}")
+
+# Add our own -std= flag to the try_compile check.
+set(CMAKE_REQUIRED_FLAGS -std=c++11)
+
+# Tell CMP0128 NEW behavior to append a -std= flag (after ours).
+if(CMAKE_CXX_EXTENSIONS_DEFAULT)
+ set(CMAKE_CXX_EXTENSIONS OFF)
+else()
+ set(CMAKE_CXX_EXTENSIONS ON)
+endif()
+
+include(CheckSourceCompiles)
+check_source_compiles(CXX "
+${check_cxx_std}
+int main()
+{
+ return 0;
+}
+" SRC_COMPILED)
+if(NOT SRC_COMPILED)
+ if(EXISTS "${CMakeError_log}")
+ file(READ "${CMakeError_log}" err_log)
+ endif()
+ message("${err_log}")
+endif()
diff --git a/Tests/RunCMake/try_compile/Inspect.cmake b/Tests/RunCMake/try_compile/Inspect.cmake
new file mode 100644
index 000000000..added410b
--- /dev/null
+++ b/Tests/RunCMake/try_compile/Inspect.cmake
@@ -0,0 +1,4 @@
+enable_language(CXX)
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/info.cmake" "
+set(CMAKE_CXX_EXTENSIONS_DEFAULT \"${CMAKE_CXX_EXTENSIONS_DEFAULT}\")
+")
diff --git a/Tests/RunCMake/try_compile/RunCMakeTest.cmake b/Tests/RunCMake/try_compile/RunCMakeTest.cmake
index eca7bf485..3cfbfbff7 100644
--- a/Tests/RunCMake/try_compile/RunCMakeTest.cmake
+++ b/Tests/RunCMake/try_compile/RunCMakeTest.cmake
@@ -116,6 +116,24 @@ if(RunCMake_GENERATOR MATCHES "Make|Ninja")
unset(RunCMake_TEST_NO_CLEAN)
endif()
+# Lookup CMAKE_CXX_EXTENSIONS_DEFAULT.
+# FIXME: Someday we could move this to the top of the file and use it in
+# place of some of the values passed by 'Tests/RunCMake/CMakeLists.txt'.
+run_cmake(Inspect)
+include("${RunCMake_BINARY_DIR}/Inspect-build/info.cmake")
+
+# FIXME: Support more compilers and default standard levels.
+if (DEFINED CMAKE_CXX_STANDARD_DEFAULT AND
+ DEFINED CMAKE_CXX_EXTENSIONS_DEFAULT AND (
+ (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 4.7) OR
+ (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
+ ))
+ run_cmake(CMP0128-WARN)
+ if(NOT CMAKE_CXX_STANDARD_DEFAULT EQUAL 11)
+ run_cmake(CMP0128-NEW)
+ endif()
+endif()
+
if(UNIX)
run_cmake(CleanupNoFollowSymlink)
endif()
diff --git a/Utilities/std/cm/filesystem b/Utilities/std/cm/filesystem
index ce52fbf3b..b1cb3668f 100644
--- a/Utilities/std/cm/filesystem
+++ b/Utilities/std/cm/filesystem
@@ -809,13 +809,11 @@ public:
path& remove_filename()
{
-# if defined(__CYGWIN__)
- // FIXME: Avoid crash due to CYGWIN/MSYS bug(?). See CMake Issue 22090.
- static_cast<void>(this->path_.data());
-# endif
auto fname = this->get_filename();
if (!fname.empty()) {
- this->path_.erase(fname.data() - this->path_.data());
+ this->path_.erase(fname.data() -
+ // Avoid C++17 non-const .data() that may reallocate.
+ static_cast<path_type const&>(this->path_).data());
}
return *this;
}
@@ -829,13 +827,11 @@ public:
path& replace_extension(const path& replacement = path())
{
-# if defined(__CYGWIN__)
- // FIXME: Avoid crash due to CYGWIN/MSYS bug(?). See CMake Issue 22090.
- static_cast<void>(this->path_.data());
-# endif
auto ext = this->get_filename_fragment(filename_fragment::extension);
if (!ext.empty()) {
- this->path_.erase(ext.data() - this->path_.data());
+ this->path_.erase(ext.data() -
+ // Avoid C++17 non-const .data() that may reallocate.
+ static_cast<path_type const&>(this->path_).data());
}
if (!replacement.path_.empty()) {
if (replacement.path_[0] != '.') {