Fix generation of COMPILE_DEFINITIONS in DependInfo.cmake.
As INTERFACE_COMPILE_DEFINITIONS are now possible, we can have situations like this: add_library(foo ...) add_library(bar ...) target_link_libraries(foo bar) target_compile_definitions(bar INTERFACE SOME_DEF) The INTERFACE_COMPILE_DEFINITIONS of bar determine how foo should be compiled, and if they change, foo should be rebuilt. Additionally, as of commit d1446ca7 (Append the COMPILE_DEFINITIONS from the Makefile to all targets., 2012-09-17), we don't need to read definitions from the makefile if we read them from the target, so also de-duplicate the cached info. The DependInfo for INTERFACE_INCLUDE_DIRECTORIES is already handled correctly.
This commit is contained in:
parent
655e98bf71
commit
3a298c0bf4
@ -1961,34 +1961,17 @@ void cmLocalUnixMakefileGenerator3
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Build a list of preprocessor definitions for the target.
|
// Build a list of preprocessor definitions for the target.
|
||||||
std::vector<std::string> defines;
|
std::set<std::string> defines;
|
||||||
{
|
this->AppendDefines(defines, target.GetCompileDefinitions());
|
||||||
std::string defPropName = "COMPILE_DEFINITIONS_";
|
this->AppendDefines(defines, target.GetCompileDefinitions(
|
||||||
defPropName += cmSystemTools::UpperCase(this->ConfigurationName);
|
this->ConfigurationName.c_str()));
|
||||||
if(const char* ddefs = this->Makefile->GetProperty("COMPILE_DEFINITIONS"))
|
|
||||||
{
|
|
||||||
cmSystemTools::ExpandListArgument(ddefs, defines);
|
|
||||||
}
|
|
||||||
if(const char* cdefs = target.GetProperty("COMPILE_DEFINITIONS"))
|
|
||||||
{
|
|
||||||
cmSystemTools::ExpandListArgument(cdefs, defines);
|
|
||||||
}
|
|
||||||
if(const char* dcdefs = this->Makefile->GetProperty(defPropName.c_str()))
|
|
||||||
{
|
|
||||||
cmSystemTools::ExpandListArgument(dcdefs, defines);
|
|
||||||
}
|
|
||||||
if(const char* ccdefs = target.GetProperty(defPropName.c_str()))
|
|
||||||
{
|
|
||||||
cmSystemTools::ExpandListArgument(ccdefs, defines);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(!defines.empty())
|
if(!defines.empty())
|
||||||
{
|
{
|
||||||
cmakefileStream
|
cmakefileStream
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "# Preprocessor definitions for this target.\n"
|
<< "# Preprocessor definitions for this target.\n"
|
||||||
<< "SET(CMAKE_TARGET_DEFINITIONS\n";
|
<< "SET(CMAKE_TARGET_DEFINITIONS\n";
|
||||||
for(std::vector<std::string>::const_iterator di = defines.begin();
|
for(std::set<std::string>::const_iterator di = defines.begin();
|
||||||
di != defines.end(); ++di)
|
di != defines.end(); ++di)
|
||||||
{
|
{
|
||||||
cmakefileStream
|
cmakefileStream
|
||||||
|
Loading…
x
Reference in New Issue
Block a user