Files
cpp-course/CMakeLists.txt
T

40 lines
1019 B
CMake

cmake_minimum_required(VERSION 3.20)
project(
modern_cpp_course
VERSION 1.0.0
DESCRIPTION "Modern C++ course from basics to C++26"
LANGUAGES CXX
)
set(CMAKE_CXX_STANDARD 26)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
option(COURSE_BUILD_TESTS "Build Google Test exercise targets" ON)
option(COURSE_WARNINGS_AS_ERRORS "Treat compiler warnings as errors" OFF)
option(COURSE_ENABLE_CONTRACTS "Enable C++26 contracts on GCC 16+" ON)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
include(CourseOptions)
include(CourseExercise)
add_subdirectory(support)
if(COURSE_BUILD_TESTS)
include(FetchContent)
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG v1.15.2
)
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)
enable_testing()
include(GoogleTest)
endif()
add_subdirectory(modules)