Skip to content

Commit

Permalink
[C++] Fixed the setting method of linker option. (apache#8554)
Browse files Browse the repository at this point in the history
### Motivation

I don't think the following `--exclude-libs,ALL` are reflected in linker.
 [https://github.com/apache/pulsar/blob/f8080f4eb690d751f1b07ca54c23e1cd7774473f/pulsar-client-cpp/CMakeLists.txt#L214](https://github.com/apache/pulsar/blob/f8080f4eb690d751f1b07ca54c23e1cd7774473f/pulsar-client-cpp/CMakeLists.txt#L214)

I think `--exclude-libs,ALL` needs to be set in `add_link_options`.
 [add_link_options](https://cmake.org/cmake/help/latest/command/add_link_options.html)

`add_link_options` can be used from v3.13.
Therefore, fixed(reverted) `add_compile_options` to `set`.([apache#4071](apache#4071))
  • Loading branch information
shustsud authored Nov 17, 2020
1 parent c01b1ee commit 8ebe0e5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pulsar-client-cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ if (NOT APPLE AND NOT MSVC)
# we don't set options below to build _pulsar.so
set(CMAKE_CXX_FLAGS_PYTHON "${CMAKE_CXX_FLAGS}")
# Hide all non-exported symbols to avoid conflicts
add_compile_options(-fvisibility=hidden -Wl,--exclude-libs,ALL)
set(CMAKE_CXX_FLAGS " -fvisibility=hidden -Wl,--exclude-libs,ALL ${CMAKE_CXX_FLAGS}")
endif ()

if (LIB_ZSTD)
Expand Down
2 changes: 1 addition & 1 deletion pulsar-client-cpp/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ SET(CMAKE_SHARED_LIBRARY_PREFIX )
SET(CMAKE_SHARED_LIBRARY_SUFFIX .so)


if (CMAKE_CXX_FLAGS_PYTHON)
if (NOT APPLE AND NOT MSVC)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_PYTHON}")
endif()

Expand Down

0 comments on commit 8ebe0e5

Please sign in to comment.