From feb1a146c930f0e5137c5a061ab84cadfcfa51ad Mon Sep 17 00:00:00 2001 From: Lukas Thomann Date: Sun, 4 Oct 2026 23:59:25 +0200 Subject: [PATCH] build: link stdc++exp through a generator expression The if() was evaluated when building the package, so a package built with gcc made every consumer link stdc++exp, msvc included. The generator expression is exported and evaluated by the consumer. --- cth/CMakeLists.txt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/cth/CMakeLists.txt b/cth/CMakeLists.txt index fc35edf..cfa0e43 100644 --- a/cth/CMakeLists.txt +++ b/cth/CMakeLists.txt @@ -11,9 +11,7 @@ cth_pkg_target_include_directories( target_compile_options(cth INTERFACE $<$:/Zc:preprocessor>) -if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang" AND NOT CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC") - target_link_libraries(cth INTERFACE stdc++exp) -endif() +target_link_libraries(cth INTERFACE $<$,$>>:stdc++exp>) # tests if(CTH_ENABLE_TESTS)