🔧 Make tests read mo-file from subdir

This commit is contained in:
2021-08-25 10:52:38 +02:00
parent 5c00a6ff3e
commit fe422db632
7 changed files with 15 additions and 14 deletions

View File

@ -4,13 +4,12 @@ find_package(Catch2 REQUIRED)
include(CTest)
include(Catch)
add_executable(${PROJECT_NAME} test.cpp link_test.cpp)
add_executable(${PROJECT_NAME} main.cpp test.cpp link_test.cpp)
target_include_directories(moFileReaderTest PRIVATE ${CMAKE_SOURCE_DIR}/include)
target_link_libraries(${PROJECT_NAME} PRIVATE Catch2::Catch2)
catch_discover_tests(${PROJECT_NAME})
add_custom_command(
TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/test.mo $<TARGET_FILE_DIR:moFileReaderTest>/test.mo
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/test.mo ${CMAKE_CURRENT_BINARY_DIR}/test.mo
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/languages/nl.mo $<TARGET_FILE_DIR:moFileReaderTest>/languages/nl.mo
)