1
0
mirror of synced 2024-12-01 02:37:18 +01:00

build: Fixed unit tests on linux. Fuck cmake...

This commit is contained in:
WerWolv 2021-09-11 18:09:15 +02:00
parent f7ee165f43
commit aac6385dc6

View File

@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.16) cmake_minimum_required(VERSION 3.16)
project(tests) project(unit_tests)
# Add new tests here # # Add new tests here #
@ -10,14 +10,16 @@ set(AVAILABLE_TESTS
add_executable(tests source/main.cpp ) add_executable(unit_tests source/main.cpp)
target_include_directories(tests PRIVATE include) target_include_directories(unit_tests PRIVATE include)
target_link_libraries(tests libimhex) target_link_libraries(unit_tests libimhex)
set_target_properties(tests PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
add_custom_command(TARGET tests set_target_properties(unit_tests PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
add_custom_command(TARGET unit_tests
POST_BUILD POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/test_data" ${CMAKE_BINARY_DIR}) COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/test_data" ${CMAKE_BINARY_DIR})
foreach (test IN LISTS AVAILABLE_TESTS) foreach (test IN LISTS AVAILABLE_TESTS)
add_test(NAME "${test}" COMMAND tests "${test}" WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) add_test(NAME "${test}" COMMAND unit_tests "${test}" WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
endforeach () endforeach ()