CMakeLists.txt 975 Bytes
Newer Older
aggsol's avatar
aggsol committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
cmake_minimum_required(VERSION 3.8)

project("gamebook-checker" VERSION 0.1.0 LANGUAGES CXX)

# Create compile_commands.json for cppcheck
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

set( CMAKE_CXX_STANDARD 14 )
set( CMAKE_CXX_STANDARD_REQUIRED ON )

# Default build type: Debug
# Set it on the command line: -DCMAKE_BUILD_TYPE=Release)
if(NOT CMAKE_BUILD_TYPE)
  set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build (Debug or Release)" FORCE)
endif()

IF(CMAKE_BUILD_TYPE MATCHES Debug)
    message(STATUS "Debug build.")
    add_definitions(-DDEBUG)
    add_compile_options(-O3 -g)
ELSEIF(CMAKE_BUILD_TYPE MATCHES Release)
    message(STATUS "Release build.")
    add_definitions(-DNDEBUG)
    add_compile_options(-O2 -s)
ELSE()
    message(WARNING "Unknown build type.")
ENDIF()

# Copy binaries to root build dir
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")

message(STATUS "Version = ${PROJECT_VERSION}")

aggsol's avatar
aggsol committed
34 35
add_subdirectory(src)
add_subdirectory(test)