From 5ed1aa37f0a91e2747635097c462dcbd1789941e Mon Sep 17 00:00:00 2001 From: Roland Kaufmann Date: Fri, 25 Jan 2013 21:16:47 +0100 Subject: [PATCH] Move writing of config module to library routine --- CMakeLists.txt | 27 +++------------------------ cmake/Modules/OpmProject.cmake | 23 ++++++++++++++++++++++- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 247bdd62..119d8d9c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/cmake/Modules/OpmProject.cmake b/cmake/Modules/OpmProject.cmake index a763831c..abe57878 100644 --- a/cmake/Modules/OpmProject.cmake +++ b/cmake/Modules/OpmProject.cmake @@ -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}"