-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
39 lines (30 loc) · 1.19 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
38
39
cmake_minimum_required(VERSION 3.17)
project(NetworkLibrary)
set(CMAKE_CXX_STANDARD 20)
if (NOT TARGET PolymorphNetwork)
if (NOT TARGET asio)
include(cmake/FindAsio.cmake)
FIND_PACKAGE(asio REQUIRED)
endif ()
file(GLOB_RECURSE SRCS src/*.cpp)
list(REMOVE_ITEM SRCS src/main.cpp)
file(GLOB_RECURSE ICLS include/*.hpp)
file(GLOB_RECURSE PRIV_ICLS src/include/*.hpp)
get_target_property(asio-icls asio INTERFACE_INCLUDE_DIRECTORIES)
add_library(PolymorphNetwork ${SRCS} ${ICLS} ${PRIV_ICLS})
target_include_directories(PolymorphNetwork PUBLIC include)
target_include_directories(PolymorphNetwork PRIVATE src/include ${asio-icls})
set_target_properties(PolymorphNetwork PROPERTIES POSITION_INDEPENDENT_CODE ON)
target_link_libraries(PolymorphNetwork asio)
if(WIN32)
# MSVC
# /wd4100: unreferenced formal parameter (= unused parameter)
# /wd4250 : inherits via dominance
target_compile_options(PolymorphNetwork PRIVATE /W4 /wd4250)
endif()
endif()
if (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
include(tests/cmake/FindGoogleTest.cmake)
enable_testing()
add_subdirectory(tests)
endif ()