Skip to content

Commit

Permalink
test: put the libraries together with the binary on Windows
Browse files Browse the repository at this point in the history
... to make the test target file work.
  • Loading branch information
WhiredPlanck committed Oct 29, 2023
1 parent 8ee1a59 commit a4a1807
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,21 @@ if(BUILD_SHARED_LIBS)
target_compile_definitions(rime_test PRIVATE RIME_IMPORTS)
endif(BUILD_SHARED_LIBS)

# On Windows, usually we need to put the libraries together with the binary,
# so binary can work well.
if(WINDOWS)
if(EXISTS "${CMAKE_BINARY_DIR}/lib/$<CONFIGURATION>")
add_custom_command(TARGET rime_test POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
"${CMAKE_BINARY_DIR}/lib/$<CONFIGURATION>"
$<TARGET_FILE_DIR:rime_test>)
else()
add_custom_command(TARGET rime_test POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
"${CMAKE_BINARY_DIR}/lib"
$<TARGET_FILE_DIR:rime_test>)
endif()
endif()

add_test(NAME rime_test COMMAND rime_test
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}/data/test")

0 comments on commit a4a1807

Please sign in to comment.