The cause of the downstream failure ( cmake adds "-lLibMinimal" to the linker ) is caused by the the cmake install(EXPORT) error.
You need to have LibMinimal in your export set so that CMake at export time is aware that it is an interface library and generates the correct import interface target to represent it. Without that information you will generate an invalid information, and have an invalid link line. On Wed, Jan 16, 2019 at 2:37 AM Ciccio Pasticcio <dodungocorporat...@gmail.com> wrote: > > Hello all, > I've got a simple, header only, interface library. Following the whole > CMakeLists.txt > > CMAKE_MINIMUM_REQUIRED(VERSION 3.0) > > INCLUDE(CommonLib) > PROJECT(LibMinimal) > ADD_LIBRARY(${PROJECT_NAME} INTERFACE ) > > TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} > INTERFACE "${PROJECT_SOURCE_DIR}/include" > INTERFACE "${PROJECT_SOURCE_DIR}/include/inc_arm" > ) > > INSTALL (DIRECTORY "include/" > DESTINATION ${INSTALL_LIBS_INCLUDE} > FILES_MATCHING > PATTERN "*.h" > PATTERN "*.hpp" > ) > > Then I use it in all my others libraries as follow: > > TARGET_LINK_LIBRARIES(<target> PRIVATE LibMinimal ...) > > When I build the whole source tree I get all my .so and .a, even if I get > this error while configuring the whole source tree: > > CMake Error: install(EXPORT "hwifcTarget" ...) includes target "hwifc-static" > which requires target "LibMinimal" that is not in the export set. > > hwifc is a static library. (I have other problem related to that library tho). > > When I link one of my library in an application cmake adds "-lLibMinimal" to > the linker, why? INTERFACE library shouldn't produce any output, right? This > obviously breaks the build, since there is no library file. > > Any idea? > > Thanks, > Gabriele > > > > -- > > 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: > https://cmake.org/mailman/listinfo/cmake -- 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: https://cmake.org/mailman/listinfo/cmake