Hi,

I have an interface library and I am not sure how I would get CMake to
generate the usual <lib>-config.cmake file for the library so that I can
then use "find_package" on the interface library from an external project.

I am adding (and installing) the library like this:

add_library(myLib INTERFACE)
target_include_directories(myLib INTERFACE
    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
    $<INSTALL_INTERFACE:include/>
    )

and then installing like this:

install(TARGETS myLib EXPORT myLib_targets INCLUDES DESTINATION include)
install(EXPORT myLib_targets DESTINATION "lib/cmake")
install(FILES ${MY_HEADERS} DESTINATION "include/")

Obviously, I am doing it wrong or missing some steps as I do not see the
myLib-config.cmake file anywhere in the install folder (or the build
directory for that matter) that is usually generated when using install
commands.

Ultimately, I would like to use the "find_package" command on the interface
library from another CMake project.

Thank you,
Saad
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to