Only append build interface include dirs to particular targets.

We shouldn't set the property on all custom targets.
This commit is contained in:
Stephen Kelly 2013-02-07 19:31:23 +01:00
parent d4e5c6787c
commit df74bc34d4
2 changed files with 11 additions and 3 deletions

View File

@ -1150,9 +1150,10 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
("CMAKE_BUILD_INTERFACE_INCLUDES", cmProperty::VARIABLE,
"Automatically add the current source- and build directories "
"to the INTERFACE_INCLUDE_DIRECTORIES.",
"If this variable is enabled, CMake automatically adds for each "
"target ${CMAKE_CURRENT_SOURCE_DIR} and ${CMAKE_CURRENT_BINARY_DIR} "
"to the INTERFACE_INCLUDE_DIRECTORIES."
"If this variable is enabled, CMake automatically adds for each shared "
"library target, static library target, module target and executable "
"target, ${CMAKE_CURRENT_SOURCE_DIR} and ${CMAKE_CURRENT_BINARY_DIR} to "
"the INTERFACE_INCLUDE_DIRECTORIES."
"By default CMAKE_BUILD_INTERFACE_INCLUDES is OFF.",
false,
"Variables that Control the Build");

View File

@ -2714,6 +2714,13 @@ void cmTarget::AppendProperty(const char* prop, const char* value,
//----------------------------------------------------------------------------
void cmTarget::AppendBuildInterfaceIncludes()
{
if(this->GetType() != cmTarget::SHARED_LIBRARY &&
this->GetType() != cmTarget::STATIC_LIBRARY &&
this->GetType() != cmTarget::MODULE_LIBRARY &&
!this->IsExecutableWithExports())
{
return;
}
if (this->BuildInterfaceIncludesAppended)
{
return;