mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-28 01:49:23 -05:00
Merge topic 'project-vars-policy'
e5a9ccbcc8 project: Always set <PROJECT-NAME>_* as normal variables
Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !9879
This commit is contained in:
+4
-1
@@ -549,7 +549,10 @@ class cmMakefile;
|
||||
SELECT(POLICY, CMP0179, \
|
||||
"De-duplication of static libraries on link lines keeps first " \
|
||||
"occurrence.", \
|
||||
3, 31, 0, cmPolicies::WARN)
|
||||
3, 31, 0, cmPolicies::WARN) \
|
||||
SELECT(POLICY, CMP0180, \
|
||||
"project() always sets <PROJECT-NAME>_* as normal variables.", 3, \
|
||||
31, 0, cmPolicies::WARN)
|
||||
|
||||
#define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1)
|
||||
#define CM_FOR_EACH_POLICY_ID(POLICY) \
|
||||
|
||||
@@ -58,11 +58,13 @@ bool cmProjectCommand(std::vector<std::string> const& args,
|
||||
|
||||
mf.SetProjectName(projectName);
|
||||
|
||||
cmPolicies::PolicyStatus cmp0180 = mf.GetPolicyStatus(cmPolicies::CMP0180);
|
||||
|
||||
std::string varName = cmStrCat(projectName, "_BINARY_DIR"_s);
|
||||
bool nonCacheVarAlreadySet = mf.IsNormalDefinitionSet(varName);
|
||||
mf.AddCacheDefinition(varName, mf.GetCurrentBinaryDirectory(),
|
||||
"Value Computed by CMake", cmStateEnums::STATIC);
|
||||
if (nonCacheVarAlreadySet) {
|
||||
if (cmp0180 == cmPolicies::NEW || nonCacheVarAlreadySet) {
|
||||
mf.AddDefinition(varName, mf.GetCurrentBinaryDirectory());
|
||||
}
|
||||
|
||||
@@ -70,7 +72,7 @@ bool cmProjectCommand(std::vector<std::string> const& args,
|
||||
nonCacheVarAlreadySet = mf.IsNormalDefinitionSet(varName);
|
||||
mf.AddCacheDefinition(varName, mf.GetCurrentSourceDirectory(),
|
||||
"Value Computed by CMake", cmStateEnums::STATIC);
|
||||
if (nonCacheVarAlreadySet) {
|
||||
if (cmp0180 == cmPolicies::NEW || nonCacheVarAlreadySet) {
|
||||
mf.AddDefinition(varName, mf.GetCurrentSourceDirectory());
|
||||
}
|
||||
|
||||
@@ -85,7 +87,7 @@ bool cmProjectCommand(std::vector<std::string> const& args,
|
||||
nonCacheVarAlreadySet = mf.IsNormalDefinitionSet(varName);
|
||||
mf.AddCacheDefinition(varName, mf.IsRootMakefile() ? "ON" : "OFF",
|
||||
"Value Computed by CMake", cmStateEnums::STATIC);
|
||||
if (nonCacheVarAlreadySet) {
|
||||
if (cmp0180 == cmPolicies::NEW || nonCacheVarAlreadySet) {
|
||||
mf.AddDefinition(varName, mf.IsRootMakefile() ? "ON" : "OFF");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user