mirror of
https://github.com/Sani7/remote-ui.git
synced 2026-10-27 06:01:14 +01:00
cmake tests
Add status message if GTest is found or not
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
# Third Party
|
# Third Party
|
||||||
find_package(GTest)
|
find_package(GTest QUIET)
|
||||||
find_package(Qt6 REQUIRED COMPONENTS Core)
|
find_package(Qt6 REQUIRED COMPONENTS Core)
|
||||||
set(CMAKE_AUTOUIC ON)
|
set(CMAKE_AUTOUIC ON)
|
||||||
set(CMAKE_AUTOMOC ON)
|
set(CMAKE_AUTOMOC ON)
|
||||||
@@ -9,6 +9,7 @@ set(CMAKE_AUTORCC ON)
|
|||||||
file(GLOB_RECURSE TEST_SOURCES "*.[hc]pp")
|
file(GLOB_RECURSE TEST_SOURCES "*.[hc]pp")
|
||||||
file(GLOB_RECURSE CAN "../server/CAN/to_id.cpp")
|
file(GLOB_RECURSE CAN "../server/CAN/to_id.cpp")
|
||||||
if (GTest_FOUND)
|
if (GTest_FOUND)
|
||||||
|
message(STATUS "GTest found - building target tests")
|
||||||
add_executable(tests ${TEST_SOURCES} ${CAN})
|
add_executable(tests ${TEST_SOURCES} ${CAN})
|
||||||
|
|
||||||
target_compile_options(tests PRIVATE $<$<CONFIG:Debug>:
|
target_compile_options(tests PRIVATE $<$<CONFIG:Debug>:
|
||||||
@@ -19,18 +20,20 @@ target_link_libraries(tests
|
|||||||
PRIVATE
|
PRIVATE
|
||||||
UI
|
UI
|
||||||
gtest
|
gtest
|
||||||
|
magic_enum::magic_enum
|
||||||
GTest::gtest_main
|
GTest::gtest_main
|
||||||
Qt::Core
|
Qt::Core
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(tests
|
target_include_directories(tests
|
||||||
PUBLIC
|
PUBLIC
|
||||||
${CMAKE_MAIN_SOURCE_DIR}/external/**
|
${CMAKE_SOURCE_DIR}/external/cpp-templates
|
||||||
${CMAKE_CURRENT_LIST_DIR}
|
${CMAKE_CURRENT_LIST_DIR}
|
||||||
${CMAKE_MAIN_SOURCE_DIR}/src/**
|
|
||||||
${PROJECT_BINARY_DIR}
|
${PROJECT_BINARY_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
include(GoogleTest)
|
include(GoogleTest)
|
||||||
gtest_discover_tests(tests)
|
gtest_discover_tests(tests)
|
||||||
|
else()
|
||||||
|
message(STATUS "GTest not found - not building target tests")
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
Reference in New Issue
Block a user