summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2021-10-08 09:20:52 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2021-10-08 09:20:52 +0900
commita53f5e14296e61603e2bca1a125d51e7390deca3 (patch)
tree5153c17da7ad52b14dbcdead3f384ccfe56158a7
parentc3f4700e938ebc2440ea36c1b9bb69cd4dfe4062 (diff)
downloadcmake-a53f5e14296e61603e2bca1a125d51e7390deca3.tar.gz
cmake-a53f5e14296e61603e2bca1a125d51e7390deca3.tar.bz2
cmake-a53f5e14296e61603e2bca1a125d51e7390deca3.zip
Imported Upstream version 3.20.4upstream/3.20.4
-rw-r--r--Help/command/cmake_path.rst7
-rw-r--r--Modules/Compiler/Clang.cmake15
-rw-r--r--Modules/Compiler/MSVC-CXX.cmake9
-rw-r--r--Modules/FindBoost.cmake1
-rw-r--r--Modules/InstallRequiredSystemLibraries.cmake4
-rw-r--r--Source/CMakeVersion.cmake4
-rw-r--r--Source/cmCMakePresetsFile.cxx17
-rw-r--r--Source/cmFileAPICodemodel.cxx9
-rw-r--r--Source/cmGlobalVisualStudioVersionedGenerator.cxx3
-rw-r--r--Source/cmMakefileTargetGenerator.cxx7
-rw-r--r--Source/cmake.cxx4
-rw-r--r--Templates/MSBuild/FlagTables/v142_CL.json35
-rw-r--r--Tests/RunCMake/CMakeLists.txt16
-rw-r--r--Tests/RunCMake/CMakePresetsBuild/Good.json.in7
-rw-r--r--Tests/RunCMake/CMakePresetsBuild/RunCMakeTest.cmake10
-rw-r--r--Tests/RunCMake/ExportCompileCommands/CustomCompileRule.cmake3
16 files changed, 121 insertions, 30 deletions
diff --git a/Help/command/cmake_path.rst b/Help/command/cmake_path.rst
index a8999f35b..e7a01ab60 100644
--- a/Help/command/cmake_path.rst
+++ b/Help/command/cmake_path.rst
@@ -459,9 +459,10 @@ are :ref:`normalized <Normalization>` before the check.
.. 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
diff --git a/Modules/Compiler/Clang.cmake b/Modules/Compiler/Clang.cmake
index 9f93d4188..7035d9346 100644
--- a/Modules/Compiler/Clang.cmake
+++ b/Modules/Compiler/Clang.cmake
@@ -194,16 +194,25 @@ macro(__compiler_clang_cxx_standards lang)
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
diff --git a/Modules/Compiler/MSVC-CXX.cmake b/Modules/Compiler/MSVC-CXX.cmake
index 1dfc760f0..f1c7450fa 100644
--- a/Modules/Compiler/MSVC-CXX.cmake
+++ b/Modules/Compiler/MSVC-CXX.cmake
@@ -18,6 +18,7 @@ if ((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.0.24215.1 AND
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)
@@ -27,7 +28,13 @@ if ((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.0.24215.1 AND
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()
diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake
index d31f925cb..df997e1b4 100644
--- a/Modules/FindBoost.cmake
+++ b/Modules/FindBoost.cmake
@@ -1405,6 +1405,7 @@ function(_Boost_COMPONENT_HEADERS component _hdrs)
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")
diff --git a/Modules/InstallRequiredSystemLibraries.cmake b/Modules/InstallRequiredSystemLibraries.cmake
index 2d08e0845..fa7b125f9 100644
--- a/Modules/InstallRequiredSystemLibraries.cmake
+++ b/Modules/InstallRequiredSystemLibraries.cmake
@@ -80,7 +80,9 @@ foreach(LANG IN ITEMS C CXX Fortran)
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)
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 4e537759d..89579dd9a 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 20)
-set(CMake_VERSION_PATCH 3)
+set(CMake_VERSION_PATCH 4)
#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 [==[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]* "
diff --git a/Source/cmCMakePresetsFile.cxx b/Source/cmCMakePresetsFile.cxx
index dda366146..16c2ed3d5 100644
--- a/Source/cmCMakePresetsFile.cxx
+++ b/Source/cmCMakePresetsFile.cxx
@@ -184,8 +184,8 @@ auto const PresetVectorStringHelper =
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) {
@@ -312,8 +312,8 @@ auto const ConfigurePresetHelper =
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)
@@ -340,7 +340,8 @@ auto const BuildPresetHelper =
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)
@@ -356,7 +357,8 @@ auto const BuildPresetHelper =
&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,
@@ -657,7 +659,8 @@ auto const TestPresetHelper =
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)
diff --git a/Source/cmFileAPICodemodel.cxx b/Source/cmFileAPICodemodel.cxx
index 90611092b..c96eecda1 100644
--- a/Source/cmFileAPICodemodel.cxx
+++ b/Source/cmFileAPICodemodel.cxx
@@ -27,7 +27,7 @@
#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"
@@ -1444,9 +1444,10 @@ Json::Value Target::DumpLinkCommandFragments()
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);
diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.cxx b/Source/cmGlobalVisualStudioVersionedGenerator.cxx
index 9a9a4658f..c11ab1bf8 100644
--- a/Source/cmGlobalVisualStudioVersionedGenerator.cxx
+++ b/Source/cmGlobalVisualStudioVersionedGenerator.cxx
@@ -504,6 +504,9 @@ cmGlobalVisualStudioVersionedGenerator::FindAuxToolset(
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.
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 4918bf676..5f7f3dc5b 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -926,8 +926,11 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
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) {
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 4d0382116..db8600fc7 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -3164,7 +3164,9 @@ int cmake::Build(int jobs, std::string dir, std::vector<std::string> targets,
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;
}
diff --git a/Templates/MSBuild/FlagTables/v142_CL.json b/Templates/MSBuild/FlagTables/v142_CL.json
index 7c2d291f9..3305e5643 100644
--- a/Templates/MSBuild/FlagTables/v142_CL.json
+++ b/Templates/MSBuild/FlagTables/v142_CL.json
@@ -533,6 +533,41 @@
"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",
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 78e0b6aee..c81796cfa 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -809,9 +809,19 @@ add_RunCMake_test(PrecompileHeaders -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID}
-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)
diff --git a/Tests/RunCMake/CMakePresetsBuild/Good.json.in b/Tests/RunCMake/CMakePresetsBuild/Good.json.in
index fd43c4e60..c7f318ced 100644
--- a/Tests/RunCMake/CMakePresetsBuild/Good.json.in
+++ b/Tests/RunCMake/CMakePresetsBuild/Good.json.in
@@ -30,7 +30,7 @@
"description": "",
"inheritConfigureEnvironment": true,
"environment": {},
- "jobs": 0,
+ @Good_json_jobs@
"targets": [],
"configuration": "",
"verbose": true,
@@ -73,6 +73,11 @@
"vendor": {
"example.com": "value"
}
+ },
+ {
+ "name": "singleTarget",
+ "inherits": "build-default",
+ "targets": "good"
}
]
}
diff --git a/Tests/RunCMake/CMakePresetsBuild/RunCMakeTest.cmake b/Tests/RunCMake/CMakePresetsBuild/RunCMakeTest.cmake
index 2559b12a7..a05ad9ffd 100644
--- a/Tests/RunCMake/CMakePresetsBuild/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CMakePresetsBuild/RunCMakeTest.cmake
@@ -62,7 +62,15 @@ endfunction()
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)
diff --git a/Tests/RunCMake/ExportCompileCommands/CustomCompileRule.cmake b/Tests/RunCMake/ExportCompileCommands/CustomCompileRule.cmake
index 12368a29b..b1b120f76 100644
--- a/Tests/RunCMake/ExportCompileCommands/CustomCompileRule.cmake
+++ b/Tests/RunCMake/ExportCompileCommands/CustomCompileRule.cmake
@@ -1,5 +1,6 @@
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}")