cmake_minimum_required(VERSION 3.16)
project(mountain_generation LANGUAGES CXX)

add_executable(generate
    main.cpp
    types/random.cpp
    types/flat.cpp
    types/line.cpp
    types/monotone.cpp
    types/distinct_neighbors.cpp
    types/plateaus.cpp
    types/snake.cpp
    types/plateau_reset.cpp
    types/plateau_endpoint.cpp
    types/plateau_bridge.cpp
    types/adversarial.cpp
)
target_compile_features(generate PRIVATE cxx_std_17)
add_executable(reference reference.cpp)
add_executable(verify verify.cpp)
foreach(tool reference verify)
    target_compile_features(${tool} PRIVATE cxx_std_17)
    if(MINGW)
        target_link_options(${tool} PRIVATE -static)
    endif()
    if(MSVC)
        target_compile_options(${tool} PRIVATE /W4)
    else()
        target_compile_options(${tool} PRIVATE -Wall -Wextra -Wpedantic)
    endif()
endforeach()
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9)
    message(FATAL_ERROR "Building the driver requires GCC 9 or newer (complete C++17 filesystem support).")
endif()
if(MINGW)
    target_link_options(generate PRIVATE -static)
endif()
if(MSVC)
    target_compile_options(generate PRIVATE /W4)
else()
    target_compile_options(generate PRIVATE -Wall -Wextra -Wpedantic)
endif()
