Skip to content

Commit

Permalink
Refactor unit test target name and update compile options
Browse files Browse the repository at this point in the history
  • Loading branch information
GregoryKogan committed Jan 8, 2024
1 parent 682d764 commit c0b74e9
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ add_executable(

file(GLOB_RECURSE TESTS_SOURCES "tests/*.cpp")
add_executable(
tests
unit_tests
${SOURCES}
${TESTS_SOURCES}
)
target_link_libraries(tests GTest::gtest_main)
target_link_libraries(unit_tests GTest::gtest_main)

include(GoogleTest)
gtest_discover_tests(tests)
gtest_discover_tests(unit_tests)


if(CMAKE_BUILD_TYPE STREQUAL "Release")
Expand All @@ -43,11 +43,11 @@ if(CMAKE_BUILD_TYPE STREQUAL "Release")
elseif(CMAKE_BUILD_TYPE STREQUAL "Debug")
if(MSVC)
target_compile_options(cli PRIVATE /W4 /WX)
target_compile_options(tests PRIVATE /W4 /WX)
target_compile_options(unit_tests PRIVATE /W4 /WX)
else()
target_compile_options(cli PRIVATE -Wall -Wextra -pedantic -Werror -g -fsanitize=address -fsanitize=undefined -fsanitize=unsigned-integer-overflow)
target_compile_options(tests PRIVATE -g -fsanitize=address -fsanitize=undefined -fsanitize=unsigned-integer-overflow)
target_compile_options(unit_tests PRIVATE -g -fsanitize=address -fsanitize=undefined -fsanitize=unsigned-integer-overflow)
target_link_options(cli PRIVATE -fsanitize=address -fsanitize=undefined -fsanitize=unsigned-integer-overflow)
target_link_options(tests PRIVATE -fsanitize=address -fsanitize=undefined -fsanitize=unsigned-integer-overflow)
target_link_options(unit_tests PRIVATE -fsanitize=address -fsanitize=undefined -fsanitize=unsigned-integer-overflow)
endif()
endif()

0 comments on commit c0b74e9

Please sign in to comment.