1

I am trying to use ld as the linker for CMake, and thus I have the following tow lines:

set(CMAKE_LINKER "/usr/bin/ld")
set(CMAKE_CXX_LINK_EXECUTABLE  "<CMAKE_LINKER> <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")

However, when the program links, it provide a -rdynamic option for the linker. That option is suitable for gcc, but not for ld.

Anyone know where this option come from? So that I can add a line to change that variable (I assume it is a variable storing this option).

Robin Hsu
  • 4,164
  • 3
  • 20
  • 37

1 Answers1

0

Since no one answered the question, and I already found it, I post it here.

By the help of This question, I print out all the variables and found it to be CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS and CMAKE_SHARED_LIBRARY_LINK_C_FLAGS

Robin Hsu
  • 4,164
  • 3
  • 20
  • 37