New upstream version 3.24.3

ci/unstable
Timo Röhling 2 years ago
parent 0fcbd26aaf
commit 65bb68f1e7

@ -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``

@ -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.

@ -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.

@ -439,6 +439,7 @@ set(_CPACK_IFW_PREFIXES
"QtIFW-")
set(_CPACK_IFW_VERSIONS
"4.4"
"4.3"
"4.2"
"4.1"

@ -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")

@ -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()

@ -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()

@ -1,3 +1,5 @@
set(CMAKE_Fortran_VERBOSE_FLAG "-v")
set(CMAKE_Fortran_SUBMODULE_SEP "-")
set(CMAKE_Fortran_SUBMODULE_EXT ".mod")

@ -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()

@ -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)

@ -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.

@ -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")

@ -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:

@ -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)

@ -0,0 +1,3 @@
include(Platform/Windows-GNU)
__windows_compiler_gnu(Fortran)
# TODO: MSVC ABI Support

@ -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]* "

@ -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) },

@ -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;

@ -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()

@ -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;
}

@ -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));
}

@ -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;

@ -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

@ -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 };

@ -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"

@ -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;

@ -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))

@ -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));
}
}
}

@ -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)
{

@ -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);

@ -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

@ -226,6 +226,41 @@ int testStringAlgorithms(int /*unused*/, char* /*unused*/ [])
"cmStrToULong rejects trailing content.");
}
// ----------------------------------------------------------------------
// 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
{

@ -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

@ -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()

@ -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()

@ -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})

@ -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()

@ -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}")

@ -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)

@ -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'

@ -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

@ -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

@ -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)

@ -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

@ -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)

@ -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

@ -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*] ""
)

@ -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@

@ -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()

@ -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()

@ -0,0 +1 @@
#error "This should not be compiled"

@ -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)

@ -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)

@ -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()

@ -0,0 +1,4 @@
enable_language(CXX)
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/info.cmake" "
set(CMAKE_CXX_EXTENSIONS_DEFAULT \"${CMAKE_CXX_EXTENSIONS_DEFAULT}\")
")

@ -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()

@ -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] != '.') {

Loading…
Cancel
Save