Skip to content

Commit

Permalink
help pkgconfig file paths
Browse files Browse the repository at this point in the history
  • Loading branch information
loriab committed Jan 21, 2022
1 parent 6ba89f8 commit 1574ad2
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cmake/libint2.pc.cmake.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=@CMAKE_INSTALL_PREFIX@
libdir=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@
includedir=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@
libdir=@libdir_for_pc_file@
includedir=@includedir_for_pc_file@

Name: libint2
Description: a library for the evaluation of molecular integrals of many-body operators over Gaussian functions
Expand Down
23 changes: 23 additions & 0 deletions cmake/modules/JoinPaths.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# This module provides function for joining paths
# known from most languages
#
# SPDX-License-Identifier: (MIT OR CC0-1.0)
# Copyright 2020 Jan Tojnar
# https://github.com/jtojnar/cmake-snips
#
# Modelled after Python’s os.path.join
# https://docs.python.org/3.7/library/os.path.html#os.path.join
# Windows not supported
function(join_paths joined_path first_path_segment)
set(temp_path "${first_path_segment}")
foreach(current_segment IN LISTS ARGN)
if(NOT ("${current_segment}" STREQUAL ""))
if(IS_ABSOLUTE "${current_segment}")
set(temp_path "${current_segment}")
else()
set(temp_path "${temp_path}/${current_segment}")
endif()
endif()
endforeach()
set(${joined_path} "${temp_path}" PARENT_SCOPE)
endfunction()
4 changes: 4 additions & 0 deletions src/lib/libint/CMakeLists.txt.export
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,10 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${pnv}-config.cmake
${CMAKE_CURRENT_BINARY_DIR}/${pnv}-config-version.cmake
DESTINATION ${LIBINT2_INSTALL_CMAKEDIR})

include(JoinPaths)
join_paths(libdir_for_pc_file "\${exec_prefix}" "${CMAKE_INSTALL_LIBDIR}")
join_paths(includedir_for_pc_file "\${prefix}" "${CMAKE_INSTALL_INCLUDEDIR}")

configure_file(cmake/libint2.pc.cmake.in libint2.pc @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libint2.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig/)
Expand Down
1 change: 1 addition & 0 deletions src/lib/libint/populate.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ file(INSTALL "${PROJECT_SOURCE_DIR}/cmake/modules/autocmake_safeguards.cmake"
"${PROJECT_SOURCE_DIR}/cmake/modules/FindMPFR.cmake"
"${PROJECT_SOURCE_DIR}/cmake/modules/AddCustomTargetSubproject.cmake"
"${PROJECT_SOURCE_DIR}/cmake/modules/FindTargetEigen3.cmake"
"${PROJECT_SOURCE_DIR}/cmake/modules/JoinPaths.cmake"
"${PROJECT_BINARY_DIR}/cmake/modules/int_computed.cmake"
DESTINATION "${EXPORT_STAGE_DIR}/cmake/modules")

Expand Down

0 comments on commit 1574ad2

Please sign in to comment.