From 4e38655e0e9984e2c913de0327f60a92f51f916d Mon Sep 17 00:00:00 2001 From: chillenb Date: Wed, 25 Feb 2026 21:05:38 -0500 Subject: [PATCH 1/2] CMake and pkg-config boilerplate --- CMakeLists.txt | 60 +++++++++++++++++++++++++++++++++++++-- cmake/cint.pc.in | 11 +++++++ cmake/cintConfig.cmake.in | 7 +++++ 3 files changed, 76 insertions(+), 2 deletions(-) create mode 100644 cmake/cint.pc.in create mode 100644 cmake/cintConfig.cmake.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 26a15201..afe8c2fe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -187,11 +187,67 @@ if(QUADMATH_FOUND) endif() target_link_libraries(cint "-lm") +# for consistency between FetchContent / add_subdirectory +# and find_package, so one can always link to cint::cint. +add_library(cint::cint ALIAS cint) - -install(TARGETS cint COMPONENT "lib") +# install headers install(FILES ${CintHeaders} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} COMPONENT "dev") +# install the library and associate the installed targets +# with export set "cint-targets" +install(TARGETS cint + EXPORT cint-targets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} +) + +# generate cintTargets.cmake and prepend the namespace "cint::" +# to exported targets. +export(EXPORT cint-targets + FILE ${CMAKE_CURRENT_BINARY_DIR}/cintTargets.cmake + NAMESPACE cint:: +) + +# install cintTargets.cmake and associate this file with +# the export set "cint-targets" +install(EXPORT cint-targets + FILE cintTargets.cmake + NAMESPACE cint:: + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/cint +) + +include(CMakePackageConfigHelpers) + +# configure cintConfig.cmake +configure_package_config_file(${PROJECT_SOURCE_DIR}/cmake/cintConfig.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/cintConfig.cmake + INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/cint) + +# generate cintConfigVersion.cmake +write_basic_package_version_file( + "${CMAKE_CURRENT_BINARY_DIR}/cintConfigVersion.cmake" + VERSION ${cint_VERSION} + COMPATIBILITY SameMajorVersion +) + +# and install both of these two files... +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/cintConfig.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/cintConfigVersion.cmake" + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/cint +) + +# configure the pkg-config file... +configure_file(${PROJECT_SOURCE_DIR}/cmake/cint.pc.in + ${CMAKE_CURRENT_BINARY_DIR}/cint.pc @ONLY) + +# and install it. +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/cint.pc" + DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig +) + if(ENABLE_EXAMPLE) enable_language(Fortran) diff --git a/cmake/cint.pc.in b/cmake/cint.pc.in new file mode 100644 index 00000000..4eb9f701 --- /dev/null +++ b/cmake/cint.pc.in @@ -0,0 +1,11 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=${prefix} +includedir=${prefix}/include +libdir=${exec_prefix}/lib + +Name: libcint +Description: Open source library for analytical Gaussian integrals. +Requires: +Version: @cint_VERSION@ +Libs: -L${libdir} -lcint +Cflags: -I${includedir} diff --git a/cmake/cintConfig.cmake.in b/cmake/cintConfig.cmake.in new file mode 100644 index 00000000..a091e410 --- /dev/null +++ b/cmake/cintConfig.cmake.in @@ -0,0 +1,7 @@ +@PACKAGE_INIT@ + +check_required_components("@PROJECT_NAME@") + +include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake") + +include(CMakeFindDependencyMacro) From 00c35a229729549a226a871c6aeef78a902950b5 Mon Sep 17 00:00:00 2001 From: chillenb Date: Sat, 28 Feb 2026 22:55:03 -0500 Subject: [PATCH 2/2] add cint_funcs.h to interface include directories --- CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index afe8c2fe..a2dd2e97 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -172,6 +172,8 @@ target_include_directories(cint PUBLIC $ $ + INTERFACE + $ PRIVATE ${PROJECT_BINARY_DIR}/src ${PROJECT_SOURCE_DIR}/src