diff options
author | Brad King <brad.king@kitware.com> | 2020-05-12 15:27:11 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2020-05-12 16:44:32 (GMT) |
commit | 6c5d4522bcc242361895e72c3fcbd91710abb64c (patch) | |
tree | 7d4b9023b8e6196be4835611dcea9a137468caa2 /Tests/ConfigSources/main.cpp | |
parent | 8daa140c6a293b14e6f28a8fc84122c2c24296fe (diff) | |
download | CMake-6c5d4522bcc242361895e72c3fcbd91710abb64c.zip CMake-6c5d4522bcc242361895e72c3fcbd91710abb64c.tar.gz CMake-6c5d4522bcc242361895e72c3fcbd91710abb64c.tar.bz2 |
INTERFACE_SOURCES: Fix per-config link libs on multi-config generators
In multi-config generators we memoize the computed set of source files
for a target to avoid repeating the computation when the set does not
depend on the configuration. We already track whether generator
expressions in `SOURCES` or `INTERFACE_SOURCES` reference the
configuration (`$<CONFIG:...>`). However, we previously forgot to track
whether the set of libraries whose `INTERFACE_SOURCES` are considered
depends on the configuration. This caused multi-config generators to
use the first configuration's set of sources for all configurations
in cases such as
target_link_libraries(tgt PRIVATE $<$<CONFIG:Debug>:iface_debug>)
where the `iface_debug` target has `INTERFACE_SOURCES`.
Fix this by also tracking config-dependence of the list of libraries for
evaluation of the list of source files.
Fixes: #20683
Diffstat (limited to 'Tests/ConfigSources/main.cpp')
-rw-r--r-- | Tests/ConfigSources/main.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Tests/ConfigSources/main.cpp b/Tests/ConfigSources/main.cpp new file mode 100644 index 0000000..c1cd3b2 --- /dev/null +++ b/Tests/ConfigSources/main.cpp @@ -0,0 +1,9 @@ +#if !defined(CFG_DEBUG) && !defined(CFG_OTHER) +# error "Neither CFG_DEBUG or CFG_OTHER is defined." +#endif +#ifdef CFG_DEBUG +# include "main_debug.cpp" +#endif +#ifdef CFG_OTHER +# include "main_other.cpp" +#endif |