Discussion:
[CMake] Export Linker Script
Andrew Bell
2018-12-06 14:26:12 UTC
Permalink
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
***@gmail.com
Continue reading on narkive:
Loading...