@@ -4,11 +4,7 @@ add_library(lslobj OBJECT
4
4
${lslheaders}
5
5
)
6
6
7
- target_link_libraries (lslobj PRIVATE lslboost Threads::Threads ) # TODO: Seems out of order here
8
-
9
- target_compile_features (lslobj PUBLIC cxx_std_17 ) # TODO: Redundant with project-wide setting in CompilerSettings.cmake
10
-
11
- # Set the includes/headers for the lslobj target.
7
+ # Set the includes/headers for the lslobj target
12
8
# Note: We cannot use the PUBLIC_HEADER property of the target, because
13
9
# it flattens the include directories.
14
10
# We could use the new FILE_SET feature that comes with CMake 3.23.
@@ -30,26 +26,11 @@ target_include_directories(lslobj
30
26
$< BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR} /src> # for unit tests
31
27
)
32
28
33
- target_include_directories (lslobj
34
- SYSTEM PUBLIC
35
- $< BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR} /thirdparty/loguru>
36
- $< BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR} /thirdparty/asio>
37
- )
38
-
39
- target_compile_definitions (lslobj
40
- PRIVATE
41
- LIBLSL_EXPORTS
42
- LOGURU_DEBUG_LOGGING=$<BOOL:${LSL_DEBUGLOG}>
43
- PUBLIC
44
- ASIO_NO_DEPRECATED
45
- $< $< CXX_COMPILER_ID:MSVC> :LSLNOAUTOLINK> # don't use #pragma(lib) in CMake builds
46
- )
47
-
29
+ # Link system libs
30
+ target_link_libraries (lslobj PRIVATE lslboost Threads::Threads )
48
31
if (MINGW )
49
32
target_link_libraries (lslobj PRIVATE bcrypt )
50
33
endif ()
51
-
52
- # - System libs
53
34
if (UNIX AND NOT APPLE )
54
35
# check that clock_gettime is present in the stdlib, link against librt otherwise
55
36
include (CheckSymbolExists )
@@ -62,10 +43,22 @@ if(UNIX AND NOT APPLE)
62
43
endif ()
63
44
elseif (WIN32 )
64
45
target_link_libraries (lslobj PRIVATE iphlpapi winmm mswsock ws2_32 )
46
+ endif ()
47
+
48
+ # Compiler settings
49
+ target_compile_definitions (lslobj
50
+ PRIVATE
51
+ LIBLSL_EXPORTS
52
+ LOGURU_DEBUG_LOGGING=$<BOOL:${LSL_DEBUGLOG}>
53
+ PUBLIC
54
+ ASIO_NO_DEPRECATED
55
+ $< $< CXX_COMPILER_ID:MSVC> :LSLNOAUTOLINK> # don't use #pragma(lib) in CMake builds
56
+ )
57
+ if (WIN32 )
65
58
target_compile_definitions (lslobj
66
- PRIVATE
59
+ PRIVATE
67
60
_CRT_SECURE_NO_WARNINGS
68
- PUBLIC
61
+ PUBLIC
69
62
_WIN32_WINNT=${LSL_WINVER}
70
63
)
71
64
if (BUILD_SHARED_LIBS )
@@ -74,11 +67,15 @@ elseif(WIN32)
74
67
# WINDOWS_EXPORT_ALL_SYMBOLS ON
75
68
# )
76
69
endif (BUILD_SHARED_LIBS )
77
- endif ()
78
-
79
- # Link in dependencies -- some of which are header-only libraries
70
+ endif (WIN32 )
80
71
72
+ # Link in 3rd party dependencies
81
73
# - loguru and asio header-only
74
+ target_include_directories (lslobj
75
+ SYSTEM PUBLIC
76
+ $< BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR} /thirdparty/loguru>
77
+ $< BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR} /thirdparty/asio>
78
+ )
82
79
if (NOT LSL_OPTIMIZATIONS )
83
80
# build one object file for Asio instead of once every time an Asio function is called. See
84
81
# https://think-async.com/Asio/asio-1.18.2/doc/asio/using.html#asio.using.optional_separate_compilation
@@ -89,6 +86,7 @@ if(NOT LSL_OPTIMIZATIONS)
89
86
ASIO_DISABLE_VISIBILITY
90
87
)
91
88
endif ()
89
+
92
90
# - pugixml
93
91
if (LSL_BUNDLED_PUGIXML )
94
92
target_sources (lslobj PRIVATE thirdparty/pugixml/pugixml.cpp )
0 commit comments