Write snapshot of probes to config-mode module
Put everything the user needs to link to the opm-core library into the config-mode file, including result of probes. If this conflicts with other packages, that is a configuration issue that must be resolved anyway. The advantage of doing it like this is that the user can build against the library without knowing how it was configured; the only thing that must be provided is the path to the config-mode module!
This commit is contained in:
parent
8234959abe
commit
2d3ed1cc27
@ -125,6 +125,10 @@ configure_file (
|
||||
${PROJECT_BINARY_DIR}/opm-core-config.cmake
|
||||
@ONLY
|
||||
)
|
||||
configure_vars (
|
||||
FILE CMAKE "${PROJECT_BINARY_DIR}/opm-core-config.cmake"
|
||||
APPEND "${opm-core_CONFIG_VARS}"
|
||||
)
|
||||
|
||||
### test programs ###
|
||||
|
||||
|
@ -5,34 +5,41 @@
|
||||
# opm-core_VERSION - version of the opm-core library found, e.g. 0.2
|
||||
# opm-core_DEFINITIONS - defines to be made on the command line
|
||||
# opm-core_INCLUDE_DIRS - header directories with which to compile
|
||||
# opm-core_LINKER_FLAGS - flags that must be passed to the linker
|
||||
# opm-core_LIBRARIES - names of the libraries with which to link
|
||||
# opm-core_CONFIG_VARS - defines that must be written to config.h
|
||||
# opm-core_LIBRARY_DIRS - directories in which the libraries are situated
|
||||
#
|
||||
# You should put lines like this in your CMakeLists.txt
|
||||
# set (opm-core_DIR "../opm-core" CACHE LOCATION "Build tree of opm-core")
|
||||
# set (opm-core_DIR "${PROJECT_BINARY_DIR}/../opm-core" CACHE LOCATION "Build tree of opm-core")
|
||||
# find_package (opm-core)
|
||||
# configure_vars (
|
||||
# FILE CXX "${PROJECT_BINARY_DIR}/config.h"
|
||||
# WRITE ${opm-core_CONFIG_VARS}
|
||||
# )
|
||||
|
||||
# <http://www.vtk.org/Wiki/CMake/Tutorials/How_to_create_a_ProjectConfig.cmake_file>
|
||||
|
||||
# propagate this property from one build system to the other
|
||||
# propagate these properties from one build system to the other
|
||||
set (opm-core_VERSION "@opm-core_VERSION@")
|
||||
|
||||
# these definitions may be necessary to make the header files behave the
|
||||
# same way as they did when the library was compiled
|
||||
set (opm-core_DEFINITIONS "@opm-core_DEFINITIONS@")
|
||||
set (opm-core_INCLUDE_DIRS "@opm-core_INCLUDE_DIRS@")
|
||||
set (opm-core_LIBRARY_DIRS "@CMAKE_LIBRARY_OUTPUT_DIRECTORY@")
|
||||
set (opm-core_LINKER_FLAGS "@opm-core_LINKER_FLAGS@")
|
||||
set (opm-core_CONFIG_VARS "@opm-core_CONFIG_VARS@")
|
||||
|
||||
# include files come from the source tree where the template is stored
|
||||
set (opm-core_INCLUDE_DIRS "@opm-core_INCLUDE_DIRS@")
|
||||
|
||||
# libraries come from the build tree where this file was generated
|
||||
find_library (opm-core_LOCATION NAMES "opmcore" PATHS "@CMAKE_LIBRARY_OUTPUT_DIRECTORY@")
|
||||
mark_as_advanced (opm-core_LOCATION)
|
||||
set (opm-core_LIBRARY "@opm-core_LIBRARY@")
|
||||
set (opm-core_LIBRARIES ${opm-core_LIBRARY} "@opm-core_LIBRARIES@")
|
||||
mark_as_advanced (opm-core_LIBRARY)
|
||||
|
||||
# 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 (opmcore UNKNOWN IMPORTED)
|
||||
set_property (TARGET opmcore PROPERTY IMPORTED_LOCATION "${opm-core_LOCATION}")
|
||||
set_property (TARGET opmcore PROPERTY IMPORTED_LOCATION "${opm-core_LIBRARY}")
|
||||
|
||||
# user programs should link with this library (see comment in the header)
|
||||
set (opm-core_LIBRARIES "${opm-core_LOCATION};@opm-core_LIBRARIES@")
|
||||
# ensure that we build with support for C++11 to preserve ABI
|
||||
string (REPLACE "@CXX_STD0X_FLAGS@" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
string (STRIP "${CMAKE_CXX_FLAGS}" CMAKE_CXX_FLAGS)
|
||||
set (CMAKE_CXX_FLAGS "@CXX_STD0X_FLAGS@ ${CMAKE_CXX_FLAGS}")
|
||||
|
||||
# this is the contents of config.h as far as our probes can tell:
|
||||
|
Loading…
Reference in New Issue
Block a user