nutri/CMakeLists.txt

62 lines
1.3 KiB
CMake
Raw Permalink Normal View History

2024-10-15 17:48:16 +00:00
cmake_minimum_required(VERSION 3.30)
2024-10-15 17:48:16 +00:00
project(nutri)
set(CMAKE_CXX_STANDARD 26)
2024-10-16 12:02:16 +00:00
set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
set(CMAKE_COLOR_DIAGNOSTICS 1)
2024-11-10 20:39:27 +00:00
2024-11-10 20:58:51 +00:00
find_program(MOLD_LINKER mold)
if(MOLD_LINKER)
2024-11-10 20:58:51 +00:00
add_link_options(-fuse-ld=mold)
endif()
2024-11-10 20:39:27 +00:00
if(CMAKE_BUILD_TYPE STREQUAL "Release")
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
add_compile_options(-O3 -march=native)
2024-11-10 20:58:51 +00:00
add_link_options(-s)
2024-11-10 20:39:27 +00:00
endif()
2024-10-15 17:48:16 +00:00
2024-10-16 12:02:16 +00:00
include(FetchContent)
2024-11-10 17:26:07 +00:00
find_package(ctre QUIET)
if(NOT ctre_FOUND)
2024-11-10 17:26:07 +00:00
FetchContent_Declare(
ctre
GIT_REPOSITORY https://github.com/hanickadot/compile-time-regular-expressions.git
2024-11-10 17:26:07 +00:00
GIT_TAG v3.9.0
GIT_SHALLOW TRUE
)
FetchContent_MakeAvailable(ctre)
endif()
2024-10-16 12:02:16 +00:00
2024-11-10 17:26:07 +00:00
find_package(cpr QUIET)
if(NOT cpr_FOUND)
2024-11-10 17:26:07 +00:00
FetchContent_Declare(
cpr
GIT_REPOSITORY https://github.com/libcpr/cpr.git
2024-11-10 17:26:07 +00:00
GIT_TAG 1.11.0
GIT_SHALLOW TRUE
)
FetchContent_MakeAvailable(cpr)
endif()
find_package(glaze QUIET)
if(NOT glaze_FOUND)
2024-11-10 17:26:07 +00:00
FetchContent_Declare(
glaze
GIT_REPOSITORY https://github.com/stephenberry/glaze.git
GIT_TAG v4.0.1
2024-11-10 17:26:07 +00:00
GIT_SHALLOW TRUE
)
FetchContent_MakeAvailable(glaze)
endif()
2024-10-15 17:48:16 +00:00
file(GLOB_RECURSE SOURCES
${CMAKE_SOURCE_DIR}/src/*.cpp
${CMAKE_SOURCE_DIR}/src/*.hpp
2024-11-10 17:26:07 +00:00
)
add_executable(nutri ${SOURCES})
2024-11-10 17:26:07 +00:00
target_link_libraries(nutri PRIVATE cpr::cpr ctre::ctre glaze::glaze)