mirror of
https://github.com/reactos/CMake.git
synced 2024-11-24 12:09:48 +00:00
PCH: add PRECOMPILE_HEADERS to special properties
This commit is contained in:
parent
89479bde94
commit
0467a2f91b
@ -91,6 +91,9 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os)
|
||||
this->PopulateInterfaceProperty("INTERFACE_COMPILE_OPTIONS", gte,
|
||||
cmGeneratorExpression::BuildInterface,
|
||||
properties, missingTargets);
|
||||
this->PopulateInterfaceProperty("INTERFACE_PRECOMPILE_HEADERS", gte,
|
||||
cmGeneratorExpression::BuildInterface,
|
||||
properties, missingTargets);
|
||||
this->PopulateInterfaceProperty("INTERFACE_AUTOUIC_OPTIONS", gte,
|
||||
cmGeneratorExpression::BuildInterface,
|
||||
properties, missingTargets);
|
||||
|
@ -29,7 +29,8 @@ class cmGeneratorTarget;
|
||||
SELECT(F, EvaluatingCompileFeatures, COMPILE_FEATURES) \
|
||||
SELECT(F, EvaluatingLinkOptions, LINK_OPTIONS) \
|
||||
SELECT(F, EvaluatingLinkDirectories, LINK_DIRECTORIES) \
|
||||
SELECT(F, EvaluatingLinkDepends, LINK_DEPENDS)
|
||||
SELECT(F, EvaluatingLinkDepends, LINK_DEPENDS) \
|
||||
SELECT(F, EvaluatingPrecompileHeaders, PRECOMPILE_HEADERS)
|
||||
|
||||
#define CM_FOR_EACH_TRANSITIVE_PROPERTY(F) \
|
||||
CM_FOR_EACH_TRANSITIVE_PROPERTY_IMPL(F, CM_SELECT_BOTH)
|
||||
|
@ -278,6 +278,7 @@ cmGeneratorTarget::cmGeneratorTarget(cmTarget* t, cmLocalGenerator* lg)
|
||||
, DebugCompileDefinitionsDone(false)
|
||||
, DebugLinkOptionsDone(false)
|
||||
, DebugLinkDirectoriesDone(false)
|
||||
, DebugPrecompileHeadersDone(false)
|
||||
, DebugSourcesDone(false)
|
||||
, LinkImplementationLanguageIsContextDependent(true)
|
||||
, UtilityItemsDone(false)
|
||||
@ -312,6 +313,10 @@ cmGeneratorTarget::cmGeneratorTarget(cmTarget* t, cmLocalGenerator* lg)
|
||||
t->GetLinkDirectoriesBacktraces(),
|
||||
this->LinkDirectoriesEntries);
|
||||
|
||||
CreatePropertyGeneratorExpressions(t->GetPrecompileHeadersEntries(),
|
||||
t->GetPrecompileHeadersBacktraces(),
|
||||
this->PrecompileHeadersEntries);
|
||||
|
||||
CreatePropertyGeneratorExpressions(t->GetSourceEntries(),
|
||||
t->GetSourceBacktraces(),
|
||||
this->SourceEntries, true);
|
||||
@ -327,6 +332,7 @@ cmGeneratorTarget::~cmGeneratorTarget()
|
||||
cmDeleteAll(this->CompileDefinitionsEntries);
|
||||
cmDeleteAll(this->LinkOptionsEntries);
|
||||
cmDeleteAll(this->LinkDirectoriesEntries);
|
||||
cmDeleteAll(this->PrecompileHeadersEntries);
|
||||
cmDeleteAll(this->SourceEntries);
|
||||
cmDeleteAll(this->LinkInformation);
|
||||
}
|
||||
@ -3312,6 +3318,43 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetCompileDefinitions(
|
||||
return list;
|
||||
}
|
||||
|
||||
std::vector<BT<std::string>> cmGeneratorTarget::GetPrecompileHeaders(
|
||||
const std::string& config, const std::string& language) const
|
||||
{
|
||||
std::unordered_set<std::string> uniqueOptions;
|
||||
|
||||
cmGeneratorExpressionDAGChecker dagChecker(this, "PRECOMPILE_HEADERS",
|
||||
nullptr, nullptr);
|
||||
|
||||
std::vector<std::string> debugProperties;
|
||||
const char* debugProp =
|
||||
this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES");
|
||||
if (debugProp) {
|
||||
cmExpandList(debugProp, debugProperties);
|
||||
}
|
||||
|
||||
bool debugDefines = !this->DebugPrecompileHeadersDone &&
|
||||
std::find(debugProperties.begin(), debugProperties.end(),
|
||||
"PRECOMPILE_HEADERS") != debugProperties.end();
|
||||
|
||||
if (this->GlobalGenerator->GetConfigureDoneCMP0026()) {
|
||||
this->DebugPrecompileHeadersDone = true;
|
||||
}
|
||||
|
||||
std::vector<EvaluatedTargetPropertyEntry> entries =
|
||||
EvaluateTargetPropertyEntries(this, config, language, &dagChecker,
|
||||
this->PrecompileHeadersEntries);
|
||||
|
||||
AddInterfaceEntries(this, config, "INTERFACE_PRECOMPILE_HEADERS", language,
|
||||
&dagChecker, entries);
|
||||
|
||||
std::vector<BT<std::string>> list;
|
||||
processOptions(this, entries, list, uniqueOptions, debugDefines,
|
||||
"precompile headers", OptionsParse::None);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
void cmGeneratorTarget::GetLinkOptions(std::vector<std::string>& result,
|
||||
const std::string& config,
|
||||
const std::string& language) const
|
||||
|
@ -455,6 +455,9 @@ public:
|
||||
std::vector<BT<std::string>> GetLinkDepends(
|
||||
std::string const& config, std::string const& language) const;
|
||||
|
||||
std::vector<BT<std::string>> GetPrecompileHeaders(
|
||||
const std::string& config, const std::string& language) const;
|
||||
|
||||
bool IsSystemIncludeDirectory(const std::string& dir,
|
||||
const std::string& config,
|
||||
const std::string& language) const;
|
||||
@ -867,8 +870,11 @@ private:
|
||||
std::vector<TargetPropertyEntry*> CompileDefinitionsEntries;
|
||||
std::vector<TargetPropertyEntry*> LinkOptionsEntries;
|
||||
std::vector<TargetPropertyEntry*> LinkDirectoriesEntries;
|
||||
std::vector<TargetPropertyEntry*> PrecompileHeadersEntries;
|
||||
std::vector<TargetPropertyEntry*> SourceEntries;
|
||||
mutable std::set<std::string> LinkImplicitNullProperties;
|
||||
mutable std::map<std::string, std::string> PchHeaders;
|
||||
mutable std::map<std::string, std::string> PchSources;
|
||||
|
||||
void ExpandLinkItems(std::string const& prop, std::string const& value,
|
||||
std::string const& config,
|
||||
@ -922,6 +928,7 @@ private:
|
||||
mutable bool DebugCompileDefinitionsDone;
|
||||
mutable bool DebugLinkOptionsDone;
|
||||
mutable bool DebugLinkDirectoriesDone;
|
||||
mutable bool DebugPrecompileHeadersDone;
|
||||
mutable bool DebugSourcesDone;
|
||||
mutable bool LinkImplementationLanguageIsContextDependent;
|
||||
mutable bool UtilityItemsDone;
|
||||
|
@ -190,6 +190,8 @@ public:
|
||||
std::vector<cmListFileBacktrace> CompileFeaturesBacktraces;
|
||||
std::vector<std::string> CompileDefinitionsEntries;
|
||||
std::vector<cmListFileBacktrace> CompileDefinitionsBacktraces;
|
||||
std::vector<std::string> PrecompileHeadersEntries;
|
||||
std::vector<cmListFileBacktrace> PrecompileHeadersBacktraces;
|
||||
std::vector<std::string> SourceEntries;
|
||||
std::vector<cmListFileBacktrace> SourceBacktraces;
|
||||
std::vector<std::string> LinkOptionsEntries;
|
||||
@ -348,6 +350,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
|
||||
initProp("FOLDER");
|
||||
initProp("Swift_MODULE_DIRECTORY");
|
||||
initProp("VS_JUST_MY_CODE_DEBUGGING");
|
||||
initProp("DISABLE_PRECOMPILE_HEADERS");
|
||||
#ifdef __APPLE__
|
||||
if (this->GetGlobalGenerator()->IsXcode()) {
|
||||
initProp("XCODE_GENERATE_SCHEME");
|
||||
@ -1017,6 +1020,16 @@ cmBacktraceRange cmTarget::GetCompileDefinitionsBacktraces() const
|
||||
return cmMakeRange(impl->CompileDefinitionsBacktraces);
|
||||
}
|
||||
|
||||
cmStringRange cmTarget::GetPrecompileHeadersEntries() const
|
||||
{
|
||||
return cmMakeRange(impl->PrecompileHeadersEntries);
|
||||
}
|
||||
|
||||
cmBacktraceRange cmTarget::GetPrecompileHeadersBacktraces() const
|
||||
{
|
||||
return cmMakeRange(impl->PrecompileHeadersBacktraces);
|
||||
}
|
||||
|
||||
cmStringRange cmTarget::GetSourceEntries() const
|
||||
{
|
||||
return cmMakeRange(impl->SourceEntries);
|
||||
@ -1068,6 +1081,7 @@ void cmTarget::SetProperty(const std::string& prop, const char* value)
|
||||
MAKE_STATIC_PROP(COMPILE_DEFINITIONS);
|
||||
MAKE_STATIC_PROP(COMPILE_FEATURES);
|
||||
MAKE_STATIC_PROP(COMPILE_OPTIONS);
|
||||
MAKE_STATIC_PROP(PRECOMPILE_HEADERS);
|
||||
MAKE_STATIC_PROP(CUDA_PTX_COMPILATION);
|
||||
MAKE_STATIC_PROP(EXPORT_NAME);
|
||||
MAKE_STATIC_PROP(IMPORTED_GLOBAL);
|
||||
@ -1166,6 +1180,14 @@ void cmTarget::SetProperty(const std::string& prop, const char* value)
|
||||
cmListFileBacktrace lfbt = impl->Makefile->GetBacktrace();
|
||||
impl->LinkDirectoriesBacktraces.push_back(lfbt);
|
||||
}
|
||||
} else if (prop == propPRECOMPILE_HEADERS) {
|
||||
impl->PrecompileHeadersEntries.clear();
|
||||
impl->PrecompileHeadersBacktraces.clear();
|
||||
if (value) {
|
||||
impl->PrecompileHeadersEntries.emplace_back(value);
|
||||
cmListFileBacktrace lfbt = impl->Makefile->GetBacktrace();
|
||||
impl->PrecompileHeadersBacktraces.push_back(lfbt);
|
||||
}
|
||||
} else if (prop == propLINK_LIBRARIES) {
|
||||
impl->LinkImplementationPropertyEntries.clear();
|
||||
impl->LinkImplementationPropertyBacktraces.clear();
|
||||
@ -1282,6 +1304,12 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value,
|
||||
cmListFileBacktrace lfbt = impl->Makefile->GetBacktrace();
|
||||
impl->LinkDirectoriesBacktraces.push_back(lfbt);
|
||||
}
|
||||
} else if (prop == "PRECOMPILE_HEADERS") {
|
||||
if (value && *value) {
|
||||
impl->PrecompileHeadersEntries.emplace_back(value);
|
||||
cmListFileBacktrace lfbt = impl->Makefile->GetBacktrace();
|
||||
impl->PrecompileHeadersBacktraces.push_back(lfbt);
|
||||
}
|
||||
} else if (prop == "LINK_LIBRARIES") {
|
||||
if (value && *value) {
|
||||
cmListFileBacktrace lfbt = impl->Makefile->GetBacktrace();
|
||||
@ -1393,6 +1421,13 @@ void cmTarget::InsertLinkDirectory(std::string const& entry,
|
||||
impl->LinkDirectoriesBacktraces.insert(btPosition, bt);
|
||||
}
|
||||
|
||||
void cmTarget::InsertPrecompileHeader(std::string const& entry,
|
||||
cmListFileBacktrace const& bt)
|
||||
{
|
||||
impl->PrecompileHeadersEntries.push_back(entry);
|
||||
impl->PrecompileHeadersBacktraces.push_back(bt);
|
||||
}
|
||||
|
||||
static void cmTargetCheckLINK_INTERFACE_LIBRARIES(const std::string& prop,
|
||||
const char* value,
|
||||
cmMakefile* context,
|
||||
@ -1513,6 +1548,7 @@ const char* cmTarget::GetProperty(const std::string& prop) const
|
||||
MAKE_STATIC_PROP(COMPILE_DEFINITIONS);
|
||||
MAKE_STATIC_PROP(LINK_OPTIONS);
|
||||
MAKE_STATIC_PROP(LINK_DIRECTORIES);
|
||||
MAKE_STATIC_PROP(PRECOMPILE_HEADERS);
|
||||
MAKE_STATIC_PROP(IMPORTED);
|
||||
MAKE_STATIC_PROP(IMPORTED_GLOBAL);
|
||||
MAKE_STATIC_PROP(MANUALLY_ADDED_DEPENDENCIES);
|
||||
@ -1528,6 +1564,7 @@ const char* cmTarget::GetProperty(const std::string& prop) const
|
||||
propCOMPILE_FEATURES,
|
||||
propCOMPILE_OPTIONS,
|
||||
propCOMPILE_DEFINITIONS,
|
||||
propPRECOMPILE_HEADERS,
|
||||
propLINK_OPTIONS,
|
||||
propLINK_DIRECTORIES,
|
||||
propIMPORTED,
|
||||
@ -1616,6 +1653,15 @@ const char* cmTarget::GetProperty(const std::string& prop) const
|
||||
output = cmJoin(impl->Utilities, ";");
|
||||
return output.c_str();
|
||||
}
|
||||
if (prop == propPRECOMPILE_HEADERS) {
|
||||
if (impl->PrecompileHeadersEntries.empty()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static std::string output;
|
||||
output = cmJoin(impl->PrecompileHeadersEntries, ";");
|
||||
return output.c_str();
|
||||
}
|
||||
if (prop == propIMPORTED) {
|
||||
return this->IsImported() ? "TRUE" : "FALSE";
|
||||
}
|
||||
|
@ -216,6 +216,8 @@ public:
|
||||
cmListFileBacktrace const& bt, bool before = false);
|
||||
void InsertLinkDirectory(std::string const& entry,
|
||||
cmListFileBacktrace const& bt, bool before = false);
|
||||
void InsertPrecompileHeader(std::string const& entry,
|
||||
cmListFileBacktrace const& bt);
|
||||
|
||||
void AppendBuildInterfaceIncludes();
|
||||
|
||||
@ -237,6 +239,9 @@ public:
|
||||
cmStringRange GetCompileDefinitionsEntries() const;
|
||||
cmBacktraceRange GetCompileDefinitionsBacktraces() const;
|
||||
|
||||
cmStringRange GetPrecompileHeadersEntries() const;
|
||||
cmBacktraceRange GetPrecompileHeadersBacktraces() const;
|
||||
|
||||
cmStringRange GetSourceEntries() const;
|
||||
cmBacktraceRange GetSourceBacktraces() const;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user