Can't generate config for static lib
I want to create a static library and let cmake create the targets for the config file which is installed.
I created a static library static-foo
, this library depends on another static library static-bar
.
I only install and export the target static-foo
, because static-bar
is only a helper, which a user does not need.
the cmake configure step throws an error
cmake -H. -B_build -DCMAKE_INSTALL_PREFIX=$(pwd)/_install
...
CMake Error: install(EXPORT "MyFooTargets" ...) includes target "static-foo" which requires target "static-bar" that is not in the export set.
I expected, that cmake compiles static-bar
into static-foo
in one big static library, which I can install (and later use)
other configurations that work as expected:
- Change
static-foo
to be a SHARED library - Link
static-foo
into executablefoo
and just install (and export)foo
$ cmake --version
cmake version 3.9.1
CMake suite maintained and supported by Kitware (kitware.com/cmake).
Attached a minimal example