diff options
author | Đoàn Trần Công Danh <congdanhqx@gmail.com> | 2021-07-31 07:17:35 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-08-03 15:21:26 (GMT) |
commit | 93eb4a7bd17f0da02a5ea71426bed5c2056e9ea0 (patch) | |
tree | d3efd0740fa33f0afb68c868df99bea3482601ab /Tests | |
parent | f7cf69e34a1607e8ea2b6d10fef6a6058377c24e (diff) | |
download | CMake-93eb4a7bd17f0da02a5ea71426bed5c2056e9ea0.zip CMake-93eb4a7bd17f0da02a5ea71426bed5c2056e9ea0.tar.gz CMake-93eb4a7bd17f0da02a5ea71426bed5c2056e9ea0.tar.bz2 |
Ninja: Revert accidental LINK_WHAT_YOU_USE impl for static libraries
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
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/RunCMake/LinkWhatYouUse/C.cmake | 1 | ||||
-rw-r--r-- | Tests/RunCMake/LinkWhatYouUse/CXX.cmake | 1 | ||||
-rw-r--r-- | Tests/RunCMake/LinkWhatYouUse/foo.c | 4 | ||||
-rw-r--r-- | Tests/RunCMake/LinkWhatYouUse/foo.cxx | 4 |
4 files changed, 10 insertions, 0 deletions
diff --git a/Tests/RunCMake/LinkWhatYouUse/C.cmake b/Tests/RunCMake/LinkWhatYouUse/C.cmake index 4c3f428..f00db30 100644 --- a/Tests/RunCMake/LinkWhatYouUse/C.cmake +++ b/Tests/RunCMake/LinkWhatYouUse/C.cmake @@ -2,3 +2,4 @@ enable_language(C) set(CMAKE_LINK_WHAT_YOU_USE TRUE) add_executable(main main.c) target_link_libraries(main m) +add_library(foo STATIC foo.c) diff --git a/Tests/RunCMake/LinkWhatYouUse/CXX.cmake b/Tests/RunCMake/LinkWhatYouUse/CXX.cmake index 9555832..5762e94 100644 --- a/Tests/RunCMake/LinkWhatYouUse/CXX.cmake +++ b/Tests/RunCMake/LinkWhatYouUse/CXX.cmake @@ -2,3 +2,4 @@ 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) diff --git a/Tests/RunCMake/LinkWhatYouUse/foo.c b/Tests/RunCMake/LinkWhatYouUse/foo.c new file mode 100644 index 0000000..c83d856 --- /dev/null +++ b/Tests/RunCMake/LinkWhatYouUse/foo.c @@ -0,0 +1,4 @@ +int foo(void) +{ + return 0; +} diff --git a/Tests/RunCMake/LinkWhatYouUse/foo.cxx b/Tests/RunCMake/LinkWhatYouUse/foo.cxx new file mode 100644 index 0000000..e05eb7e --- /dev/null +++ b/Tests/RunCMake/LinkWhatYouUse/foo.cxx @@ -0,0 +1,4 @@ +int foo() +{ + return 0; +} |