From 14b6812cb2ce8c9c997997ee4241269c8e79c58b Mon Sep 17 00:00:00 2001 From: Roland Kaufmann Date: Fri, 19 Oct 2012 14:14:15 +0200 Subject: [PATCH] Provide CMake config mode files for custom builds Client programs/libraries that uses CMake as their build system should be able to point at the directory of a OPM-core build tree and have its library picked up from there. --- .gitignore | 1 + configure.ac | 1 + opmcore-config.cmake.in | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+) create mode 100644 opmcore-config.cmake.in diff --git a/.gitignore b/.gitignore index a3a8f8a4..c58e004e 100644 --- a/.gitignore +++ b/.gitignore @@ -32,6 +32,7 @@ m4/lt*.m4 missing ar-lib tutorials/tutorial[1-4] +opmcore-config.cmake # Ignoring executables *_test diff --git a/configure.ac b/configure.ac index 4644d349..856a9920 100644 --- a/configure.ac +++ b/configure.ac @@ -58,6 +58,7 @@ AC_CONFIG_FILES([ tutorials/Makefile opm-core.pc lib/pkgconfig/opm-core.pc + opmcore-config.cmake ]) AC_OUTPUT diff --git a/opmcore-config.cmake.in b/opmcore-config.cmake.in new file mode 100644 index 00000000..ccb96417 --- /dev/null +++ b/opmcore-config.cmake.in @@ -0,0 +1,36 @@ +# - Open Porous Media Initiative Core Library config mode +# +# Defines the following variables: +# @PACKAGE@_FOUND - true +# @PACKAGE@_VERSION - version of the opm-core library found, e.g. 0.2 +# @PACKAGE@_DEFINITIONS - defines to be made on the command line +# @PACKAGE@_INCLUDE_DIRS - include directories to be included in build +# @PACKAGE@_LIBRARIES - library directories to be included in build +# +# You should put lines like this in your CMakeLists.txt +# set (@PACKAGE@_DIR "../@PACKAGE@" CACHE LOCATION "Build tree of @PACKAGE_NAME@") +# find_package (@PACKAGE@) + +# + +# propagate this property from one build system to the other +set (@PACKAGE@_VERSION @PACKAGE_VERSION@) + +# these definitions may be necessary to make the header files behave the +# same way as they did when the library was compiled +set (@PACKAGE@_DEFINITIONS "@OPM_BOOST_CPPFLAGS@ @SUPERLU_CPPFLAGS@ @ERT_CPPFLAGS@") + +# include files come from the source tree where the template is stored +set (@PACKAGE@_INCLUDE_DIRS "@abs_top_srcdir@") + +# user programs should link with this library (see comment in the header) +set (@PACKAGE@_LIBRARIES "@PACKAGE@") + +# libraries come from the build tree where this file was generated +find_library (@PACKAGE@_LOCATION NAMES "@PACKAGE@" PATHS "@abs_top_builddir@/lib/.libs") +mark_as_advanced (@PACKAGE@_LOCATION) + +# add the library as a target, so that other things in the project including +# this file may depend on it and get rebuild if this library changes. +add_library (@PACKAGE@ UNKNOWN IMPORTED) +set_property (TARGET @PACKAGE@ PROPERTY IMPORTED_LOCATION "${@PACKAGE@_LOCATION}")