[CMake] Trouble with CMAKE_EXE_LINKER_FLAGS not honored

Bryan Christ bryan.christ at gmail.com
Tue Jun 4 16:11:44 EDT 2019


For building my project on Linux with gcc I set the following.

set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--no-as-needed")

Later, if, the system appears to be OSX, I change it:

if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")

    set(CMAKE_EXE_LINKER_FLAGS "-Wl,-undefined -Wl,dynamic_lookup")
    set(CMAKE_PREFIX_PATH /usr/local/opt/ncurses)

endif()

However, when creating the shared object, linking fails.  The flags are not
being passed to clang as expected.  When I dive into
CMakeFile/vterm-shared.dir/link.txt I confirm that the wrong flags are
there.

What am I doing wrong?

-- 
Bryan
<><
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20190604/9282be54/attachment.html>


More information about the CMake mailing list