summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-12-09 13:11:48 (GMT)
committerKitware Robot <kwrobot@kitware.com>2023-12-09 13:11:56 (GMT)
commit143f5abb3b0904383c448fd3b290752809b67d6f (patch)
tree599d5f8bf0b5a0b4984967584aa72515ca34e82a /Tests
parentd30bc859a61af3a1429069c66f3671e85fea8fec (diff)
parentf20c5c6f20aa7eab9e43919fffbf5b00281d1461 (diff)
downloadCMake-143f5abb3b0904383c448fd3b290752809b67d6f.zip
CMake-143f5abb3b0904383c448fd3b290752809b67d6f.tar.gz
CMake-143f5abb3b0904383c448fd3b290752809b67d6f.tar.bz2
Merge topic 'find-rustc-importlibs'
f20c5c6f20 MSVC: Teach find_library to consider Rust's '${name}.dll.lib' convention 7598ea5389 Tests: Add case covering find_library behavior when targeting MSVC ABI Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !9046
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/find_library/RunCMakeTest.cmake4
-rw-r--r--Tests/RunCMake/find_library/Windows-MSVC-stdout.txt2
-rw-r--r--Tests/RunCMake/find_library/Windows-MSVC.cmake7
-rw-r--r--Tests/RunCMake/find_library/Windows-MSVC/rustc_import.dll.lib0
-rw-r--r--Tests/RunCMake/find_library/Windows-MSVC/rustc_import.lib0
-rw-r--r--Tests/RunCMake/find_library/Windows-MSVC/static.lib0
7 files changed, 14 insertions, 1 deletions
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index d33664e..7e1b0e4 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -529,7 +529,7 @@ endforeach()
add_RunCMake_test(file-DOWNLOAD)
add_RunCMake_test(file-RPATH -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME})
add_RunCMake_test(find_file -DMINGW=${MINGW})
-add_RunCMake_test(find_library -DMINGW=${MINGW} -DCYGWIN=${CYGWIN} -DMSYS=${MSYS})
+add_RunCMake_test(find_library -DMINGW=${MINGW} -DCYGWIN=${CYGWIN} -DMSYS=${MSYS} -DMSVC=${MSVC})
add_RunCMake_test(find_package -DMINGW=${MINGW} -DMSYS=${MSYS})
add_RunCMake_test(find_path -DMINGW=${MINGW})
add_RunCMake_test(find_program -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME})
diff --git a/Tests/RunCMake/find_library/RunCMakeTest.cmake b/Tests/RunCMake/find_library/RunCMakeTest.cmake
index 0bed252..f9c8528 100644
--- a/Tests/RunCMake/find_library/RunCMakeTest.cmake
+++ b/Tests/RunCMake/find_library/RunCMakeTest.cmake
@@ -24,6 +24,10 @@ if(CMAKE_HOST_WIN32 AND MINGW)
run_cmake(MSYSTEM_PREFIX)
endif()
+if(CMAKE_HOST_WIN32 AND MSVC)
+ run_cmake(Windows-MSVC)
+endif()
+
run_cmake_script(FromScriptMode "-DTEMP_DIR=${RunCMake_BINARY_DIR}/FromScriptMode-temp")
run_cmake_with_options(FromPATHEnvDebugVar --debug-find-var=CREATED_LIBRARY)
diff --git a/Tests/RunCMake/find_library/Windows-MSVC-stdout.txt b/Tests/RunCMake/find_library/Windows-MSVC-stdout.txt
new file mode 100644
index 0000000..598ede5
--- /dev/null
+++ b/Tests/RunCMake/find_library/Windows-MSVC-stdout.txt
@@ -0,0 +1,2 @@
+-- STATIC_LIBRARY='[^']*/Tests/RunCMake/find_library/Windows-MSVC/static.lib'
+-- 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
new file mode 100644
index 0000000..485952d
--- /dev/null
+++ b/Tests/RunCMake/find_library/Windows-MSVC.cmake
@@ -0,0 +1,7 @@
+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(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/rustc_import.dll.lib b/Tests/RunCMake/find_library/Windows-MSVC/rustc_import.dll.lib
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/find_library/Windows-MSVC/rustc_import.dll.lib
diff --git a/Tests/RunCMake/find_library/Windows-MSVC/rustc_import.lib b/Tests/RunCMake/find_library/Windows-MSVC/rustc_import.lib
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/find_library/Windows-MSVC/rustc_import.lib
diff --git a/Tests/RunCMake/find_library/Windows-MSVC/static.lib b/Tests/RunCMake/find_library/Windows-MSVC/static.lib
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/find_library/Windows-MSVC/static.lib