nutri/CMakeLists.txt

65 lines
1.3 KiB
CMake

cmake_minimum_required(VERSION 3.30)
project(nutri)
set(CMAKE_CXX_STANDARD 26)
set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
add_compile_options(-fdiagnostics-color=always)
find_program(MOLD_LINKER mold)
if (MOLD_LINKER)
add_link_options(-fuse-ld=mold)
endif()
if(CMAKE_BUILD_TYPE STREQUAL "Release")
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
add_compile_options(-O3 -march=native)
add_link_options(-s)
endif()
include(FetchContent)
find_package(ctre QUIET)
if (NOT ctre_FOUND)
FetchContent_Declare(
ctre
GIT_REPOSITORY https://github.com/hanickadot/compile-time-regular-expressions.git
GIT_TAG v3.9.0
GIT_SHALLOW TRUE
)
FetchContent_MakeAvailable(ctre)
endif()
find_package(cpr QUIET)
if (NOT cpr_FOUND)
FetchContent_Declare(
cpr
GIT_REPOSITORY https://github.com/libcpr/cpr.git
GIT_TAG 1.11.0
GIT_SHALLOW TRUE
)
FetchContent_MakeAvailable(cpr)
endif()
find_package(glaze QUIET)
if (NOT glaze_FOUND)
FetchContent_Declare(
glaze
GIT_REPOSITORY https://github.com/stephenberry/glaze.git
GIT_TAG main
GIT_SHALLOW TRUE
)
FetchContent_MakeAvailable(glaze)
endif()
add_executable(
nutri
src/main.cpp
src/ArgParser.hpp
src/Helpers/Utility.cpp
src/Helpers/Utility.hpp
src/Helpers/WolframAlpha.hpp
)
target_link_libraries(nutri PRIVATE cpr::cpr ctre::ctre glaze::glaze)