[CMake] Suppressing -rdynamic

Filip Brcic brcha at users.sourceforge.net
Sat Oct 6 08:16:16 EDT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Дана субота 06 октобар 2007, Gonzalo Garramuño је написао(ла):
> I'm compiling under Linux and it seems like cmake is automatically
> adding -rdynamic to my build.
> This switch is okay for debug builds and open source tools, but for
> closed source it is a big problem.
> This switch is unfortunately exposing some unwanted functions in my
> code, like the licensing functions.
> This makes the functions easily available by using objdump -T or nm -D,
> even if the executable has been stripped.
>
> Is there a way to suppress the use of this switch?

Hi,

If you do a:

[brcha at sirius ~]$ cd /usr/share/cmake/Modules
[brcha at sirius Modules]$ grep 'rdynamic' *
[brcha at sirius Modules]$ grep 'rdynamic' */*
Platform/kFreeBSD.cmake:SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "-rdynamic")
Platform/Linux.cmake:SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "-rdynamic")

Therefore, you have to override CMAKE_SHARED_LIBRARY_LINK_C_FLAGS and set it 
to blank. Something like:

SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")

or something like that.

And do consider making your program free software ;)

Best regards
Filip

- -- 
Filip Brcic <brcha at users.sourceforge.net>
WWWeb: http://purl.org/NET/brcha/home/
Jabber: brcha at kdetalk.net
ICQ# 40994923
Yahoo! brcha
MSN: brcha at users.sourceforge.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)

iD8DBQFHB3yReugpoxYs6H8RAki+AKCtU8j2w5QDp5pLOvQwNhyCvfNTowCgnr4R
HWboVDawlQ/yqDMTGatbtro=
=kC2K
-----END PGP SIGNATURE-----


More information about the CMake mailing list