leetcode/CMakeLists.txt
Sainnhe Park ad85b3cd89
All checks were successful
ci/woodpecker/push/test Pipeline was successful
Use my github mirror
2023-02-10 10:02:55 +08:00

42 lines
812 B
CMake

cmake_minimum_required(VERSION 3.14)
project(leetcode)
# GoogleTest requires at least C++11
set(CMAKE_CXX_STANDARD 11)
# Export compile commands
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
include(FetchContent)
fetchcontent_declare(
googletest
URL https://github.sainnhe.dev/google/googletest/archive/refs/heads/main.zip
)
# For Windows: Prevent overriding the parent project's compiler/linker settings
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
fetchcontent_makeavailable(googletest)
enable_testing()
file(GLOB Sources src/*.cpp)
file(GLOB Tests tests/*.cpp)
add_executable(
leetcode_tests
${Sources}
${Tests}
)
target_link_libraries(
leetcode_tests
gtest_main
)
include(GoogleTest)
gtest_discover_tests(leetcode_tests)
target_include_directories(
leetcode_tests
PRIVATE
include
)