@@ -4,30 +4,9 @@ add_library(lslobj OBJECT
4
4
${lslheaders}
5
5
)
6
6
7
- target_compile_features (lslobj PUBLIC cxx_std_17 ) # Note: Redundant with project-wide setting in CompilerSettings.cmake
7
+ target_link_libraries (lslobj PRIVATE lslboost Threads::Threads ) # TODO: Seems out of order here
8
8
9
- target_compile_definitions (lslobj
10
- PRIVATE
11
- LIBLSL_EXPORTS
12
- LOGURU_DEBUG_LOGGING=$<BOOL:${LSL_DEBUGLOG}>
13
- PUBLIC
14
- ASIO_NO_DEPRECATED
15
- $< $< CXX_COMPILER_ID:MSVC> :LSLNOAUTOLINK> # don't use #pragma(lib) in CMake builds
16
- )
17
- if (WIN32 )
18
- if (BUILD_SHARED_LIBS )
19
- set_target_properties (lslobj
20
- PROPERTIES
21
- WINDOWS_EXPORT_ALL_SYMBOLS ON
22
- )
23
- endif (BUILD_SHARED_LIBS )
24
- target_compile_definitions (lslobj
25
- PRIVATE
26
- _CRT_SECURE_NO_WARNINGS
27
- PUBLIC
28
- _WIN32_WINNT=${LSL_WINVER}
29
- )
30
- endif (WIN32 )
9
+ target_compile_features (lslobj PUBLIC cxx_std_17 ) # TODO: Redundant with project-wide setting in CompilerSettings.cmake
31
10
32
11
# Set the includes/headers for the lslobj target.
33
12
# Note: We cannot use the PUBLIC_HEADER property of the target, because
@@ -44,14 +23,32 @@ endif(WIN32)
44
23
# If we used the FILET_SET approach then we would remove the PUBLIC includes below.
45
24
target_include_directories (lslobj
46
25
PUBLIC
47
- $< BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR } /include>
26
+ $< BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR } /include>
48
27
$< INSTALL_INTERFACE:include>
49
28
INTERFACE
50
29
# Propagate include directories to consumers
51
30
$< BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR} /src> # for unit tests
52
31
)
53
32
54
- # Link in dependencies -- some of which are header-only libraries
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
+
48
+ if (MINGW )
49
+ target_link_libraries (lslobj PRIVATE bcrypt )
50
+ endif ()
51
+
55
52
# - System libs
56
53
if (UNIX AND NOT APPLE )
57
54
# check that clock_gettime is present in the stdlib, link against librt otherwise
@@ -65,23 +62,33 @@ if(UNIX AND NOT APPLE)
65
62
endif ()
66
63
elseif (WIN32 )
67
64
target_link_libraries (lslobj PRIVATE iphlpapi winmm mswsock ws2_32 )
65
+ target_compile_definitions (lslobj
66
+ PRIVATE
67
+ _CRT_SECURE_NO_WARNINGS
68
+ PUBLIC
69
+ _WIN32_WINNT=${LSL_WINVER}
70
+ )
71
+ if (BUILD_SHARED_LIBS )
72
+ # set_target_properties(lslobj
73
+ # PROPERTIES
74
+ # WINDOWS_EXPORT_ALL_SYMBOLS ON
75
+ # )
76
+ endif (BUILD_SHARED_LIBS )
68
77
endif ()
69
- if (MINGW )
70
- target_link_libraries (lslobj PRIVATE bcrypt )
71
- endif ()
72
- target_link_libraries (lslobj PRIVATE lslboost Threads::Threads )
78
+
79
+ # Link in dependencies -- some of which are header-only libraries
80
+
73
81
# - loguru and asio header-only
74
82
if (NOT LSL_OPTIMIZATIONS )
75
83
# build one object file for Asio instead of once every time an Asio function is called. See
76
84
# https://think-async.com/Asio/asio-1.18.2/doc/asio/using.html#asio.using.optional_separate_compilation
77
85
target_sources (lslobj PRIVATE thirdparty/asio_objects.cpp )
78
- target_compile_definitions (lslobj PUBLIC ASIO_SEPARATE_COMPILATION ASIO_DISABLE_VISIBILITY )
86
+ target_compile_definitions (lslobj
87
+ PUBLIC
88
+ ASIO_SEPARATE_COMPILATION
89
+ ASIO_DISABLE_VISIBILITY
90
+ )
79
91
endif ()
80
- target_include_directories (lslobj
81
- SYSTEM PUBLIC
82
- $< BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR} /thirdparty/loguru>
83
- $< BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR} /thirdparty/asio>
84
- )
85
92
# - pugixml
86
93
if (LSL_BUNDLED_PUGIXML )
87
94
target_sources (lslobj PRIVATE thirdparty/pugixml/pugixml.cpp )
0 commit comments