Commit c27ad854 authored by Christoph Grueninger's avatar Christoph Grueninger
Browse files

[CMake] Overhaul CMake files to support modules depending on dumux.

(reviewed by bernd)


git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@11551 2fb0f335-1f38-0410-981e-8018bf24f1b0
parent 4593cc40
......@@ -4,6 +4,14 @@ project("dumux" C CXX)
# general stuff
cmake_minimum_required(VERSION 2.8.6)
if(NOT (dune-common_DIR
OR dune-common_ROOT
OR "${CMAKE_PREFIX_PATH}" MATCHES ".*dune-common.*"))
string(REPLACE ${CMAKE_PROJECT_NAME}
dune-common dune-common_DIR
${PROJECT_BINARY_DIR})
endif()
#find dune-common and set the module path
find_package(dune-common)
list(APPEND CMAKE_MODULE_PATH ${dune-common_MODULE_PATH}
......@@ -17,6 +25,7 @@ dune_project()
#add_subdirectory("m4")
#add_subdirectory("dumux")
#add_subdirectory("doc")
add_subdirectory("cmake/modules")
add_subdirectory("test")
add_subdirectory("tutorial")
......
set(modules
CheckAlwaysInline.cmake
CheckConstexpr.cmake
CheckPatchedPDELab.cmake
DumuxMacros.cmake
DumuxTestMacros.cmake)
include(GNUInstallDirs)
install(FILES ${modules} DESTINATION ${DUNE_INSTALL_MODULEDIR})
# checks
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/CheckAlwaysInline.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/CheckConstexpr.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/CheckPatchedPDELab.cmake)
include(CheckAlwaysInline)
include(CheckConstexpr)
include(CheckPatchedPDELab)
# additional macros
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/DumuxTestMacros.cmake)
include(DumuxTestMacros)
if(NOT @DUNE_MOD_NAME@_FOUND)
#compute installation prefix relative to this file
get_filename_component(_dir "${CMAKE_CURRENT_LIST_FILE}" PATH)
get_filename_component(_prefix "${_dir}/../../.." ABSOLUTE)
#compute installation prefix relative to this file
get_filename_component(_dir "${CMAKE_CURRENT_LIST_FILE}" PATH)
get_filename_component(_prefix "${_dir}/../../.." ABSOLUTE)
#import the target
if(EXISTS "${_prefix}/lib/cmake/@DUNE_MOD_NAME@-targets.cmake")
include("${_prefix}/lib/cmake/@DUNE_MOD_NAME@-targets.cmake")
endif(EXISTS "${_prefix}/lib/cmake/@DUNE_MOD_NAME@-targets.cmake")
#import the target
if(EXISTS "${_prefix}/lib/cmake/@DUNE_MOD_NAME@-targets.cmake")
include("${_prefix}/lib/cmake/@DUNE_MOD_NAME@-targets.cmake")
endif(EXISTS "${_prefix}/lib/cmake/@DUNE_MOD_NAME@-targets.cmake")
#report other information
set(@DUNE_MOD_NAME@_PREFIX "${_prefix}")
set(@DUNE_MOD_NAME@_INCLUDE_DIRS "${_prefix}/include")
set(@DUNE_MOD_NAME@_CXX_FLAGS "@CMAKE_CXX_FLAGS@")
set(@DUNE_MOD_NAME@_CXX_FLAGS_DEBUG "@CMAKE_CXX_FLAGS_DEBUG@")
set(@DUNE_MOD_NAME@_CXX_FLAGS_MINSIZEREL "@CMAKE_CXX_FLAGS_MINSIZEREL@")
set(@DUNE_MOD_NAME@_CXX_FLAGS_RELEASE "@CMAKE_CXX_FLAGS_RELEASE@")
set(@DUNE_MOD_NAME@_CXX_FLAGS_RELWITHDEBINFO "@CMAKE_CXX_FLAGS_RELWITHDEBINFO@")
set(@DUNE_MOD_NAME@_LIBRARIES "")
set(@DUNE_MOD_NAME@_DEPENDS "@DUNE_DEPENDS@")
set(@DUNE_MOD_NAME@_SUGGESTS "@DUNE_SUGGESTS@")
set(@DUNE_MOD_NAME@_MODULE_PATH "@DUNE_INSTALL_MODULEDIR@")
#report other information
set(@DUNE_MOD_NAME@_PREFIX "${_prefix}")
set(@DUNE_MOD_NAME@_INCLUDE_DIRS "${_prefix}/include")
set(@DUNE_MOD_NAME@_CXX_FLAGS "@CMAKE_CXX_FLAGS@")
set(@DUNE_MOD_NAME@_CXX_FLAGS_DEBUG "@CMAKE_CXX_FLAGS_DEBUG@")
set(@DUNE_MOD_NAME@_CXX_FLAGS_MINSIZEREL "@CMAKE_CXX_FLAGS_MINSIZEREL@")
set(@DUNE_MOD_NAME@_CXX_FLAGS_RELEASE "@CMAKE_CXX_FLAGS_RELEASE@")
set(@DUNE_MOD_NAME@_CXX_FLAGS_RELWITHDEBINFO "@CMAKE_CXX_FLAGS_RELWITHDEBINFO@")
set(@DUNE_MOD_NAME@_LIBRARIES "")
set(@DUNE_MOD_NAME@_DEPENDS "@DUNE_DEPENDS@")
set(@DUNE_MOD_NAME@_SUGGESTS "@DUNE_SUGGESTS@")
set(@DUNE_MOD_NAME@_MODULE_PATH "@DUNE_INSTALL_MODULEDIR@")
endif(NOT @DUNE_MOD_NAME@_FOUND)
if(NOT @DUNE_MOD_NAME@_FOUND)
#compute installation prefix relative to this file
get_filename_component(_dir "${CMAKE_CURRENT_LIST_FILE}" PATH)
get_filename_component(_prefix "${_dir}/../../.." ABSOLUTE)
#import the target
#include("@CMAKE_BINARY_DIR@/@DUNE_MOD_NAME@-targets.cmake")
#import the target
if(EXISTS "@CMAKE_BINARY_DIR@/@DUNE_MOD_NAME@-targets.cmake")
include("@CMAKE_BINARY_DIR@/@DUNE_MOD_NAME@-targets.cmake")
endif(EXISTS "@CMAKE_BINARY_DIR@/@DUNE_MOD_NAME@-targets.cmake")
#report other information
set(@DUNE_MOD_NAME@_PREFIX "${_prefix}")
set(@DUNE_MOD_NAME@_INCLUDE_DIRS "${_prefix}/include")
set(@DUNE_MOD_NAME@_CXX_FLAGS "@CMAKE_CXX_FLAGS@")
set(@DUNE_MOD_NAME@_CXX_FLAGS_DEBUG "@CMAKE_CXX_FLAGS_DEBUG@")
set(@DUNE_MOD_NAME@_CXX_FLAGS_MINSIZEREL "@CMAKE_CXX_FLAGS_MINSIZEREL@")
set(@DUNE_MOD_NAME@_CXX_FLAGS_RELEASE "@CMAKE_CXX_FLAGS_RELEASE@")
set(@DUNE_MOD_NAME@_CXX_FLAGS_RELWITHDEBINFO "@CMAKE_CXX_FLAGS_RELWITHDEBINFO@")
set(@DUNE_MOD_NAME@_LIBRARIES "")
set(@DUNE_MOD_NAME@_DEPENDS "@DUNE_DEPENDS@")
set(@DUNE_MOD_NAME@_SUGGESTS "@DUNE_SUGGESTS@")
set(@DUNE_MOD_NAME@_MODULE_PATH "@DUNE_INSTALL_MODULEDIR@")
#report other information
set(@DUNE_MOD_NAME@_PREFIX "@CMAKE_SOURCE_DIR@")
set(@DUNE_MOD_NAME@_INCLUDE_DIRS "@CMAKE_SOURCE_DIR@")
set(@DUNE_MOD_NAME@_CXX_FLAGS "@CMAKE_CXX_FLAGS@")
set(@DUNE_MOD_NAME@_CXX_FLAGS_DEBUG "@CMAKE_CXX_FLAGS_DEBUG@")
set(@DUNE_MOD_NAME@_CXX_FLAGS_MINSIZEREL "@CMAKE_CXX_FLAGS_MINSIZEREL@")
set(@DUNE_MOD_NAME@_CXX_FLAGS_RELEASE "@CMAKE_CXX_FLAGS_RELEASE@")
set(@DUNE_MOD_NAME@_CXX_FLAGS_RELWITHDEBINFO "@CMAKE_CXX_FLAGS_RELWITHDEBINFO@")
set(@DUNE_MOD_NAME@_LIBRARIES "")
set(@DUNE_MOD_NAME@_DEPENDS "@DUNE_DEPENDS@")
set(@DUNE_MOD_NAME@_SUGGESTS "@DUNE_SUGGESTS@")
set(@DUNE_MOD_NAME@_MODULE_PATH "@CMAKE_SOURCE_DIR@/cmake/modules")
endif(NOT @DUNE_MOD_NAME@_FOUND)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment