Sfoglia il codice sorgente

Only append build interface include dirs to particular targets.

We shouldn't set the property on all custom targets.
Stephen Kelly 12 anni fa
parent
commit
df74bc34d4
2 ha cambiato i file con 11 aggiunte e 3 eliminazioni
  1. 4 3
      Source/cmDocumentVariables.cxx
  2. 7 0
      Source/cmTarget.cxx

+ 4 - 3
Source/cmDocumentVariables.cxx

@@ -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");

+ 7 - 0
Source/cmTarget.cxx

@@ -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;