Export of STATIC library with PRIVATE non-target dependencies broken
Hi,I am using CMake version 3.9.3.
I am trying to install with export a static target that has private link time dependencies.
In my case, I want to link against an INTERFACE
library that carries the TARGET_OBJECTS
of another OBJECT library.
My example looks like this:
cmake_policy(SET CMP0022 NEW)
enable_language(C)
add_library(foo STATIC empty.c)
add_library(not_exported_obj OBJECT empty.c)
add_library(not_exported INTERFACE)
target_sources(not_exported INTERFACE
$<TARGET_OBJECTS:not_exported_obj>)
target_link_libraries(foo PRIVATE not_exported)
install(TARGETS foo EXPORT Exp DESTINATION lib)
install(EXPORT Exp DESTINATION lib/cmake/Exp)
I am getting the following error:
CMake Error: install(EXPORT "Exp" ...) includes target "foo" which requires target "not_exported" that is not in the export set.
However, even the Test example does not seem to work!
cmake_policy(SET CMP0022 NEW)
enable_language(C)
add_library(foo STATIC empty.c)
add_library(not_exported STATIC empty.c)
target_link_libraries(foo PRIVATE not_exported)
install(TARGETS foo EXPORT Exp DESTINATION lib)
install(EXPORT Exp DESTINATION lib/cmake/Exp)
The strange thing is, this should have been fixed in commit 87f44b75, shouldn't it?
Am I doing something wrong or is this a regression?