Browse Source

project: Always set COMPAT_VERSION variables

Modify the project command to always set COMPAT_VERSION variables, not
just if experimental CPS export support is enabled. This ensures that
these values are (at least as of the call to the project command) empty
and cannot be "preset" e.g. by command line arguments in the case that
experimental support is enabled after the project command is called.
Matthew Woehlke 6 months ago
parent
commit
6171e2da90
1 changed files with 1 additions and 4 deletions
  1. 1 4
      Source/cmProjectCommand.cxx

+ 1 - 4
Source/cmProjectCommand.cxx

@@ -262,13 +262,10 @@ bool cmProjectCommand(std::vector<std::string> const& args,
   createVariables("VERSION_MINOR"_s, version_components[1]);
   createVariables("VERSION_PATCH"_s, version_components[2]);
   createVariables("VERSION_TWEAK"_s, version_components[3]);
+  createVariables("COMPAT_VERSION"_s, prArgs.CompatVersion.value_or(""));
   createVariables("DESCRIPTION"_s, prArgs.Description.value_or(""));
   createVariables("HOMEPAGE_URL"_s, prArgs.HomepageURL.value_or(""));
 
-  if (enableCompatVersion) {
-    createVariables("COMPAT_VERSION"_s, prArgs.CompatVersion.value_or(""));
-  }
-
   if (unparsedArgs.empty() && !prArgs.Languages) {
     // if no language is specified do c and c++
     mf.EnableLanguage({ "C", "CXX" }, false);