[CMake] Best way to append "--no-undefined" to shared link flags?
Robert Dailey
rcdailey.lists at gmail.com
Tue Jul 18 16:52:23 EDT 2017
+CMake dev list
After googling I came up with this:
set( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}
-Wl,--no-undefined" )
After talking more with the NDK devs on github though, they seem to
indicate this should happen by default (or at least, it does with the
CMake that ships with the NDK according to Dan Albert). Does
--no-defined get specified by default for other platforms? Or is it
just Android that isn't getting it?
On Tue, Jul 18, 2017 at 3:38 PM, Robert Dailey <rcdailey.lists at gmail.com> wrote:
> For only compilers that support it (I guess any clang/gcc compiler?),
> I want my shared libs to link with "--no-undefined". What is the best
> (most modern) way using CMake 3.9.0 and forward to do this? Is it
> still to explicitly set CMAKE_SHARED_LINKER_FLAGS? How does this
> impact using toolchain files and cross compiling? I don't want to wipe
> out any existing flags, and I'm not sure of the exact syntax the
> command line options need to follow.
More information about the CMake
mailing list