43 lines
979 B
CMake
43 lines
979 B
CMake
cmake_minimum_required(VERSION 3.30 FATAL_ERROR)
|
|
cmake_policy(VERSION 3.30)
|
|
|
|
project(boilerplate LANGUAGES C CXX)
|
|
|
|
set(CMAKE_CXX_STANDARD 98)
|
|
set(CMAKE_C_STANDARD 99)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED OFF)
|
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|
|
|
option(BUILD_TESTS "Build tests" OFF)
|
|
option(BUILD_DOCS "Build documentation" OFF)
|
|
option(DISABLE_LOGGING "Disables all logging" OFF)
|
|
|
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
|
|
include(CheckCompileOptions)
|
|
include(FetchPlog)
|
|
include(FetchArgparse)
|
|
include(FetchLibbacktrace)
|
|
|
|
if(BUILD_TESTS)
|
|
enable_testing()
|
|
include(FetchGoogleTest)
|
|
add_subdirectory(tests)
|
|
endif()
|
|
|
|
if(DISABLE_LOGGING)
|
|
message(STATUS "Disabling all logs")
|
|
add_compile_definitions("PLOG_DISABLE_LOGGING=1")
|
|
endif()
|
|
|
|
if(BUILD_DOCS)
|
|
message(STATUS "Building documentation")
|
|
add_subdirectory(docs)
|
|
endif()
|
|
|
|
|
|
add_subdirectory(src)
|
|
|
|
if(CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "MinSizeRel")
|
|
include(StripAll)
|
|
endif()
|