scsl/CMakeLists.txt

65 lines
1.4 KiB
CMake
Raw Normal View History

2023-10-06 03:13:46 +00:00
cmake_minimum_required(VERSION 3.25)
2023-10-10 00:20:18 +00:00
project(klib LANGUAGES CXX VERSION 0.0.1)
2023-10-06 03:13:46 +00:00
set(CMAKE_CXX_STANDARD 14)
2023-10-10 00:20:18 +00:00
2023-10-06 06:08:35 +00:00
if(MSVC)
add_compile_options("/W4" "$<$<CONFIG:RELEASE>:/O2>")
else()
add_compile_options("-Wall" "-Wextra" "-Werror" "$<$<CONFIG:RELEASE>:-O3>")
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
add_compile_options("-stdlib=libc++")
else()
# nothing special for gcc at the moment
endif()
endif()
add_compile_options("-DDESKTOP_BUILD")
2023-10-06 03:13:46 +00:00
2023-10-09 23:37:02 +00:00
set(HEADER_FILES
Arena.h
Buffer.h
Dictionary.h
2023-10-10 02:59:21 +00:00
Test.h
2023-10-09 23:37:02 +00:00
TLV.h)
2023-10-10 02:59:21 +00:00
set(SOURCE_FILES
2023-10-06 03:13:46 +00:00
Arena.cc
2023-10-09 17:24:40 +00:00
Buffer.cc
2023-10-09 23:37:02 +00:00
Dictionary.cc
2023-10-10 02:59:21 +00:00
Test.cc
2023-10-09 23:37:02 +00:00
TLV.cc)
2023-10-10 02:59:21 +00:00
add_library(klib STATIC
Arena.cc
Buffer.cc
Dictionary.cc
TLV.cc
)
2023-10-09 23:37:02 +00:00
install(TARGETS klib LIBRARY DESTINATION ${PREFIX}/lib)
install(FILES ${HEADER_FILES} DESTINATION include/klib)
install(FILES klibConfig.cmake DESTINATION share/klib/cmake)
2023-10-06 03:13:46 +00:00
2023-10-10 00:20:18 +00:00
include(CTest)
enable_testing()
2023-10-06 06:17:09 +00:00
add_executable(tlv_test tlvTest.cc)
2023-10-06 03:13:46 +00:00
target_link_libraries(tlv_test klib)
2023-10-10 00:20:18 +00:00
add_test(tlvTest tlv_test)
2023-10-06 06:08:35 +00:00
2023-10-06 06:17:09 +00:00
add_executable(dictionary_test dictionaryTest.cc)
target_link_libraries(dictionary_test klib)
2023-10-10 00:20:18 +00:00
add_test(dictionaryTest dictionary_test)
2023-10-06 06:08:35 +00:00
2023-10-09 17:24:40 +00:00
add_executable(buffer_test bufferTest.cc)
target_link_libraries(buffer_test klib)
2023-10-10 00:20:18 +00:00
add_test(bufferTest buffer_test)
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
klibConfig.cmake
VERSION ${PACKAGE_VERSION}
COMPATIBILITY AnyNewerVersion
2023-10-10 02:59:21 +00:00
)
include(CMakePack.txt)
include(CMakeDocs.txt)