[CMake] Binaries linking interface library
Ciccio Pasticcio
dodungocorporation at gmail.com
Wed Jan 16 03:37:22 EST 2019
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20190116/727359bb/attachment.html>
More information about the CMake
mailing list