[CMake] Export Linker Script

Andrew Bell andrew.bell.ia at gmail.com
Thu Dec 6 09:26:12 EST 2018


I have a linker script that I'd like to export for dependent projects to
use as if it were an actual library.  I'm having trouble figuring out how
to do this.

With a linker script named "libmylib.so" I've tried:

set(LIBNAME mylib)
add_library(mylib INTERFACE)
install(TARGETS mylib
  EXPORT MyExport
  ARCHIVE DESTINATION ${LIB_INSTALL_DIR})
install(FILES libmylib.so ${LIB_INSTALL_DIR})

This will install the script properly, but attempting to use the linker
script in the dependent project fails:

target_link_libraries(myapp mylib)

doesn't add mylib to the link line with the proper directory location (no
-L option for the library location).

Any help appreciated,

-- 
Andrew Bell
andrew.bell.ia at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20181206/be31055d/attachment.html>


More information about the CMake mailing list