39 lines
724 B
CMake
39 lines
724 B
CMake
|
cmake_minimum_required(VERSION 3.14)
|
||
|
project(leetcode)
|
||
|
|
||
|
# GoogleTest requires at least C++11
|
||
|
set(CMAKE_CXX_STANDARD 11)
|
||
|
|
||
|
include(FetchContent)
|
||
|
FetchContent_Declare(
|
||
|
googletest
|
||
|
URL https://github.com/google/googletest/archive/refs/tags/release-1.11.0.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
|
||
|
${Sources}
|
||
|
${Tests}
|
||
|
)
|
||
|
target_link_libraries(
|
||
|
leetcode
|
||
|
gtest_main
|
||
|
)
|
||
|
|
||
|
include(GoogleTest)
|
||
|
gtest_discover_tests(leetcode)
|
||
|
|
||
|
target_include_directories(leetcode
|
||
|
PRIVATE
|
||
|
include
|
||
|
)
|
||
|
|