mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-05 21:31:08 -06:00
In commit d7159f9591, (Ninja: Fix LINK_WHAT_YOU_USE link flag placement,
2021-06-24), we fixed usage of -Wl,--no-as-needed to override
-Wl,--as-needed from LDFLAGS. However, that change also passes
-Wl,--no-as-needed to `ar`, which is incorrect flag for `ar`.
Let's check the target type before passing down the flags.
Fixes: #22487
6 lines
147 B
CMake
6 lines
147 B
CMake
enable_language(CXX)
|
|
set(CMAKE_LINK_WHAT_YOU_USE TRUE)
|
|
add_executable(main main.cxx)
|
|
target_link_libraries(main m)
|
|
add_library(foo STATIC foo.cxx)
|