Merge pull request #6628 from rocky/osx-ld-visibility

Remove clang+osx ld warning
This commit is contained in:
chriseth 2019-04-30 14:24:45 +02:00 committed by GitHub
commit 8b4bccc5f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -54,6 +54,12 @@ if (("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") OR ("${CMAKE_CXX_COMPILER_ID}" MA
# Set stack size to 32MB - by default Apple's clang defines a stack size of 8MB. # Set stack size to 32MB - by default Apple's clang defines a stack size of 8MB.
# Normally 16MB is enough to run all tests, but it will exceed the stack, if -DSANITIZE=address is used. # Normally 16MB is enough to run all tests, but it will exceed the stack, if -DSANITIZE=address is used.
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-stack_size -Wl,0x2000000") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-stack_size -Wl,0x2000000")
# Boost libraries use visibility=hidden to reduce unnecessary DWARF entries.
# Unless we match visibility, ld will give a warning message like:
# ld: warning: direct access in function 'boost::filesystem... from file ...
# means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
endif() endif()
# Some Linux-specific Clang settings. We don't want these for OS X. # Some Linux-specific Clang settings. We don't want these for OS X.