Skip to content

Commit

Permalink
Merged Pull Request '#28 postindustria-tech:main->main : 'Respect CTe…
Browse files Browse the repository at this point in the history
…st's BUILD_TESTING option -- Fix mac build support (part 1)''

Respect CTest's `BUILD_TESTING` option -- Fix mac build support (part 1)
  • Loading branch information
Automation51D authored Aug 22, 2023
2 parents ebc46c5 + 55efb90 commit 2ed60e8
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -169,21 +169,23 @@ include(GoogleTest)

# Tests

set(COM_TEST ${CMAKE_CURRENT_LIST_DIR}/tests)
FILE(GLOB COM_TEST_SRC ${COM_TEST}/*.cpp)
FILE(GLOB COM_TEST_H ${COM_TEST}/*.hpp)
add_executable(CommonTests ${COM_TEST_SRC} ${COM_TEST_H})
if (MSVC)
target_compile_options(CommonTests PRIVATE "/D_CRT_SECURE_NO_WARNINGS" "/W4" "/WX")
target_link_options(CommonTests PRIVATE "/WX")
else ()
target_compile_options(CommonTests PRIVATE ${COMPILE_OPTION_DEBUG})
endif()
if(BUILD_TESTING)
set(COM_TEST ${CMAKE_CURRENT_LIST_DIR}/tests)
FILE(GLOB COM_TEST_SRC ${COM_TEST}/*.cpp)
FILE(GLOB COM_TEST_H ${COM_TEST}/*.hpp)
add_executable(CommonTests ${COM_TEST_SRC} ${COM_TEST_H})
if (MSVC)
target_compile_options(CommonTests PRIVATE "/D_CRT_SECURE_NO_WARNINGS" "/W4" "/WX")
target_link_options(CommonTests PRIVATE "/WX")
else ()
target_compile_options(CommonTests PRIVATE ${COMPILE_OPTION_DEBUG})
endif()

target_link_libraries(CommonTests fiftyone-common-cxx gtest_main)
gtest_discover_tests(CommonTests PROPERTIES TEST_DISCOVERY_TIMEOUT 600)
set_target_properties(CommonTests PROPERTIES FOLDER "Tests")
target_link_libraries(CommonTests fiftyone-common-cxx gtest_main)
gtest_discover_tests(CommonTests PROPERTIES TEST_DISCOVERY_TIMEOUT 600)
set_target_properties(CommonTests PROPERTIES FOLDER "Tests")

if (CMAKE_COMPILER_IS_GNUCC)
target_compile_options(CommonTests PRIVATE "-Wall" "-Werror" "-Wno-unused-variable" "-Wno-unused-result" "-Wno-unused-but-set-variable")
if (CMAKE_COMPILER_IS_GNUCC)
target_compile_options(CommonTests PRIVATE "-Wall" "-Werror" "-Wno-unused-variable" "-Wno-unused-result" "-Wno-unused-but-set-variable")
endif()
endif()

0 comments on commit 2ed60e8

Please sign in to comment.