I have a library which depends on multiple OBJECT
libraries, defined like this:
add_library(openfastlib STATIC
src/FAST_Library.f90
$<TARGET_OBJECTS:openfast_prelib_obj>
$<TARGET_OBJECTS:maplib_obj>
$<TARGET_OBJECTS:nwtclibs_obj>
$<TARGET_OBJECTS:ifwlib_obj>
$<TARGET_OBJECTS:aerodynlib_obj>
$<TARGET_OBJECTS:aerodyn14lib_obj>
$<TARGET_OBJECTS:servodynlib_obj>
$<TARGET_OBJECTS:elastodynlib_obj>
$<TARGET_OBJECTS:beamdynlib_obj>
$<TARGET_OBJECTS:subdynlib_obj>
$<TARGET_OBJECTS:hydrodynlib_obj>
$<TARGET_OBJECTS:orcaflexlib_obj>
$<TARGET_OBJECTS:extptfm_mckflib_obj>
$<TARGET_OBJECTS:openfoamtypeslib_obj>
$<TARGET_OBJECTS:foamfastlib_obj>
$<TARGET_OBJECTS:scdataextypeslib_obj>
$<TARGET_OBJECTS:scdataexlib_obj>
$<TARGET_OBJECTS:feamlib_obj>
$<TARGET_OBJECTS:moordynlib_obj>
$<TARGET_OBJECTS:icedynlib_obj>
$<TARGET_OBJECTS:icefloelib_obj>
$<TARGET_OBJECTS:openfast_postlib_obj>
$<TARGET_OBJECTS:versioninfolib_obj>
)
target_link_libraries(openfastlib
versioninfolib_obj
openfast_prelib_obj
maplib_obj
nwtclibs_obj
ifwlib_obj
aerodynlib_obj
aerodyn14lib_obj
servodynlib_obj
elastodynlib_obj
beamdynlib_obj
subdynlib_obj
hydrodynlib_obj
orcaflexlib_obj
extptfm_mckflib_obj
openfoamtypeslib_obj
foamfastlib_obj
scdataextypeslib_obj
scdataexlib_obj
feamlib_obj
moordynlib_obj
icedynlib_obj
icefloelib_obj
openfast_postlib_obj
versioninfolib_obj
${LAPACK_LIBRARIES}
${CMAKE_DL_LIBS}
)
Each object library is defined in a directory which is at the same level as this directory. There is also a top level cmake file for the project.
I also have an install command like this:
install(TARGETS openfastlib openfast_prelib openfast_postlib
EXPORT ${CMAKE_PROJECT_NAME}Libraries
RUNTIME DESTINATION lib
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib)
However, when I run cmake (version 3.22.2), I get:
CMake Error: install(EXPORT "OpenFASTLibraries" ...) includes target "openfastlib" which requires target "versioninfolib_obj" that is not in any export set.
CMake Error: install(EXPORT "OpenFASTLibraries" ...) includes target "openfastlib" which requires target "openfast_prelib_obj" that is not in any export set.
CMake Error: install(EXPORT "OpenFASTLibraries" ...) includes target "openfastlib" which requires target "maplib_obj" that is not in any export set.
CMake Error: install(EXPORT "OpenFASTLibraries" ...) includes target "openfastlib" which requires target "nwtclibs_obj" that is not in any export set.
CMake Error: install(EXPORT "OpenFASTLibraries" ...) includes target "openfastlib" which requires target "ifwlib_obj" that is not in any export set.
CMake Error: install(EXPORT "OpenFASTLibraries" ...) includes target "openfastlib" which requires target "aerodynlib_obj" that is not in any export set.
CMake Error: install(EXPORT "OpenFASTLibraries" ...) includes target "openfastlib" which requires target "aerodyn14lib_obj" that is not in any export set.
CMake Error: install(EXPORT "OpenFASTLibraries" ...) includes target "openfastlib" which requires target "servodynlib_obj" that is not in any export set.
CMake Error: install(EXPORT "OpenFASTLibraries" ...) includes target "openfastlib" which requires target "elastodynlib_obj" that is not in any export set.
CMake Error: install(EXPORT "OpenFASTLibraries" ...) includes target "openfastlib" which requires target "beamdynlib_obj" that is not in any export set.
CMake Error: install(EXPORT "OpenFASTLibraries" ...) includes target "openfastlib" which requires target "subdynlib_obj" that is not in any export set.
CMake Error: install(EXPORT "OpenFASTLibraries" ...) includes target "openfastlib" which requires target "hydrodynlib_obj" that is not in any export set.
CMake Error: install(EXPORT "OpenFASTLibraries" ...) includes target "openfastlib" which requires target "orcaflexlib_obj" that is not in any export set.
CMake Error: install(EXPORT "OpenFASTLibraries" ...) includes target "openfastlib" which requires target "extptfm_mckflib_obj" that is not in any export set.
CMake Error: install(EXPORT "OpenFASTLibraries" ...) includes target "openfastlib" which requires target "openfoamtypeslib_obj" that is not in any export set.
CMake Error: install(EXPORT "OpenFASTLibraries" ...) includes target "openfastlib" which requires target "foamfastlib_obj" that is not in any export set.
CMake Error: install(EXPORT "OpenFASTLibraries" ...) includes target "openfastlib" which requires target "scdataextypeslib_obj" that is not in any export set.
CMake Error: install(EXPORT "OpenFASTLibraries" ...) includes target "openfastlib" which requires target "scdataexlib_obj" that is not in any export set.
CMake Error: install(EXPORT "OpenFASTLibraries" ...) includes target "openfastlib" which requires target "feamlib_obj" that is not in any export set.
CMake Error: install(EXPORT "OpenFASTLibraries" ...) includes target "openfastlib" which requires target "moordynlib_obj" that is not in any export set.
CMake Error: install(EXPORT "OpenFASTLibraries" ...) includes target "openfastlib" which requires target "icedynlib_obj" that is not in any export set.
CMake Error: install(EXPORT "OpenFASTLibraries" ...) includes target "openfastlib" which requires target "icefloelib_obj" that is not in any export set.
CMake Error: install(EXPORT "OpenFASTLibraries" ...) includes target "openfastlib" which requires target "openfast_postlib_obj" that is not in any export set.
CMake Error: install(EXPORT "OpenFASTLibraries" ...) includes target "openfastlib" which requires target "versioninfolib_obj" that is not in any export set.
Why am I getting this error, and how should I address it?
Incidentally this is a legacy code base I am working on, which I was modifying to build a library from object libraries, instead of linking together a bunch of other libraries which are also built and installed. The motivation was that I thought the previous method was resulting in missing symbols when making a static library.
The question install EXPORT problem for library with dependencies does not address this as it does not refer to OBJECT type libraries which on would not want to install, but rather only normal libraries.