Merge topic 'fix-compatibility-mode-LOCATION'

2514e426 CMP0026: Use compatibility codepath until configure is finished (#15748)
b98f7712 cmGlobalGenerator: Add API for the configure step being finished.
b5de2bd9 cmLocalGenerator: Simplify condition.
This commit is contained in:
Brad King 2015-09-21 09:25:29 -04:00 committed by CMake Topic Stage
commit dd8285c688
8 changed files with 34 additions and 9 deletions

View File

@ -2218,7 +2218,7 @@ cmGeneratorTarget::GetIncludeDirectories(const std::string& config,
"INCLUDE_DIRECTORIES") "INCLUDE_DIRECTORIES")
!= debugProperties.end(); != debugProperties.end();
if (this->Makefile->IsConfigured()) if (this->GlobalGenerator->GetConfigureDoneCMP0026())
{ {
this->DebugIncludesDone = true; this->DebugIncludesDone = true;
} }
@ -2365,7 +2365,7 @@ void cmGeneratorTarget::GetCompileOptions(std::vector<std::string> &result,
"COMPILE_OPTIONS") "COMPILE_OPTIONS")
!= debugProperties.end(); != debugProperties.end();
if (this->Makefile->IsConfigured()) if (this->GlobalGenerator->GetConfigureDoneCMP0026())
{ {
this->DebugCompileOptionsDone = true; this->DebugCompileOptionsDone = true;
} }
@ -2435,7 +2435,7 @@ void cmGeneratorTarget::GetCompileFeatures(std::vector<std::string> &result,
"COMPILE_FEATURES") "COMPILE_FEATURES")
!= debugProperties.end(); != debugProperties.end();
if (this->Makefile->IsConfigured()) if (this->GlobalGenerator->GetConfigureDoneCMP0026())
{ {
this->DebugCompileFeaturesDone = true; this->DebugCompileFeaturesDone = true;
} }
@ -2503,7 +2503,7 @@ void cmGeneratorTarget::GetCompileDefinitions(std::vector<std::string> &list,
"COMPILE_DEFINITIONS") "COMPILE_DEFINITIONS")
!= debugProperties.end(); != debugProperties.end();
if (this->Makefile->IsConfigured()) if (this->GlobalGenerator->GetConfigureDoneCMP0026())
{ {
this->DebugCompileDefinitionsDone = true; this->DebugCompileDefinitionsDone = true;
} }
@ -3937,7 +3937,7 @@ cmGeneratorTarget::ReportPropertyOrigin(const std::string &p,
p) p)
!= debugProperties.end(); != debugProperties.end();
if (this->Target->GetMakefile()->IsConfigured()) if (this->GlobalGenerator->GetConfigureDoneCMP0026())
{ {
this->DebugCompatiblePropertiesDone[p] = true; this->DebugCompatiblePropertiesDone[p] = true;
} }
@ -4504,7 +4504,7 @@ void cmGeneratorTarget::GetLanguages(std::set<std::string>& languages,
std::vector<cmGeneratorTarget*> objectLibraries; std::vector<cmGeneratorTarget*> objectLibraries;
std::vector<cmSourceFile const*> externalObjects; std::vector<cmSourceFile const*> externalObjects;
if (!this->Makefile->IsConfigured()) if (!this->GlobalGenerator->GetConfigureDoneCMP0026())
{ {
std::vector<cmTarget*> objectTargets; std::vector<cmTarget*> objectTargets;
this->Target->GetObjectLibrariesCMP0026(objectTargets); this->Target->GetObjectLibrariesCMP0026(objectTargets);

View File

@ -72,6 +72,8 @@ cmGlobalGenerator::cmGlobalGenerator(cmake* cm)
this->ExtraGenerator = 0; this->ExtraGenerator = 0;
this->CurrentMakefile = 0; this->CurrentMakefile = 0;
this->TryCompileOuterMakefile = 0; this->TryCompileOuterMakefile = 0;
this->ConfigureDoneCMP0026 = false;
} }
cmGlobalGenerator::~cmGlobalGenerator() cmGlobalGenerator::~cmGlobalGenerator()
@ -1110,9 +1112,12 @@ void cmGlobalGenerator::Configure()
this->CMakeInstance->GetHomeOutputDirectory()); this->CMakeInstance->GetHomeOutputDirectory());
// now do it // now do it
this->ConfigureDoneCMP0026 = false;
dirMf->Configure(); dirMf->Configure();
dirMf->EnforceDirectoryLevelRules(); dirMf->EnforceDirectoryLevelRules();
this->ConfigureDoneCMP0026 = true;
// Put a copy of each global target in every directory. // Put a copy of each global target in every directory.
cmTargets globalTargets; cmTargets globalTargets;
this->CreateDefaultGlobalTargets(&globalTargets); this->CreateDefaultGlobalTargets(&globalTargets);

View File

@ -363,6 +363,8 @@ public:
cmFileLockPool& GetFileLockPool() { return FileLockPool; } cmFileLockPool& GetFileLockPool() { return FileLockPool; }
#endif #endif
bool GetConfigureDoneCMP0026() const { return this->ConfigureDoneCMP0026; }
std::string MakeSilentFlag; std::string MakeSilentFlag;
protected: protected:
typedef std::vector<cmLocalGenerator*> GeneratorVector; typedef std::vector<cmLocalGenerator*> GeneratorVector;
@ -520,6 +522,7 @@ protected:
bool ForceUnixPaths; bool ForceUnixPaths;
bool ToolSupportsColor; bool ToolSupportsColor;
bool InstallTargetEnabled; bool InstallTargetEnabled;
bool ConfigureDoneCMP0026;
}; };
#endif #endif

View File

@ -2850,7 +2850,7 @@ cmIML_INT_uint64_t cmLocalGenerator::GetBackwardsCompatibility()
} }
} }
this->BackwardsCompatibility = CMake_VERSION_ENCODE(major, minor, patch); this->BackwardsCompatibility = CMake_VERSION_ENCODE(major, minor, patch);
this->BackwardsCompatibilityFinal = this->Makefile->IsConfigured(); this->BackwardsCompatibilityFinal = true;
} }
return this->BackwardsCompatibility; return this->BackwardsCompatibility;

View File

@ -636,7 +636,7 @@ void cmTarget::GetSourceFiles(std::vector<std::string> &files,
{ {
assert(this->GetType() != INTERFACE_LIBRARY); assert(this->GetType() != INTERFACE_LIBRARY);
if (!this->Makefile->IsConfigured()) if (!this->GetMakefile()->GetGlobalGenerator()->GetConfigureDoneCMP0026())
{ {
// At configure-time, this method can be called as part of getting the // At configure-time, this method can be called as part of getting the
// LOCATION property or to export() a file to be include()d. However // LOCATION property or to export() a file to be include()d. However
@ -682,7 +682,7 @@ void cmTarget::GetSourceFiles(std::vector<std::string> &files,
"SOURCES") "SOURCES")
!= debugProperties.end(); != debugProperties.end();
if (this->Makefile->IsConfigured()) if (this->GetMakefile()->GetGlobalGenerator()->GetConfigureDoneCMP0026())
{ {
this->DebugSourcesDone = true; this->DebugSourcesDone = true;
} }

View File

@ -11,3 +11,4 @@ run_cmake(CMP0026-LOCATION-CONFIG-OLD)
run_cmake(CMP0026-LOCATION-CONFIG-WARN) run_cmake(CMP0026-LOCATION-CONFIG-WARN)
run_cmake(ObjlibNotDefined) run_cmake(ObjlibNotDefined)
run_cmake(LOCATION-and-TARGET_OBJECTS) run_cmake(LOCATION-and-TARGET_OBJECTS)
run_cmake(clear-cached-information)

View File

@ -0,0 +1,2 @@
add_executable(Hello ${CMAKE_CURRENT_BINARY_DIR}/main.c)

View File

@ -0,0 +1,14 @@
enable_language(C)
cmake_policy(SET CMP0026 OLD)
add_subdirectory(clear-cached-information-dir)
# Critical: this needs to happen in root CMakeLists.txt and not inside
# the subdir.
get_target_property(mypath Hello LOCATION)
# Now we create the file later, so you can see, ultimately no error should
# happen e.g. during generate phase:
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/clear-cached-information-dir/main.c)
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/clear-cached-information-dir/main.c PROPERTIES GENERATED TRUE)