[CMake] exporting targets from build tree

Michael Legleux legleux at gmail.com
Wed Jul 27 18:49:01 EDT 2016


I have 2 projects (one built with cmake, one in the process of being
converted to using it)

Project A (built with cmake) builds lib_a that Project B requires.
I'm thinking I'm doing something wrong around here:
project(lib_a)
...
add_library(lib_a STATIC ${SRC})
 target_link_libraries(${PROJECT_NAME}
   PRIVATE lib_b
   )
export(TARGETS lib_a FILE lib_a.cmake)

cmake complains that lib_b is not in the target export set. I do not WANT
it exported and it is not required by project b.
I simply want lib_a to be found/used by Project B via find_package(Project
A)

I do not want to have to install/ or create a package for this behavior,
just allow another project to reference the libs in the build tree and
headers in the source tree.

I can't seem to find the correct way to express this with cmake despite
looking at many solutions of near similar functionality.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160727/240b0b76/attachment-0001.html>


More information about the CMake mailing list