Commit f87e724e authored by Brad King's avatar Brad King

Fix EXCLUDE_FROM_ALL on directory with an interface library

Since commit dc688857 (Pass EXCLUDE_FROM_ALL from directory to
targets, 2019-01-15, v3.14.0-rc1~83^2) we automatically forward the
`EXCLUDE_FROM_ALL` to targets as they are created.  This regressed
support for interface libraries on which the property is not allowed.

Skip forwarding the `EXCLUDE_FROM_ALL` property for interface libraries.
It is not needed on them because they do not participate in the
generated build system anyway.

Fixes: #18896
parent 6f23321d
......@@ -1985,7 +1985,9 @@ cmTarget* cmMakefile::AddLibrary(const std::string& lname,
// over changes in CMakeLists.txt, making the information stale and
// hence useless.
if (excludeFromAll || this->GetPropertyAsBool("EXCLUDE_FROM_ALL")) {
if (excludeFromAll ||
(type != cmStateEnums::INTERFACE_LIBRARY &&
this->GetPropertyAsBool("EXCLUDE_FROM_ALL"))) {
target->SetProperty("EXCLUDE_FROM_ALL", "TRUE");
......@@ -47,6 +47,7 @@ target_link_libraries(InterfaceLibrary
add_dependencies(InterfaceLibrary item_fake_tgt)
add_subdirectory(excluded EXCLUDE_FROM_ALL)
add_executable(sharedlibtestexe sharedlibtestexe.cpp)
target_link_libraries(sharedlibtestexe shared_iface imported::iface)
add_library(excluded_iface INTERFACE)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment