endforeach()
endforeach()
-
-########################################################################
-# #
-# pkgconfig files #
-# #
-########################################################################
-
-#
-# Set up the pkgconfig configuration files consisting of
-#
-# deal.II_debug # for the debug variant of the library
-# deal.II_release # for the release variant of the library
-#
-# Similarly to the CMake project configuration, we provide pkgconfig files
-# directly for the build directory, as well as for the final installation.
-# So we have to prepare two distinct setups.
-#
-# pkgconfig looks for *.pc files in an environmental variable called
-# PKG_CONFIG_PATH. So, to use the library in the build directory issue
-# export PKG_CONFIG_PATH=/path/to/BUILD_DIR/lib/pkgconfig:$PKG_CONFIG_PATH
-#
-# To use the library in the installed location
-# export PKG_CONFIG_PATH=/path/to/INSTALL_DIR/lib/pkgconfig:$PKG_CONFIG_PATH
-#
-
-#
-# We need to gather some variables for the regex below to work.
-#
-
-set(_library_prefixes "")
-if (CMAKE_SHARED_LIBRARY_PREFIX)
- list(APPEND _library_prefixes ${CMAKE_SHARED_LIBRARY_PREFIX})
-endif()
-if (CMAKE_STATIC_LIBRARY_PREFIX)
- list(APPEND _library_prefixes ${CMAKE_STATIC_LIBRARY_PREFIX})
-endif()
-string(REPLACE ";" "|" _library_prefixes "${_library_prefixes}")
-
-set(_library_suffixes "")
-if (CMAKE_SHARED_LIBRARY_SUFFIX)
- list(APPEND _library_suffixes ${CMAKE_SHARED_LIBRARY_SUFFIX})
-endif()
-if (CMAKE_STATIC_LIBRARY_SUFFIX)
- list(APPEND _library_suffixes ${CMAKE_STATIC_LIBRARY_SUFFIX})
-endif()
-string(REPLACE ";" "|" _library_suffixes "${_library_suffixes}")
-
-#
-# Build up the link line from our list of libraries:
-#
-
-foreach(_build ${DEAL_II_BUILD_TYPES})
- string(TOLOWER ${_build} _build_lowercase)
-
- set(_name "${DEAL_II_BASE_NAME}${DEAL_II_${_build}_SUFFIX}")
-
- set(CONFIG_RPATH_${_build}_PC "\\\${libdir}")
- set(CONFIG_LIBRARIES_${_build}_PC "-L\${libdir} -l${_name}")
-
- foreach(_lib ${DEAL_II_LIBRARIES_${_build}} ${DEAL_II_LIBRARIES})
-
- get_filename_component(_name ${_lib} NAME)
- get_filename_component(_dir ${_lib} PATH)
-
- if("${_dir}" STREQUAL "")
- # ${_lib} is a simple library name, just add it to the link line:
- set(_library_string "-l${_lib}")
-
- else()
- # ${_lib} is a full library path:
-
- #
- # Only append a library directory if it is new ...
- #
-
- list(FIND CONFIG_RPATH_${_build}_PC "${_dir}" _index)
- if (${_index} EQUAL -1)
- set(_library_string "-L${_dir} ")
- list(APPEND CONFIG_RPATH_${_build}_PC ${_dir})
- else()
- set(_library_string "")
- endif()
-
- # Recover short name:
- if(_library_prefixes)
- string(REGEX REPLACE "^(${_library_prefixes})" "" _name "${_name}")
- endif()
- if(_library_suffixes)
- string(REGEX REPLACE "(${_library_suffixes})$" "" _name "${_name}")
- endif()
- set(_library_string "${_library_string}-l${_name}")
- endif()
-
- set(CONFIG_LIBRARIES_${_build}_PC
- "${CONFIG_LIBRARIES_${_build}_PC} ${_library_string}"
- )
- endforeach()
-
- to_string_and_add_prefix(CONFIG_RPATH_${_build}_PC
- "-Wl,-rpath," ${CONFIG_RPATH_${_build}_PC}
- )
-endforeach()
-
-
-#
-# For binary dir (aka build dir):
-#
-
-set(CONFIG_PATH_PC "${CMAKE_BINARY_DIR}")
-
-to_string_and_add_prefix(CONFIG_INCLUDE_DIRS_PC "-I"
- \\\${prefix}/include
- ${CMAKE_SOURCE_DIR}/include
- ${DEAL_II_BUNDLED_INCLUDE_DIRS}
- ${DEAL_II_INCLUDE_DIRS}
- )
-
-foreach(_build ${DEAL_II_BUILD_TYPES})
- string(TOLOWER ${_build} _build_lowercase)
-
- set(_config_directory "${CMAKE_BINARY_DIR}/${DEAL_II_PKGCONF_RELDIR}")
-
- configure_file(
- ${CMAKE_CURRENT_SOURCE_DIR}/config_${_build_lowercase}.pc.in
- ${_config_directory}/${DEAL_II_PROJECT_CONFIG_NAME}_${_build_lowercase}.pc
- @ONLY
- )
-endforeach()
-
-#
-# For installation:
-#
-
-set(CONFIG_PATH_PC "${CMAKE_INSTALL_PREFIX}")
-
-to_string_and_add_prefix(CONFIG_INCLUDE_DIRS_PC "-I"
- \\\${includedir}
- ${DEAL_II_BUNDLED_INCLUDE_DIRS}
- ${DEAL_II_INCLUDE_DIRS}
- )
-
-foreach(_build ${DEAL_II_BUILD_TYPES})
- string(TOLOWER ${_build} _build_lowercase)
-
- #
- # Only populate the pkgconf files for the install directory if
- # CMAKE_INSTALL_RPATH_USE_LINK_PATH is true.
- #
- # We use this a heuristic for now to decide whether the user actually
- # wants to have RPATHs in configuration files after installation.
- #
- # FIXME: Unify RPATH handling between cmake and pkgconf configuration and
- # clearly document RPATH behavior.
- #
- if(NOT CMAKE_INSTALL_RPATH_USE_LINK_PATH)
- set(CONFIG_RPATH_${_build}_PC "")
- endif()
-
- configure_file(
- ${CMAKE_CURRENT_SOURCE_DIR}/config_${_build_lowercase}.pc.in
- ${CMAKE_CURRENT_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_NAME}_${_build_lowercase}.pc
- @ONLY
- )
- install(FILES
- ${CMAKE_CURRENT_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_NAME}_${_build_lowercase}.pc
- DESTINATION ${DEAL_II_PKGCONF_RELDIR}
- COMPONENT library
- )
-endforeach()
-
#
# Job's done.
#