Skip to content

Commit

Permalink
fixup cmake unit-test build
Browse files Browse the repository at this point in the history
  • Loading branch information
phillipwood committed Oct 19, 2023
1 parent f06f8c8 commit 93780b8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions contrib/buildsystems/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -970,15 +970,15 @@ add_library(unit-test-lib OBJECT ${CMAKE_SOURCE_DIR}/t/unit-tests/test-lib.c)

parse_makefile_for_scripts(unit_test_PROGRAMS "UNIT_TEST_PROGRAMS" "")
foreach(unit_test ${unit_test_PROGRAMS})
add_executable("${unit_test}" "${CMAKE_SOURCE_DIR}/t/unit-tests/${unit_test}.c")
add_executable("${unit_test}" "${CMAKE_SOURCE_DIR}/t/unit-tests/bin/${unit_test}.c")
target_link_libraries("${unit_test}" unit-test-lib common-main)
set_target_properties("${unit_test}"
PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/t/unit-tests)
PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/t/unit-tests/bin)
if(MSVC)
set_target_properties("${unit_test}"
PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/t/unit-tests)
PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/t/unit-tests/bin)
set_target_properties("${unit_test}"
PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/t/unit-tests)
PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/t/unit-tests/bin)
endif()
list(APPEND PROGRAMS_BUILT "${unit_test}")

Expand All @@ -990,7 +990,7 @@ foreach(unit_test ${unit_test_PROGRAMS})
if(NOT ${unit_test} STREQUAL "t-basic")
add_test(NAME "t.unit-tests.${unit_test}"
COMMAND "./${unit_test}"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/t/unit-tests)
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/t/unit-tests/bin)
endif()
endforeach()

Expand Down

0 comments on commit 93780b8

Please sign in to comment.