@@ -4,11 +4,7 @@ add_library(lslobj OBJECT
44 ${lslheaders}
55)
66
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
128# Note: We cannot use the PUBLIC_HEADER property of the target, because
139# it flattens the include directories.
1410# We could use the new FILE_SET feature that comes with CMake 3.23.
@@ -30,26 +26,11 @@ target_include_directories(lslobj
3026 $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR} /src> # for unit tests
3127)
3228
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)
4831if (MINGW)
4932 target_link_libraries (lslobj PRIVATE bcrypt)
5033endif ()
51-
52- # - System libs
5334if (UNIX AND NOT APPLE )
5435 # check that clock_gettime is present in the stdlib, link against librt otherwise
5536 include (CheckSymbolExists)
@@ -62,10 +43,22 @@ if(UNIX AND NOT APPLE)
6243 endif ()
6344elseif (WIN32 )
6445 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 )
6558 target_compile_definitions (lslobj
66- PRIVATE
59+ PRIVATE
6760 _CRT_SECURE_NO_WARNINGS
68- PUBLIC
61+ PUBLIC
6962 _WIN32_WINNT=${LSL_WINVER}
7063 )
7164 if (BUILD_SHARED_LIBS )
@@ -74,11 +67,15 @@ elseif(WIN32)
7467 # WINDOWS_EXPORT_ALL_SYMBOLS ON
7568 # )
7669 endif (BUILD_SHARED_LIBS )
77- endif ()
78-
79- # Link in dependencies -- some of which are header-only libraries
70+ endif (WIN32 )
8071
72+ # Link in 3rd party dependencies
8173# - 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+ )
8279if (NOT LSL_OPTIMIZATIONS)
8380 # build one object file for Asio instead of once every time an Asio function is called. See
8481 # 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)
8986 ASIO_DISABLE_VISIBILITY
9087 )
9188endif ()
89+
9290# - pugixml
9391if (LSL_BUNDLED_PUGIXML)
9492 target_sources (lslobj PRIVATE thirdparty/pugixml/pugixml.cpp)
0 commit comments