Skip to content

Commit 353ca90

Browse files
committed
Always set ASIO_DISABLE_VISIBILITY to keep asio symbols hidden in liblsl.
1 parent 2ddb4cf commit 353ca90

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cmake_minimum_required (VERSION 3.23)
22
project (liblsl
3-
VERSION 1.17.4
3+
VERSION 1.17.5
44
LANGUAGES C CXX
55
DESCRIPTION "Labstreaminglayer C/C++ library"
66
HOMEPAGE_URL "https://github.com/sccn/liblsl"

cmake/TargetObjLib.cmake

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ target_compile_definitions(lslobj
3939
PRIVATE
4040
LIBLSL_EXPORTS
4141
LOGURU_DEBUG_LOGGING=$<BOOL:${LSL_DEBUGLOG}>
42+
# Prevent asio from overriding CMAKE_CXX_VISIBILITY_PRESET with its own
43+
# #pragma GCC visibility push(default). This ensures asio symbols stay
44+
# hidden in the final shared library, avoiding ODR violations when
45+
# applications also use standalone asio.
46+
ASIO_DISABLE_VISIBILITY
4247
PUBLIC
4348
ASIO_NO_DEPRECATED
4449
$<$<CXX_COMPILER_ID:MSVC>:LSLNOAUTOLINK> # don't use #pragma(lib) in CMake builds
@@ -71,11 +76,7 @@ if(NOT LSL_OPTIMIZATIONS)
7176
# build one object file for Asio instead of once every time an Asio function is called. See
7277
# https://think-async.com/Asio/asio-1.18.2/doc/asio/using.html#asio.using.optional_separate_compilation
7378
target_sources(lslobj PRIVATE thirdparty/asio_objects.cpp)
74-
target_compile_definitions(lslobj
75-
PUBLIC
76-
ASIO_SEPARATE_COMPILATION
77-
ASIO_DISABLE_VISIBILITY
78-
)
79+
target_compile_definitions(lslobj PUBLIC ASIO_SEPARATE_COMPILATION)
7980
endif()
8081

8182
# - pugixml

0 commit comments

Comments
 (0)