From 988005a71ef0bfcbfe1abe82ff3df1ab55ca8750 Mon Sep 17 00:00:00 2001 From: ifilot Date: Mon, 25 Dec 2023 13:01:24 +0100 Subject: [PATCH] Adding pkg-config file --- .gitignore | 1 + src/CMakeLists.txt | 8 +++++++- src/den2obj.pc.in | 12 ++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 src/den2obj.pc.in diff --git a/.gitignore b/.gitignore index 395d6f4..876e008 100644 --- a/.gitignore +++ b/.gitignore @@ -31,6 +31,7 @@ build/* CHGCAR* *.png src/config.h +src/den2obj.pc # do not save doc build docs/_build/ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 339e33a..5256b57 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -55,6 +55,7 @@ SET(VERSION_MINOR "2") SET(VERSION_MICRO "0") message(STATUS "Writing configuration file in: ${CMAKE_CURRENT_SOURCE_DIR}/config.h") configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_SOURCE_DIR}/config.h @ONLY) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/den2obj.pc.in ${CMAKE_BINARY_DIR}/den2obj.pc @ONLY) # Enable release build if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) @@ -147,7 +148,12 @@ endif() # Installing ## include(GNUInstallDirs) + +# install shared library and header files install (TARGETS den2obj DESTINATION bin LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/den2obj) \ No newline at end of file + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/den2obj) + +# install pkg-config files +install(FILES ${CMAKE_BINARY_DIR}/den2obj.pc DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig) \ No newline at end of file diff --git a/src/den2obj.pc.in b/src/den2obj.pc.in new file mode 100644 index 0000000..0b2cd7c --- /dev/null +++ b/src/den2obj.pc.in @@ -0,0 +1,12 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=@CMAKE_INSTALL_PREFIX@ +libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@ +includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ + +Name: @PROJECT_NAME@ +Description: @PROJECT_DESCRIPTION@ +Version: @VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_MICRO@ + +Requires: +Libs: -L${libdir} -lden2obj +Cflags: -I${includedir} \ No newline at end of file