Browse Source

Merge branch 'fix-exclude-dir-with-iface' into release-3.14

Merge-request: !2937
Brad King 6 years ago
parent
commit
3b58b647ae

+ 3 - 1
Source/cmMakefile.cxx

@@ -1985,7 +1985,9 @@ cmTarget* cmMakefile::AddLibrary(const std::string& lname,
   // over changes in CMakeLists.txt, making the information stale and
   // hence useless.
   target->ClearDependencyInformation(*this);
-  if (excludeFromAll || this->GetPropertyAsBool("EXCLUDE_FROM_ALL")) {
+  if (excludeFromAll ||
+      (type != cmStateEnums::INTERFACE_LIBRARY &&
+       this->GetPropertyAsBool("EXCLUDE_FROM_ALL"))) {
     target->SetProperty("EXCLUDE_FROM_ALL", "TRUE");
   }
   target->AddSources(srcs);

+ 1 - 0
Tests/InterfaceLibrary/CMakeLists.txt

@@ -47,6 +47,7 @@ target_link_libraries(InterfaceLibrary
 add_dependencies(InterfaceLibrary item_fake_tgt)
 
 add_subdirectory(libsdir)
+add_subdirectory(excluded EXCLUDE_FROM_ALL)
 
 add_executable(sharedlibtestexe sharedlibtestexe.cpp)
 target_link_libraries(sharedlibtestexe shared_iface imported::iface)

+ 1 - 0
Tests/InterfaceLibrary/excluded/CMakeLists.txt

@@ -0,0 +1 @@
+add_library(excluded_iface INTERFACE)