1 cmake_minimum_required(VERSION 3.20.2)
4 find_package(OpenSSL 3 REQUIRED)
8 set(LINK_VERSION_MINOR 0)
9 set(LINK_VERSION_PATCH 0)
10 set(LINK_VERSION_EXTRA "rc2")
12 set(VERSION ${LINK_VERSION}.${LINK_VERSION_MINOR}.${LINK_VERSION_PATCH}-${LINK_VERSION_EXTRA})
14 if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS_EQUAL 8.0)
15 message(STATUS "GCC version is <= 8.0. -DFS_EXPERIMENTAL")
19 file(GLOB_RECURSE SOURCES Source/*.cpp)
20 file(GLOB_RECURSE INCLUDES Include/*)
22 include_directories(Include)
24 add_library(link SHARED ${SOURCES})
25 set_target_properties(link PROPERTIES
26 PUBLIC_HEADER ${INCLUDES})
28 set_target_properties(link PROPERTIES
30 SOVERSION ${LINK_VERSION})
32 target_compile_features(link PUBLIC cxx_std_17)
33 set (CMAKE_CXX_FLAGS "-std=c++17")
35 target_include_directories(link PUBLIC Include)
36 target_link_libraries(link PUBLIC OpenSSL::SSL z)
38 if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS_EQUAL 8.0)
39 target_link_libraries(link PUBLIC stdc++fs)
40 set (CMAKE_CXX_FLAGS "-DFS_EXPERIMENTAL")
45 LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
46 PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_PREFIX}/include)
49 file(GLOB_RECURSE TEST_SOURCES Test/*.cpp)
52 add_executable(linktest ${TEST_SOURCES})
53 target_link_libraries(linktest PRIVATE link)
57 add_test(NAME test COMMAND $<TARGET_FILE:linktest>)