diff --git a/CMakeLists.txt b/CMakeLists.txt index afdef22..6b450db 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.24) project( fplot LANGUAGES Fortran - VERSION 1.8.9 + VERSION 1.8.10 ) # Confgiure everything diff --git a/configure/template.cmake b/configure/template.cmake index ffdb09b..dba1f8e 100644 --- a/configure/template.cmake +++ b/configure/template.cmake @@ -1,5 +1,14 @@ @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() + if(NOT TARGET "@PROJECT_NAME@::@PROJECT_NAME@") include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-targets.cmake") endif() \ No newline at end of file diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index b05a4c1..feda836 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -1,5 +1,3 @@ -find_package(fstring QUIET) - # Example 1 add_executable(generic_2d_plot generic_2d_plot.f90) target_link_libraries(generic_2d_plot fplot) @@ -131,7 +129,6 @@ target_link_libraries(arrow_example fplot) # Example 33 add_executable(custom_colormap_example custom_colormap_example.f90) target_link_libraries(custom_colormap_example fplot) -target_link_libraries(custom_colormap_example forcolormap) # Example 34 add_executable(variable_point_size_2d_example variable_point_size_2d_example.f90) @@ -151,7 +148,7 @@ target_link_libraries(margins_example fplot) # Example 38 add_executable(box_whisker_example box_whisker_example.f90) -target_link_libraries(box_whisker_example fplot fstring::fstring) +target_link_libraries(box_whisker_example fplot) # Example 39 add_executable(jitter_plot_example jitter_plot_example.f90) diff --git a/fpm.toml b/fpm.toml index 616944b..cba8664 100644 --- a/fpm.toml +++ b/fpm.toml @@ -1,5 +1,5 @@ name = "fplot" -version = "1.8.9" +version = "1.8.10" license = "GPL-3.0" author = "Jason Christopherson" maintainer = "Jason Christopherson" diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0febaba..6047d19 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -125,10 +125,6 @@ target_link_libraries( ${PROJECT_NAME} PUBLIC ${FERROR_LIBRARIES} -) -target_link_libraries( - ${PROJECT_NAME} - PRIVATE ${COLLECTIONS_LIBRARIES} ${GEOMPACK_LIBRARIES} ${FSTRING_LIBRARIES} @@ -167,18 +163,44 @@ install( ) install(DIRECTORY ${FPLOT_MOD_DIR} DESTINATION ${CMAKE_INSTALL_MODULEDIR}) -if (${BUILD_FERROR} AND ${BUILD_SHARED_LIBS}) +# For static libraries, install dependency libraries +if(NOT BUILD_SHARED_LIBS) + # Install fetched dependency libraries if they were built + if(${BUILD_FERROR}) + install(TARGETS ${FERROR_LIBRARIES} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + endif() + if(${BUILD_COLLECTIONS}) + install(TARGETS ${COLLECTIONS_LIBRARIES} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + endif() + if(${BUILD_GEOMPACK}) + install(TARGETS ${GEOMPACK_LIBRARIES} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + endif() + if(${BUILD_FSTRING}) + install(TARGETS ${FSTRING_LIBRARIES} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + 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}) +if(${BUILD_COLLECTIONS} AND ${BUILD_SHARED_LIBS}) install(IMPORTED_RUNTIME_ARTIFACTS ${COLLECTIONS_LIBRARIES}) endif() -if (${BUILD_GEOMPACK} AND ${BUILD_SHARED_LIBS}) +if(${BUILD_GEOMPACK} AND ${BUILD_SHARED_LIBS}) install(IMPORTED_RUNTIME_ARTIFACTS ${GEOMPACK_LIBRARIES}) endif() -if (${BUILD_FSTRING} AND ${BUILD_SHARED_LIBS}) +if(${BUILD_FSTRING} AND ${BUILD_SHARED_LIBS}) install(IMPORTED_RUNTIME_ARTIFACTS ${FSTRING_LIBRARIES}) endif()