48 lines
1.3 KiB
CMake
48 lines
1.3 KiB
CMake
cmake_minimum_required(VERSION 3.28)
|
|
project(EchoionApi VERSION 1.0.0 LANGUAGES CXX)
|
|
|
|
set(CMAKE_CXX_STANDARD 26)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
|
|
|
# Create header-only interface library for API
|
|
add_library(EchoionApi INTERFACE)
|
|
|
|
add_library(Echoion::Api ALIAS EchoionApi)
|
|
|
|
target_include_directories(EchoionApi INTERFACE
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
|
$<INSTALL_INTERFACE:include>
|
|
)
|
|
|
|
# Require glaze for JSON serialization (header-only)
|
|
find_package(glaze CONFIG REQUIRED)
|
|
target_link_libraries(EchoionApi INTERFACE glaze::glaze)
|
|
|
|
find_package(Threads REQUIRED)
|
|
target_link_libraries(EchoionApi INTERFACE Threads::Threads)
|
|
|
|
# Compiler-specific options (interface library, so use INTERFACE)
|
|
if(MSVC)
|
|
target_compile_options(EchoionApi INTERFACE /W4 /WX-)
|
|
else()
|
|
target_compile_options(EchoionApi INTERFACE -Wall -Wextra -Wpedantic)
|
|
endif()
|
|
|
|
# Installation (header-only library, no archive)
|
|
include(GNUInstallDirs)
|
|
install(TARGETS EchoionApi
|
|
EXPORT EchoionApiTargets
|
|
)
|
|
|
|
install(EXPORT EchoionApiTargets
|
|
FILE EchoionApiTargets.cmake
|
|
NAMESPACE Echoion::
|
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/EchoionApi
|
|
)
|
|
|
|
install(DIRECTORY include/
|
|
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
|
)
|