Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions configure/template.cmake
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
@PACKAGE_INIT@

# For static libraries, consumers need to find dependencies
if(NOT BUILD_SHARED_LIBS)
include(CMakeFindDependencyMacro)
find_dependency(ferror QUIET)
find_dependency(collections QUIET)
find_dependency(geompack QUIET)
find_dependency(fstring QUIET)
endif()
include(CMakeFindDependencyMacro)
find_dependency(ferror QUIET)
find_dependency(collections QUIET)
find_dependency(geompack QUIET)
find_dependency(fstring QUIET)

if(NOT TARGET "@PROJECT_NAME@::@PROJECT_NAME@")
include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-targets.cmake")
Expand Down
43 changes: 23 additions & 20 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ set(FPLOT_SOURCES ${FPLOT_SOURCES} PARENT_SCOPE)
# Dependencies
include(FetchContent)
find_package(ferror QUIET)
find_package(collections QUIET)
find_package(collections 1.0.9 QUIET)
find_package(geompack QUIET)
find_package(fstring QUIET)
if (NOT ferror_FOUND)
Expand Down Expand Up @@ -164,8 +164,28 @@ install(
install(DIRECTORY ${FPLOT_MOD_DIR} DESTINATION ${CMAKE_INSTALL_MODULEDIR})

# For static libraries, install dependency libraries
if(NOT BUILD_SHARED_LIBS)
# Install fetched dependency libraries if they were built
if(${BUILD_SHARED_LIBS})
if(${BUILD_FERROR})
install(TARGETS ${FERROR_LIBRARIES}
ARCHIVE DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()
if(${BUILD_COLLECTIONS})
install(TARGETS ${COLLECTIONS_LIBRARIES}
ARCHIVE DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()
if(${BUILD_GEOMPACK})
install(TARGETS ${GEOMPACK_LIBRARIES}
ARCHIVE DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()
if(${BUILD_FSTRING})
install(TARGETS ${FSTRING_LIBRARIES}
ARCHIVE DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()
else()
if(${BUILD_FERROR})
install(TARGETS ${FERROR_LIBRARIES}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
Expand All @@ -187,20 +207,3 @@ if(NOT BUILD_SHARED_LIBS)
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()
endif()

# For shared libraries, install runtime artifacts
if(${BUILD_FERROR} AND ${BUILD_SHARED_LIBS})
install(IMPORTED_RUNTIME_ARTIFACTS ${FERROR_LIBRARIES})
endif()

if(${BUILD_COLLECTIONS} AND ${BUILD_SHARED_LIBS})
install(IMPORTED_RUNTIME_ARTIFACTS ${COLLECTIONS_LIBRARIES})
endif()

if(${BUILD_GEOMPACK} AND ${BUILD_SHARED_LIBS})
install(IMPORTED_RUNTIME_ARTIFACTS ${GEOMPACK_LIBRARIES})
endif()

if(${BUILD_FSTRING} AND ${BUILD_SHARED_LIBS})
install(IMPORTED_RUNTIME_ARTIFACTS ${FSTRING_LIBRARIES})
endif()
Loading