51 lines
980 B
CMake
51 lines
980 B
CMake
|
|
find_package(SDL2 REQUIRED)
|
|
|
|
include(FetchContent)
|
|
FetchContent_Declare(
|
|
googletest
|
|
URL https://github.com/google/googletest/archive/refs/tags/v1.15.2.zip
|
|
)
|
|
FetchContent_MakeAvailable(googletest)
|
|
|
|
enable_testing()
|
|
|
|
file(GLOB_RECURSE cpp_sources
|
|
CONFIGURE_DEPENDS
|
|
"../src/*.cpp")
|
|
|
|
list(REMOVE_ITEM cpp_sources
|
|
"../src/pc_app/main.cpp")
|
|
|
|
file(GLOB_RECURSE test_sources
|
|
CONFIGURE_DEPENDS
|
|
"*.cc")
|
|
|
|
file(GLOB_RECURSE c_sources
|
|
CONFIGURE_DEPENDS
|
|
"../src/*.c")
|
|
|
|
file (GLOB_RECURSE headers CONFIGURE_DEPENDS "../src/*.h")
|
|
set (include_dirs "")
|
|
foreach (_headerFile ${headers})
|
|
get_filename_component(_dir ${_headerFile} PATH)
|
|
list (APPEND include_dirs ${_dir})
|
|
endforeach()
|
|
|
|
add_executable(
|
|
hello_test
|
|
# ${cpp_sources}
|
|
${test_sources}
|
|
${c_sources}
|
|
)
|
|
target_include_directories(hello_test PRIVATE ${include_dirs})
|
|
target_link_libraries(
|
|
hello_test
|
|
GTest::gtest_main
|
|
SDL2::SDL2
|
|
)
|
|
|
|
include(GoogleTest)
|
|
gtest_discover_tests(hello_test)
|
|
|