Move writing of config module to library routine

This commit is contained in:
Roland Kaufmann 2013-01-25 21:16:47 +01:00
parent 18a6f709b0
commit 5ed1aa37f0
2 changed files with 25 additions and 25 deletions

View File

@ -211,30 +211,6 @@ target_link_libraries (opmcore ${opm-core_LIBRARIES})
# queue this executable to be stripped
strip_debug_symbols (opmcore opm-core_DEBUG)
# we need to know the name of the library which is generated
get_target_property (opm-core_LIBRARY opmcore LOCATION)
# write configuration file to locate library
configure_file (
${PROJECT_SOURCE_DIR}/opm-core-config.cmake.in
${PROJECT_BINARY_DIR}/opm-core-config.cmake
@ONLY
)
configure_file (
${PROJECT_SOURCE_DIR}/opm-core-config-version.cmake.in
${PROJECT_BINARY_DIR}/opm-core-config-version.cmake
@ONLY
)
configure_vars (
FILE CMAKE "${PROJECT_BINARY_DIR}/opm-core-config.cmake"
APPEND "${opm-core_CONFIG_VARS}"
)
configure_file (
${PROJECT_SOURCE_DIR}/dune.module.in
${PROJECT_BINARY_DIR}/dune.module
@ONLY
)
# pre-compile common headers; this is setup *after* the library to pick
# up extra options set there
option (PRECOMPILE_HEADERS "Precompile common headers for speed." ON)
@ -284,6 +260,9 @@ install (
)
message (STATUS "This build defaults to installing in ${CMAKE_INSTALL_PREFIX}")
# we need to know the name of the library which is generated
get_target_property (opm-core_LIBRARY opmcore LOCATION)
# installation of CMake modules to help user programs locate the library
include (OpmProject)
opm_cmake_config (opm-core)

View File

@ -2,7 +2,28 @@
# installation of CMake modules to help user programs locate the library
function (opm_cmake_config name)
# replace the build directory with the target directory in the
# write configuration file to locate library
configure_file (
${PROJECT_SOURCE_DIR}/${name}-config.cmake.in
${PROJECT_BINARY_DIR}/${name}-config.cmake
@ONLY
)
configure_file (
${PROJECT_SOURCE_DIR}/${name}-config-version.cmake.in
${PROJECT_BINARY_DIR}/${name}-config-version.cmake
@ONLY
)
configure_vars (
FILE CMAKE "${PROJECT_BINARY_DIR}/${name}-config.cmake"
APPEND "${${name}_CONFIG_VARS}"
)
configure_file (
${PROJECT_SOURCE_DIR}/dune.module.in
${PROJECT_BINARY_DIR}/dune.module
@ONLY
)
# replace the build directory with the target directory in the
# variables that contains build paths
string (REPLACE
"${PROJECT_SOURCE_DIR}"