diff options
author | Brad King <brad.king@kitware.com> | 2024-01-19 21:57:46 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2024-01-19 22:12:36 (GMT) |
commit | c6efbd78d86798573654d1a791f76de0e71bd93f (patch) | |
tree | f1d1c78098a40e4f619e49cd8da0b465fdec4bd8 /Tests/RunCMake | |
parent | 62ca95518e37e9bc9fd4ae4b898f78c4d4c4893b (diff) | |
download | CMake-c6efbd78d86798573654d1a791f76de0e71bd93f.zip CMake-c6efbd78d86798573654d1a791f76de0e71bd93f.tar.gz CMake-c6efbd78d86798573654d1a791f76de0e71bd93f.tar.bz2 |
MSVC: Teach find_library to consider the 'libfoo.a' naming convention
When targeting the GNU ABI, we consider `.a` libraries first but also
accept `.lib`. For symmetry, when targeting the MSVC ABI, we now
consider `.lib` first but also accept `.a`.
This adds support for meson-generated static libraries, which are named
with the pattern `lib${foo}.a`:
* https://mesonbuild.com/FAQ.html#why-does-building-my-project-with-msvc-output-static-libraries-called-libfooa
Note that this was previously attempted by
* commit be848a71b0 (MSVC: Teach find_library to consider the 'libfoo.a'
naming convention, 2022-09-19, v3.25.0-rc1~111^2)
but was reverted by
* commit 955d6245c1 (MSVC: Revert "Teach find_library to consider the
'libfoo.a' naming convention", 2022-11-28, v3.25.1~6^2)
due to problems finding GNU ABI libraries in PATH-derived prefixes.
Since then,
* commit 0a81110b84 (find_(library|file|path): Drop PATH-derived search
prefixes, 2023-09-14, v3.28.0-rc1~91^2)
removed the problematic search paths, so we can restore this change.
Fixes: #23975
Diffstat (limited to 'Tests/RunCMake')
-rw-r--r-- | Tests/RunCMake/find_library/Windows-MSVC-stdout.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/find_library/Windows-MSVC.cmake | 3 | ||||
-rw-r--r-- | Tests/RunCMake/find_library/Windows-MSVC/libmeson_static.a | 0 |
3 files changed, 4 insertions, 0 deletions
diff --git a/Tests/RunCMake/find_library/Windows-MSVC-stdout.txt b/Tests/RunCMake/find_library/Windows-MSVC-stdout.txt index 598ede5..ef865a0 100644 --- a/Tests/RunCMake/find_library/Windows-MSVC-stdout.txt +++ b/Tests/RunCMake/find_library/Windows-MSVC-stdout.txt @@ -1,2 +1,3 @@ -- STATIC_LIBRARY='[^']*/Tests/RunCMake/find_library/Windows-MSVC/static.lib' +-- MESON_STATIC_LIBRARY='[^']*/Tests/RunCMake/find_library/Windows-MSVC/libmeson_static.a' -- RUSTC_IMPORT_LIBRARY='[^']*/Tests/RunCMake/find_library/Windows-MSVC/rustc_import.dll.lib' diff --git a/Tests/RunCMake/find_library/Windows-MSVC.cmake b/Tests/RunCMake/find_library/Windows-MSVC.cmake index 485952d..c25fd99 100644 --- a/Tests/RunCMake/find_library/Windows-MSVC.cmake +++ b/Tests/RunCMake/find_library/Windows-MSVC.cmake @@ -3,5 +3,8 @@ enable_language(C) find_library(STATIC_LIBRARY NAMES static NO_DEFAULT_PATH PATHS ${CMAKE_CURRENT_SOURCE_DIR}/Windows-MSVC) message(STATUS "STATIC_LIBRARY='${STATIC_LIBRARY}'") +find_library(MESON_STATIC_LIBRARY NAMES meson_static NO_DEFAULT_PATH PATHS ${CMAKE_CURRENT_SOURCE_DIR}/Windows-MSVC) +message(STATUS "MESON_STATIC_LIBRARY='${MESON_STATIC_LIBRARY}'") + find_library(RUSTC_IMPORT_LIBRARY NAMES rustc_import NO_DEFAULT_PATH PATHS ${CMAKE_CURRENT_SOURCE_DIR}/Windows-MSVC) message(STATUS "RUSTC_IMPORT_LIBRARY='${RUSTC_IMPORT_LIBRARY}'") diff --git a/Tests/RunCMake/find_library/Windows-MSVC/libmeson_static.a b/Tests/RunCMake/find_library/Windows-MSVC/libmeson_static.a new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/find_library/Windows-MSVC/libmeson_static.a |