gd-tools/CMakeLists.txt
2024-02-04 14:24:04 -04:00

75 lines
2.1 KiB
CMake

cmake_minimum_required(VERSION 3.14)
include(cmake/prelude.cmake)
project(
gd-tools
VERSION 1.4
DESCRIPTION "A set of helpful programs to enhance goldendict for immersion learning."
HOMEPAGE_URL "https://github.com/Ajatt-Tools/gd-tools"
LANGUAGES CXX
)
include(cmake/project-is-top-level.cmake)
include(cmake/variables.cmake)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
# ---- Download Dependencies ----
include(FetchContent)
FetchContent_Declare(cpr GIT_REPOSITORY https://github.com/libcpr/cpr.git
GIT_TAG 3b15fa82ea74739b574d705fea44959b58142eb8) # Replace with your desired git commit from: https://github.com/libcpr/cpr/releases
FetchContent_MakeAvailable(cpr)
#FetchContent_Declare(fmt
# GIT_REPOSITORY https://github.com/fmtlib/fmt.git
# GIT_TAG master
#)
#FetchContent_MakeAvailable(fmt)
FetchContent_Declare(json URL https://github.com/nlohmann/json/releases/download/v3.11.3/json.tar.xz)
FetchContent_MakeAvailable(json)
# ---- Find Local Libs
#find_package(marisa REQUIRED)
#find_package(rdricpp REQUIRED)
add_subdirectory(rdricpp)
# ---- Declare executable ----
set(SOURCES src/anki_search.cpp src/echo.cpp src/massif.cpp src/images.cpp src/marisa.cpp src/util.cpp src/kana_conv.cpp)
set(HEADERS src/anki_search.h src/echo.h src/massif.h src/images.h src/marisa.h src/util.h src/kana_conv.h)
add_executable(gd-tools_exe src/main.cpp ${SOURCES} ${HEADERS})
add_executable(gd-tools::exe ALIAS gd-tools_exe)
set_property(TARGET gd-tools_exe PROPERTY OUTPUT_NAME gd-tools)
target_compile_features(gd-tools_exe PRIVATE cxx_std_23)
target_link_libraries(gd-tools_exe PRIVATE -lasan -lubsan cpr::cpr nlohmann_json::nlohmann_json -lmarisa rdricpp)
# ---- Install rules ----
if(NOT CMAKE_SKIP_INSTALL_RULES)
include(cmake/install-rules.cmake)
endif()
# ---- Developer mode ----
if(NOT gd-tools_DEVELOPER_MODE)
return()
elseif(NOT PROJECT_IS_TOP_LEVEL)
message(
AUTHOR_WARNING
"Developer mode is intended for developers of gd-tools"
)
endif()
include(cmake/dev-mode.cmake)