CMake: Workaround for some export errors when doing a static build

This refuses to export/install the p3assimp/p3ptloader/p3txafile
libraries when building statically, because they depend on libraries
that are never installed, and static linkage would require all of the
dependencies to be available.

A more proper fix would involve installing these base libraries, but
only when doing a static build. I suspect nobody will ask for that,
so I haven't done it.
This commit is contained in:
Sam Edwards 2019-08-19 18:49:59 -06:00
parent b9e50da3ce
commit c16092fe8a
3 changed files with 15 additions and 3 deletions

View File

@ -26,4 +26,8 @@ set_target_properties(p3assimp PROPERTIES DEFINE_SYMBOL BUILDING_ASSIMP)
target_link_libraries(p3assimp PRIVATE p3pandatoolbase)
target_link_libraries(p3assimp PUBLIC PKG::ASSIMP)
install(TARGETS p3assimp EXPORT Tools COMPONENT Tools DESTINATION ${MODULE_DESTINATION})
if(BUILD_SHARED_LIBS)
# We can't install this if we're doing a static build, because it depends on
# a static library that isn't installed.
install(TARGETS p3assimp EXPORT Tools COMPONENT Tools DESTINATION ${MODULE_DESTINATION})
endif()

View File

@ -9,4 +9,8 @@ install(TARGETS egg-palettize EXPORT Tools COMPONENT Tools DESTINATION bin)
add_library(p3txafile txaFileFilter.cxx txaFileFilter.h txaFileFilter.I)
set_target_properties(p3txafile PROPERTIES DEFINE_SYMBOL BUILDING_MISC)
target_link_libraries(p3txafile PRIVATE p3palettizer)
install(TARGETS p3txafile EXPORT Tools COMPONENT Tools DESTINATION lib RUNTIME DESTINATION bin)
if(BUILD_SHARED_LIBS)
# We can't install this if we're doing a static build, because it depends on
# a static library that isn't installed.
install(TARGETS p3txafile EXPORT Tools COMPONENT Tools DESTINATION lib RUNTIME DESTINATION bin)
endif()

View File

@ -24,4 +24,8 @@ if(HAVE_FCOLLADA)
target_compile_definitions(p3ptloader PRIVATE HAVE_FCOLLADA)
endif()
install(TARGETS p3ptloader EXPORT Tools COMPONENT Tools DESTINATION ${MODULE_DESTINATION})
if(BUILD_SHARED_LIBS)
# We can't install this if we're doing a static build, because it depends on
# a bunch of static libraries that aren't installed.
install(TARGETS p3ptloader EXPORT Tools COMPONENT Tools DESTINATION ${MODULE_DESTINATION})
endif()