Files
snipplib/CMakeLists.txt
2026-06-19 09:34:27 +03:00

34 lines
1.1 KiB
CMake

cmake_minimum_required(VERSION 3.10.0)
project(snipplib VERSION 0.1.0 LANGUAGES CXX)
option(BUILD_EXAMPLES "Build examples" ON)
set(LIB_HEADERS
include/snipplib/concepts/snplib_concepts.h
include/snipplib/utils/snplib_hash.h
include/snipplib/utils/snplib_string.h
include/snipplib/utils/snplib_utils.h
include/snipplib/containers/snplib_hmap.h
include/snipplib/serialization/snplib_serialization.h
include/snipplib/network/snplib_endpoint.h
)
add_library(${PROJECT_NAME} INTERFACE ${LIB_HEADERS})
target_compile_features(${PROJECT_NAME} INTERFACE cxx_std_23)
target_include_directories(
${PROJECT_NAME}
INTERFACE
"$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>"
"$<INSTALL_INTERFACE:include/${PROJECT_NAME}>"
)
if(BUILD_EXAMPLES)
set(EXAM_STRING str_exam)
add_executable(${EXAM_STRING} examples/str_exam.cpp)
target_link_libraries(${EXAM_STRING} ${PROJECT_NAME})
set(EXAM_HMAP hmap_example)
add_executable(${EXAM_HMAP} examples/hmap_example.cpp)
target_link_libraries(${EXAM_HMAP} ${PROJECT_NAME})
endif()