From 5b35fe944eb985d248b55404b3fafd001d845396 Mon Sep 17 00:00:00 2001 From: Kan-Ru Chen Date: Tue, 2 Jan 2024 01:09:57 +0900 Subject: [PATCH] build: workaround linking issue on msvc --- test/CMakeLists.txt | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 4cebc07de..8ba2722b1 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -53,7 +53,12 @@ endif() foreach(target ${ALL_TESTS}) add_executable(${target} ${TEST_SRC_DIR}/${target}.c) target_link_libraries(${target} testhelper) - target_link_libraries(${target} libchewing) + # XXX workaround MSVC issue + if(MSVC AND WITH_RUST) + target_link_libraries(${target} chewing) + else() + target_link_libraries(${target} libchewing) + endif() target_compile_definitions(${target} PRIVATE CHEWING_DATA_PREFIX=\"${DATA_BIN_DIR}\" TEST_HASH_DIR=\"${TEST_BIN_DIR}\" @@ -68,9 +73,6 @@ add_library(testhelper STATIC ${TEST_SRC_DIR}/testhelper.c $ ) -# if (NOT WITH_RUST) -# target_link_libraries(testhelper userphrase) -# endif() target_compile_definitions(testhelper PRIVATE CHEWING_DATA_PREFIX=\"${DATA_BIN_DIR}\" TEST_HASH_DIR=\"${TEST_BIN_DIR}\" @@ -96,4 +98,4 @@ foreach(target ${ALL_STATIC_TEST}) COMMAND ${CMAKE_COMMAND} -E copy_if_different ${TEST_SRC_DIR}/${target} ${TEST_BIN_DIR}/${target} ) add_dependencies(check ${target}) -endforeach() \ No newline at end of file +endforeach()