From a3ff0205bf9169f6bb4c29b89d2423c5c27e7698 Mon Sep 17 00:00:00 2001 From: Harshula Jayasuriya Date: Fri, 2 Aug 2024 19:46:33 +1000 Subject: [PATCH] CMakeLists.txt: generate a pkgconf pc file --- CMakeLists.txt | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5082a98e0..8bd34efac 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -458,3 +458,26 @@ install(EXPORT FMSExports NAMESPACE FMS:: FILE fms-targets.cmake DESTINATION ${CONFIG_INSTALL_DESTINATION}) + +# pkgconf +set(prefix ${CMAKE_INSTALL_PREFIX}) +set(exec_prefix ${CMAKE_INSTALL_PREFIX}) +set(libdir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}) +set(includedir ${CMAKE_INSTALL_PREFIX}/${includeDir}) + +set(CC ${CMAKE_C_COMPILER}) +set(FC ${CMAKE_Fortran_COMPILER}) +set(CFLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE}}") +set(CPPFLAGS "${CMAKE_CPP_FLAGS} ${CMAKE_CPP_FLAGS_${CMAKE_BUILD_TYPE}}") +set(FCFLAGS "${CMAKE_Fortran_FLAGS} ${CMAKE_Fortran_FLAGS_${CMAKE_BUILD_TYPE}}") +set(LDFLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${CMAKE_SHARED_LINKER_FLAGS_${CMAKE_BUILD_TYPE}}") + +set(VERSION ${PROJECT_VERSION}) +#set(LIBS ?) + +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/FMS.pc.in + ${CMAKE_CURRENT_BINARY_DIR}/FMS.pc @ONLY) + +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/FMS.pc + DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig + COMPONENT utilities)