From 113fcc9eafbd49931525b967fb38dcf7f6c59557 Mon Sep 17 00:00:00 2001 From: Mark Piper Date: Mon, 11 Mar 2024 15:38:30 -0600 Subject: [PATCH] Add pkg-config files for heatf model and its BMI --- bmi_heat/CMakeLists.txt | 10 ++++++++++ bmi_heat/bmiheatf.pc.cmake | 11 +++++++++++ heat/CMakeLists.txt | 10 ++++++++++ heat/heatf.pc.cmake | 10 ++++++++++ 4 files changed, 41 insertions(+) create mode 100644 bmi_heat/bmiheatf.pc.cmake create mode 100644 heat/heatf.pc.cmake diff --git a/bmi_heat/CMakeLists.txt b/bmi_heat/CMakeLists.txt index 178e226..da3b90b 100644 --- a/bmi_heat/CMakeLists.txt +++ b/bmi_heat/CMakeLists.txt @@ -1,5 +1,11 @@ # bmi-heat +configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/${bmi_name}.pc.cmake + ${CMAKE_BINARY_DIR}/bmi_heat/${bmi_name}.pc + @ONLY +) + # Create shared library, except on Windows. if(WIN32) add_library(${bmi_name} bmi_heat.f90) @@ -25,3 +31,7 @@ install( FILES ${CMAKE_Fortran_MODULE_DIRECTORY}/${bmi_name}.mod DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) +install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/${bmi_name}.pc + DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig +) diff --git a/bmi_heat/bmiheatf.pc.cmake b/bmi_heat/bmiheatf.pc.cmake new file mode 100644 index 0000000..78a0235 --- /dev/null +++ b/bmi_heat/bmiheatf.pc.cmake @@ -0,0 +1,11 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=${prefix} +libdir=${exec_prefix}/lib +includedir=${prefix}/include + +Name: @bmi_name@ +Description: BMI for the heatf model +Version: @CMAKE_PROJECT_VERSION@ +Requires: @model_name@ +Libs: -L${libdir} -l@bmi_name@ +Cflags: -I${includedir} diff --git a/heat/CMakeLists.txt b/heat/CMakeLists.txt index 98f0781..c69b415 100644 --- a/heat/CMakeLists.txt +++ b/heat/CMakeLists.txt @@ -1,5 +1,11 @@ # heat +configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/${model_name}.pc.cmake + ${CMAKE_BINARY_DIR}/heat/${model_name}.pc + @ONLY +) + # Create shared library, except on Windows. if(WIN32) add_library(${model_name} heat.f90) @@ -24,3 +30,7 @@ install( FILES ${CMAKE_Fortran_MODULE_DIRECTORY}/${model_name}.mod DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) +install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/${model_name}.pc + DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig +) diff --git a/heat/heatf.pc.cmake b/heat/heatf.pc.cmake new file mode 100644 index 0000000..3e305de --- /dev/null +++ b/heat/heatf.pc.cmake @@ -0,0 +1,10 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=${prefix} +libdir=${exec_prefix}/lib +includedir=${prefix}/include + +Name: @model_name@ +Description: The two-dimensional heat equation in Fortran +Version: @CMAKE_PROJECT_VERSION@ +Libs: -L${libdir} -l@model_name@ +Cflags: -I${includedir}