.. code-block:: cmake
- set(path "/a/b/c/d")
- cmake_path(IS_PREFIX path "/a/b" result) # result = true
- cmake_path(IS_PREFIX path "/x/y/z" result) # result = false
+ set(path "/a/b/c")
+ cmake_path(IS_PREFIX path "/a/b/c/d" result) # result = true
+ cmake_path(IS_PREFIX path "/a/b" result) # result = false
+ cmake_path(IS_PREFIX path "/x/y/z" result) # result = false
set(path "/a/b")
cmake_path(IS_PREFIX path "/a/c/../b" NORMALIZE result) # result = true
set(CMAKE_${lang}11_EXTENSION_COMPILE_OPTION "")
set(CMAKE_${lang}14_STANDARD_COMPILE_OPTION "-std:c++14")
set(CMAKE_${lang}14_EXTENSION_COMPILE_OPTION "-std:c++14")
- if (CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL 6.0)
+
+ if(CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL 6.0)
set(CMAKE_${lang}17_STANDARD_COMPILE_OPTION "-std:c++17")
set(CMAKE_${lang}17_EXTENSION_COMPILE_OPTION "-std:c++17")
- set(CMAKE_${lang}20_STANDARD_COMPILE_OPTION "-std:c++latest")
- set(CMAKE_${lang}20_EXTENSION_COMPILE_OPTION "-std:c++latest")
else()
set(CMAKE_${lang}17_STANDARD_COMPILE_OPTION "-std:c++latest")
set(CMAKE_${lang}17_EXTENSION_COMPILE_OPTION "-std:c++latest")
endif()
+ if(CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL 13.0)
+ set(CMAKE_${lang}23_STANDARD_COMPILE_OPTION "-std:c++latest")
+ set(CMAKE_${lang}23_EXTENSION_COMPILE_OPTION "-std:c++latest")
+ set(CMAKE_${lang}20_STANDARD_COMPILE_OPTION "-std:c++20")
+ set(CMAKE_${lang}20_EXTENSION_COMPILE_OPTION "-std:c++20")
+ elseif(CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL 6.0)
+ set(CMAKE_${lang}20_STANDARD_COMPILE_OPTION "-std:c++latest")
+ set(CMAKE_${lang}20_EXTENSION_COMPILE_OPTION "-std:c++latest")
+ endif()
+
__compiler_check_default_language_standard(${lang} 3.9 14)
else()
# This version of clang-cl, or the MSVC version it simulates, does not have
set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "")
set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std:c++14")
set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std:c++14")
+
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.11.25505)
set(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT ON)
set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON)
set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-std:c++latest")
set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std:c++latest")
endif()
- if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.12.25835)
+
+ if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.29.30129)
+ set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "-std:c++20")
+ set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "-std:c++20")
+ set(CMAKE_CXX23_STANDARD_COMPILE_OPTION "-std:c++latest")
+ set(CMAKE_CXX23_EXTENSION_COMPILE_OPTION "-std:c++latest")
+ elseif(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.12.25835)
set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "-std:c++latest")
set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "-std:c++latest")
endif()
set(_Boost_LOCALE_HEADERS "boost/locale.hpp")
set(_Boost_LOG_HEADERS "boost/log/core.hpp")
set(_Boost_LOG_SETUP_HEADERS "boost/log/detail/setup_config.hpp")
+ set(_Boost_JSON_HEADERS "boost/json.hpp")
set(_Boost_MATH_HEADERS "boost/math_fwd.hpp")
set(_Boost_MATH_C99_HEADERS "boost/math/tr1.hpp")
set(_Boost_MATH_C99F_HEADERS "boost/math/tr1.hpp")
set(_Intel_archdir ia32)
endif()
set(_Intel_compiler_ver ${CMAKE_${LANG}_COMPILER_VERSION})
- if(WIN32)
+ if(WIN32 AND EXISTS "${_Intel_basedir}/../redist/${_Intel_archdir}_win/compiler")
+ get_filename_component(_Intel_redistdir "${_Intel_basedir}/../redist/${_Intel_archdir}_win/compiler" ABSOLUTE)
+ elseif(WIN32)
get_filename_component(_Intel_redistdir "${_Intel_basedir}/../../redist/${_Intel_archdir}/compiler" ABSOLUTE)
elseif(APPLE)
get_filename_component(_Intel_redistdir "${_Intel_basedir}/../../compiler/lib" ABSOLUTE)
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 20)
-set(CMake_VERSION_PATCH 3)
+set(CMake_VERSION_PATCH 4)
#set(CMake_VERSION_RC 0)
set(CMake_VERSION_IS_DIRTY 0)
if(NOT CMake_VERSION_NO_GIT)
# If this source was exported by 'git archive', use its commit info.
- set(git_info [==[13d112ea03 CMake 3.20.3]==])
+ set(git_info [==[b61fe6a831 CMake 3.20.4]==])
# 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]* "
ReadFileResult::READ_OK, ReadFileResult::INVALID_PRESET,
PresetStringHelper);
-ReadFileResult PresetInheritsHelper(std::vector<std::string>& out,
- const Json::Value* value)
+ReadFileResult PresetVectorOneOrMoreStringHelper(std::vector<std::string>& out,
+ const Json::Value* value)
{
out.clear();
if (!value) {
cmJSONObjectHelper<ConfigurePreset, ReadFileResult>(
ReadFileResult::READ_OK, ReadFileResult::INVALID_PRESET, false)
.Bind("name"_s, &ConfigurePreset::Name, PresetStringHelper)
- .Bind("inherits"_s, &ConfigurePreset::Inherits, PresetInheritsHelper,
- false)
+ .Bind("inherits"_s, &ConfigurePreset::Inherits,
+ PresetVectorOneOrMoreStringHelper, false)
.Bind("hidden"_s, &ConfigurePreset::Hidden, PresetBoolHelper, false)
.Bind<std::nullptr_t>("vendor"_s, nullptr,
VendorHelper(ReadFileResult::INVALID_PRESET), false)
cmJSONObjectHelper<BuildPreset, ReadFileResult>(
ReadFileResult::READ_OK, ReadFileResult::INVALID_PRESET, false)
.Bind("name"_s, &BuildPreset::Name, PresetStringHelper)
- .Bind("inherits"_s, &BuildPreset::Inherits, PresetInheritsHelper, false)
+ .Bind("inherits"_s, &BuildPreset::Inherits,
+ PresetVectorOneOrMoreStringHelper, false)
.Bind("hidden"_s, &BuildPreset::Hidden, PresetBoolHelper, false)
.Bind<std::nullptr_t>("vendor"_s, nullptr,
VendorHelper(ReadFileResult::INVALID_PRESET), false)
&BuildPreset::InheritConfigureEnvironment, PresetOptionalBoolHelper,
false)
.Bind("jobs"_s, &BuildPreset::Jobs, PresetOptionalIntHelper, false)
- .Bind("targets"_s, &BuildPreset::Targets, PresetVectorStringHelper, false)
+ .Bind("targets"_s, &BuildPreset::Targets,
+ PresetVectorOneOrMoreStringHelper, false)
.Bind("configuration"_s, &BuildPreset::Configuration, PresetStringHelper,
false)
.Bind("cleanFirst"_s, &BuildPreset::CleanFirst, PresetOptionalBoolHelper,
cmJSONObjectHelper<TestPreset, ReadFileResult>(
ReadFileResult::READ_OK, ReadFileResult::INVALID_PRESET, false)
.Bind("name"_s, &TestPreset::Name, PresetStringHelper)
- .Bind("inherits"_s, &TestPreset::Inherits, PresetInheritsHelper, false)
+ .Bind("inherits"_s, &TestPreset::Inherits,
+ PresetVectorOneOrMoreStringHelper, false)
.Bind("hidden"_s, &TestPreset::Hidden, PresetBoolHelper, false)
.Bind<std::nullptr_t>("vendor"_s, nullptr,
VendorHelper(ReadFileResult::INVALID_PRESET), false)
#include "cmInstallGenerator.h"
#include "cmInstallSubdirectoryGenerator.h"
#include "cmInstallTargetGenerator.h"
-#include "cmLinkLineComputer.h"
+#include "cmLinkLineComputer.h" // IWYU pragma: keep
#include "cmListFileCache.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
std::vector<BT<std::string>> linkPath;
std::vector<BT<std::string>> linkLibs;
cmLocalGenerator* lg = this->GT->GetLocalGenerator();
- cmLinkLineComputer linkLineComputer(lg,
- lg->GetStateSnapshot().GetDirectory());
- lg->GetTargetFlags(&linkLineComputer, this->Config, linkLibs,
+ cmGlobalGenerator* gg = this->GT->GetGlobalGenerator();
+ std::unique_ptr<cmLinkLineComputer> linkLineComputer =
+ gg->CreateLinkLineComputer(lg, lg->GetStateSnapshot().GetDirectory());
+ lg->GetTargetFlags(linkLineComputer.get(), this->Config, linkLibs,
linkLanguageFlags, linkFlags, frameworkPath, linkPath,
this->GT);
linkLanguageFlags = cmTrimWhitespace(linkLanguageFlags);
if (version == "14.28.16.9" && vcToolsetVersion == "14.28.29910") {
return AuxToolset::Default;
}
+ if (version == "14.29.16.10" && vcToolsetVersion == "14.29.30037") {
+ return AuxToolset::Default;
+ }
// The first two components of the default toolset version typically
// match the name used by later VS versions for the SxS props files.
compileCommand, vars);
std::string workingDirectory =
this->LocalGenerator->GetCurrentBinaryDirectory();
- compileCommand.replace(compileCommand.find(langFlags), langFlags.size(),
- this->GetFlags(lang, this->GetConfigName()));
+ std::string::size_type lfPos = compileCommand.find(langFlags);
+ if (lfPos != std::string::npos) {
+ compileCommand.replace(lfPos, langFlags.size(),
+ this->GetFlags(lang, this->GetConfigName()));
+ }
std::string langDefines = std::string("$(") + lang + "_DEFINES)";
std::string::size_type ldPos = compileCommand.find(langDefines);
if (ldPos != std::string::npos) {
this->UnprocessedPresetEnvironment = expandedPreset->Environment;
this->ProcessPresetEnvironment();
- if (jobs == cmake::DEFAULT_BUILD_PARALLEL_LEVEL && expandedPreset->Jobs) {
+ if ((jobs == cmake::DEFAULT_BUILD_PARALLEL_LEVEL ||
+ jobs == cmake::NO_BUILD_PARALLEL_LEVEL) &&
+ expandedPreset->Jobs) {
jobs = *expandedPreset->Jobs;
}
"flags": []
},
{
+ "name": "ExternalWarningLevel",
+ "switch": "external:W0",
+ "comment": "Turn Off All Warnings",
+ "value": "TurnOffAllWarnings",
+ "flags": []
+ },
+ {
+ "name": "ExternalWarningLevel",
+ "switch": "external:W1",
+ "comment": "Level1",
+ "value": "Level1",
+ "flags": []
+ },
+ {
+ "name": "ExternalWarningLevel",
+ "switch": "external:W2",
+ "comment": "Level2",
+ "value": "Level2",
+ "flags": []
+ },
+ {
+ "name": "ExternalWarningLevel",
+ "switch": "external:W3",
+ "comment": "Level3",
+ "value": "Level3",
+ "flags": []
+ },
+ {
+ "name": "ExternalWarningLevel",
+ "switch": "external:W4",
+ "comment": "Level4",
+ "value": "Level4",
+ "flags": []
+ },
+ {
"name": "CallingConvention",
"switch": "Gd",
"comment": "__cdecl",
-DCMAKE_C_COMPILER_VERSION=${CMAKE_C_COMPILER_VERSION})
add_RunCMake_test("UnityBuild")
-add_RunCMake_test(CMakePresets -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE} -DCMake_TEST_JSON_SCHEMA=${CMake_TEST_JSON_SCHEMA})
-add_RunCMake_test(CMakePresetsBuild -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE} -DCMake_TEST_JSON_SCHEMA=${CMake_TEST_JSON_SCHEMA})
-add_RunCMake_test(CMakePresetsTest -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE} -DCMake_TEST_JSON_SCHEMA=${CMake_TEST_JSON_SCHEMA})
+add_RunCMake_test(CMakePresets
+ -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}
+ -DCMake_TEST_JSON_SCHEMA=${CMake_TEST_JSON_SCHEMA}
+ )
+add_RunCMake_test(CMakePresetsBuild
+ -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}
+ -DCMake_TEST_JSON_SCHEMA=${CMake_TEST_JSON_SCHEMA}
+ -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}
+ )
+add_RunCMake_test(CMakePresetsTest
+ -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}
+ -DCMake_TEST_JSON_SCHEMA=${CMake_TEST_JSON_SCHEMA}
+ )
if(${CMAKE_GENERATOR} MATCHES "Make|Ninja")
add_RunCMake_test(TransformDepfile)
"description": "",
"inheritConfigureEnvironment": true,
"environment": {},
- "jobs": 0,
+ @Good_json_jobs@
"targets": [],
"configuration": "",
"verbose": true,
"vendor": {
"example.com": "value"
}
+ },
+ {
+ "name": "singleTarget",
+ "inherits": "build-default",
+ "targets": "good"
}
]
}
set(CMakePresets_SCHEMA_EXPECTED_RESULT 0)
-run_cmake_build_presets(Good "default;other" "build-other;withEnvironment;noEnvironment;macros;vendorObject")
+if(RunCMake_GENERATOR MATCHES "NMake|Borland|Watcom")
+ set(Good_json_jobs [[]])
+elseif(RunCMake_GENERATOR MATCHES "Make" AND CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
+ set(Good_json_jobs [["jobs": 1,]])
+else()
+ set(Good_json_jobs [["jobs": 0,]])
+endif()
+
+run_cmake_build_presets(Good "default;other" "build-other;withEnvironment;noEnvironment;macros;vendorObject;singleTarget")
run_cmake_build_presets(InvalidConfigurePreset "default" "badConfigurePreset")
set(CMakePresetsBuild_BUILD_ONLY 1)
enable_language(C)
+set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
add_library(empty STATIC empty.c)
string(REPLACE "<DEFINES>" "" CMAKE_C_COMPILE_OBJECT "${CMAKE_C_COMPILE_OBJECT}")
string(REPLACE "<INCLUDES>" "" CMAKE_C_COMPILE_OBJECT "${CMAKE_C_COMPILE_OBJECT}")
-set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
+string(REPLACE "<FLAGS>" "" CMAKE_C_COMPILE_OBJECT "${CMAKE_C_COMPILE_OBJECT}")