docs: Add contributing and patchwork
[link.git] / CMakeLists.txt
blob14a42cb76b56c8498bd9c022d44808559e78b647
1 cmake_minimum_required(VERSION 3.20.2)
2 project(Link)
4 find_package(OpenSSL 3 REQUIRED)
6 # Versioning
7 set(LINK_VERSION 2)
8 set(LINK_VERSION_MINOR 0)
9 set(LINK_VERSION_PATCH 0)
10 set(LINK_VERSION_EXTRA "devel")
12 set(VERSION ${LINK_VERSION}.${LINK_VERSION_MINOR}.${LINK_VERSION_PATCH}-${LINK_VERSION_EXTRA})
14 # Library
15 file(GLOB_RECURSE SOURCES Source/*.cpp)
16 file(GLOB_RECURSE INCLUDES Include/*)
18 include_directories(Include)
20 add_library(link SHARED ${SOURCES})
21 set_target_properties(link PROPERTIES
22     PUBLIC_HEADER ${INCLUDES})
24 set_target_properties(link PROPERTIES
25                 VERSION ${VERSION}
26                 SOVERSION ${LINK_VERSION})
28 target_compile_features(link PUBLIC cxx_std_17)
29 set (CMAKE_CXX_FLAGS "-std=c++17")
31 target_include_directories(link PUBLIC Include)
32 target_link_libraries(link PUBLIC OpenSSL::SSL z)
34 # install
35 install(TARGETS link
36     LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
37     PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_PREFIX}/include)
39 # Test
40 file(GLOB_RECURSE TEST_SOURCES Test/*.cpp)
42 add_executable(linktest ${TEST_SOURCES})
43 target_link_libraries(linktest PRIVATE link)
45 enable_testing()
47 add_test(NAME test COMMAND $<TARGET_FILE:linktest>)