Replace hardcoded opm-core name with variable

This commit is contained in:
Roland Kaufmann 2013-02-22 10:53:10 +01:00
parent e7e53cedbf
commit f472f2e8ef

View File

@ -2,15 +2,16 @@
# vim: set filetype=cmake autoindent tabstop=2 shiftwidth=2 noexpandtab softtabstop=2 nowrap:
# key information about the library
set (opm-core_NAME "opm-core")
set (opm-core_DESCRIPTION "Open Porous Media Initiative Core Library")
set (opm-core_DIR "opm")
set (opm-core_VERSION_MAJOR 1)
set (opm-core_VERSION_MINOR 0)
set (project "opm-core")
set (${project}_NAME "${project}")
set (${project}_DESCRIPTION "Open Porous Media Initiative Core Library")
set (${project}_DIR "opm")
set (${project}_VERSION_MAJOR 1)
set (${project}_VERSION_MINOR 0)
set (doxy_dir "Documentation")
# defines that must be present in config.h for our headers
set (opm-core_CONFIG_VAR
set (${project}_CONFIG_VAR
HAVE_AGMG
HAVE_DUNE_ISTL
HAVE_DYNAMIC_BOOST_TEST
@ -21,7 +22,7 @@ set (opm-core_CONFIG_VAR
)
# dependencies
set (opm-core_DEPS
set (${project}_DEPS
# compile with C99 support if available
"C99"
# compile with C++0x/11 support if available
@ -46,13 +47,13 @@ set (opm-core_DEPS
# C++ project
cmake_minimum_required (VERSION 2.8)
project (${opm-core_NAME})
project (${${project}_NAME})
enable_language (C)
enable_language (CXX)
# additional search modules
set (opm-core_MODULE_DIR "${PROJECT_SOURCE_DIR}/cmake/Modules")
list (APPEND CMAKE_MODULE_PATH ${opm-core_MODULE_DIR})
set (${project}_MODULE_DIR "${PROJECT_SOURCE_DIR}/cmake/Modules")
list (APPEND CMAKE_MODULE_PATH ${${project}_MODULE_DIR})
# print system information to better pinpoint issues from log alone
include (UseSystemInfo)
@ -65,12 +66,12 @@ vcs_info ()
# include special
if (CMAKE_VERSION VERSION_LESS "2.8.7")
message (STATUS "Enabling backward compatibility modules for CMake ${CMAKE_VERSION}")
list (APPEND CMAKE_MODULE_PATH "${opm-core_MODULE_DIR}/compat-2.8.7")
list (APPEND CMAKE_MODULE_PATH "${${project}_MODULE_DIR}/compat-2.8.7")
endif (CMAKE_VERSION VERSION_LESS "2.8.7")
# default settings: build static debug library
include (OpmDefaults)
opm_defaults (opm-core)
opm_defaults (${project})
message (STATUS "Build type: ${CMAKE_BUILD_TYPE}")
# use tricks to do faster builds
@ -81,11 +82,11 @@ include (UsePrecompHeaders)
# macro to set standard variables (INCLUDE_DIRS, LIBRARIES etc.)
include (OpmFind)
find_and_append_package_list_to (opm-core ${opm-core_DEPS})
find_and_append_package_list_to (${project} ${${project}_DEPS})
# remove the dependency on the testing framework from the main library;
# it is not possible to query for Boost twice with different components.
list (REMOVE_ITEM opm-core_LIBRARIES ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
list (REMOVE_ITEM ${project}_LIBRARIES ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
# don't import more libraries than we need to
include (UseOnlyNeeded)
@ -113,7 +114,7 @@ opm_auto_dirs ()
opm_out_dirs ()
# identify the compilation units in the library
opm_sources (opm-core)
opm_sources (${project})
# enumerate all testing programs in test/ directory
opm_find_tests ()
@ -193,11 +194,11 @@ endif (NOT HAVE_ERT)
# is required by this project alone, plural version transitively
# includes the necessary defines by the dependencies
include (ConfigVars)
list (APPEND opm-core_CONFIG_VARS ${opm-core_CONFIG_VAR})
list (APPEND ${project}_CONFIG_VARS ${${project}_CONFIG_VAR})
set (CONFIG_H "${PROJECT_BINARY_DIR}/config.h")
configure_vars (
FILE CXX ${CONFIG_H}
WRITE ${opm-core_CONFIG_VARS}
WRITE ${${project}_CONFIG_VARS}
)
include (UseFortranWrappers)
define_fc_func (
@ -206,24 +207,24 @@ define_fc_func (
# compile main library; pull in all required includes and libraries
include (OpmCompile)
opm_compile (opm-core)
opm_compile (${project})
# installation target: copy the library together with debug and
# configuration files to system directories
include (OpmInstall)
opm_install (opm-core)
opm_install (${project})
message (STATUS "This build defaults to installing in ${CMAKE_INSTALL_PREFIX}")
# installation of CMake modules to help user programs locate the library
include (OpmProject)
opm_cmake_config (opm-core)
opm_cmake_config (${project})
# routines to build satellites such as tests, tutorials and samples
include (OpmSatellites)
# tutorial programs are found in the tutorials/ directory
opm_compile_satellites (opm-core tutorial "" "")
opm_compile_satellites (opm-core examples "" "")
opm_compile_satellites (${project} tutorial "" "")
opm_compile_satellites (${project} examples "" "")
# infrastructure for testing
enable_testing ()
@ -245,7 +246,7 @@ cond_disable_test ("ERT")
# make datafiles necessary for tests available in output directory
opm_data (tests datafiles "${tests_DIR}" "*.xml")
opm_compile_satellites (opm-core tests "" "${tests_REGEXP}")
opm_compile_satellites (${project} tests "" "${tests_REGEXP}")
# use this target to run all tests
add_custom_target (check
@ -258,16 +259,16 @@ add_custom_target (check
# generate documentation from source code with Doxygen;
# setup install target for this documentation
include (OpmDoc)
opm_doc (opm-core ${doxy_dir})
opm_doc (${project} ${doxy_dir})
# provide compatibility with using this build in dunecontrol
include (DuneCompat)
include (LibtoolArchives)
configure_la (opm-core ${opm-core_TARGET} opm-core_LIBTOOL_ARCHIVE)
configure_la (${project} ${${project}_TARGET} ${project}_LIBTOOL_ARCHIVE)
### clean in-source builds ###
include (OpmDistClean)
opm_dist_clean (opm-core)
opm_dist_clean (${project})
# smart wrapper that auto-parallelizes builds
file (COPY