build: seperate the cmakelists file #3

Merged
etenie merged 1 commits from refactor/cmake-seperation into master 2025-01-15 12:42:56 +00:00
4 changed files with 38 additions and 32 deletions

View File

@ -6,6 +6,8 @@ set(CMAKE_CXX_STANDARD 26)
set(CMAKE_EXPORT_COMPILE_COMMANDS 1) set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
set(CMAKE_COLOR_DIAGNOSTICS 1) set(CMAKE_COLOR_DIAGNOSTICS 1)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
find_program(MOLD_LINKER mold) find_program(MOLD_LINKER mold)
if(MOLD_LINKER) if(MOLD_LINKER)
add_link_options(-fuse-ld=mold) add_link_options(-fuse-ld=mold)
@ -19,38 +21,9 @@ endif()
include(FetchContent) include(FetchContent)
find_package(ctre QUIET) include(FindCTRE)
if(NOT ctre_FOUND) include(FindCPR)
FetchContent_Declare( include(FindGlaze)
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 v4.0.1
GIT_SHALLOW TRUE
)
FetchContent_MakeAvailable(glaze)
endif()
file(GLOB_RECURSE SOURCES file(GLOB_RECURSE SOURCES
${CMAKE_SOURCE_DIR}/src/*.cpp ${CMAKE_SOURCE_DIR}/src/*.cpp

11
cmake/FindCPR.cmake Normal file
View File

@ -0,0 +1,11 @@
find_package(cpr QUIET)
if(NOT cpr_FOUND)
include(FetchContent)
FetchContent_Declare(
cpr
GIT_REPOSITORY https://github.com/libcpr/cpr.git
GIT_TAG 1.11.0
GIT_SHALLOW TRUE
)
FetchContent_MakeAvailable(cpr)
endif()

11
cmake/FindCTRE.cmake Normal file
View File

@ -0,0 +1,11 @@
find_package(ctre QUIET)
if(NOT ctre_FOUND)
include(FetchContent)
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()

11
cmake/FindGlaze.cmake Normal file
View File

@ -0,0 +1,11 @@
find_package(glaze QUIET)
if(NOT glaze_FOUND)
include(FetchContent)
FetchContent_Declare(
glaze
GIT_REPOSITORY https://github.com/stephenberry/glaze.git
GIT_TAG v4.0.1
GIT_SHALLOW TRUE
)
FetchContent_MakeAvailable(glaze)
endif()