-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
37 lines (28 loc) · 1.06 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
cmake_minimum_required(VERSION 3.12)
project(lnl CXX)
set(CMAKE_CXX_STANDARD 17)
file(GLOB_RECURSE sources
"src/*.cpp"
"include/*.h")
option(BUILD_EXAMPLE "Build the example app" ON)
option(BUILD_AND_RUN_TESTS "Build and run tests" ON)
add_library(lnl STATIC ${sources})
target_include_directories(lnl PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
if (WIN32)
add_compile_definitions(WIN32_LEAN_AND_MEAN)
target_link_libraries(lnl PRIVATE wsock32 ws2_32)
elseif (UNIX)
target_link_libraries(lnl PRIVATE pthread)
endif ()
if (BUILD_EXAMPLE)
add_executable(lnl_example_server example/server.cpp)
target_include_directories(lnl_example_server PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include)
target_link_libraries(lnl_example_server PRIVATE lnl)
add_executable(lnl_example_client example/client.cpp)
target_include_directories(lnl_example_client PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include)
target_link_libraries(lnl_example_client PRIVATE lnl)
endif ()
if (BUILD_AND_RUN_TESTS)
enable_testing()
add_subdirectory(tests)
endif ()