From 13de1f18f0ddf7bc25ab0da6ed40b89184e0f5dc Mon Sep 17 00:00:00 2001 From: maier Date: Fri, 21 Sep 2012 10:21:02 +0000 Subject: [PATCH] Overhaul git-svn-id: https://svn.dealii.org/branches/branch_cmake@26585 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/CMakeLists.txt | 67 ++++++++++++------- deal.II/contrib/cmake/setup_deal_ii.cmake | 12 ++-- deal.II/contrib/config/deal.IIConfig.cmake.in | 55 +++++++++++++++ .../config/deal.IIConfigVersion.cmake.in | 17 +++++ 4 files changed, 122 insertions(+), 29 deletions(-) create mode 100644 deal.II/contrib/config/deal.IIConfig.cmake.in create mode 100644 deal.II/contrib/config/deal.IIConfigVersion.cmake.in diff --git a/deal.II/CMakeLists.txt b/deal.II/CMakeLists.txt index 39398abbbc..137bc1bded 100644 --- a/deal.II/CMakeLists.txt +++ b/deal.II/CMakeLists.txt @@ -100,6 +100,7 @@ SET(VERSION "8.0.pre") # - Explain Components and Options... # - Explain how to build and install only a specific component: # +# $ make # $ cmake -DCOMPONENT= -P build/cmake_install.cmake # @@ -224,6 +225,13 @@ OPTION(DEAL_II_INSTALL_COMPAT_FILES This feature adds a COMPONENT \"compat_files\" to the build system." ON) +OPTION(DEAL_II_INSTALL_PROJECT_CONFIG + "Enable the installation of a cmake project config. Useful for + autodetection ( FIND_PACKAGE(DEAL_II) ) of the deal.II library out of + cmake build systems. + This feature adds a COMPONENT \"project_config\" to the build system." + ON) + ########################################################################### # # @@ -260,10 +268,11 @@ INCLUDE(setup_external_macros) # # We have to initialize some cached variables before PROJECT is called, so -# go it at this point: +# do it at this point: # INCLUDE(setup_cached_variables) + # # Now, set the project and setup the rest: # @@ -274,28 +283,40 @@ INCLUDE(setup_deal_ii) INCLUDE(setup_compiler_flags) -# -# #################### -# # FAT NOTE: # -# #################### +# #################### +# # FAT NOTE: # +# #################### # # To keep things clean, only the following cmake variables should be # altered in the platform checks and features configuration # (beside setting a lot of DEAL_II_* definitions...): # -# CMAKE_SHARED_LINKER_FLAGS -# for setting necessary linker flags for the deal.II library. +# For internal use: +# +# CMAKE_SHARED_LINKER_FLAGS +# for setting necessary linker flags for the deal.II library. +# +# CMAKE_CXX_FLAGS (and CMAKE_C_FLAGS) +# for setting necessary compiler flags, e.g. -std=c++11 (if +# available). # -# CMAKE_C_FLAGS and CMAKE_CXX_FLAGS (<...>_RELEASE, <...>_DEBUG) -# for setting necessary compiler flags, e.g. -std=c++11 (if available). + ADD_CUSTOM_TARGET(deal_ii_target_dependencies) +# Used as a dummy target for all the stuff that has to be done +# before the library can be compiled. # - ADD_CUSTOM_TARGET(deal_ii_target_dependencies) -# Used as a dummy target for all the stuff that has to be done before the -# library can be compiled. # - SET(deal_ii_external_libraries) -# Used to keep track of external libraries, against which the deal.II -# library (and user programs) will be linked. +# For internal and external use: +# + SET(deal_ii_external_libraries) +# Used to keep track of external libraries, the deal.II library and +# user programs have to be linked against. +# +# +# For external use: +# +# CMAKE_EXTERNAL_INCLUDE_DIRS +# Used to keep track of external include dirs, necessary for the +# compilation of user programs. # @@ -313,11 +334,9 @@ ENDFOREACH() # Feature configuration: # FILE(GLOB configure_files "contrib/cmake/configure/configure_*.cmake") - # Make sure the configure_*.cmake files are included in alphabetical order # to fullfill some dependencies... LIST(SORT configure_files) - FOREACH(file ${configure_files}) MESSAGE(STATUS "Include ${file}") INCLUDE(${file}) @@ -342,21 +361,21 @@ INCLUDE(setup_finalize) # # Build the toolchain and prepare the includes: # -ADD_SUBDIRECTORY(contrib/config) ADD_SUBDIRECTORY(contrib/expand_instantiations) ADD_SUBDIRECTORY(include) +# +# Compile and install the library: +# +ADD_SUBDIRECTORY(source) + # # Prepare some directories for installation: # +ADD_SUBDIRECTORY(contrib/config) # has to be included after source ADD_SUBDIRECTORY(doc) -ADD_SUBDIRECTORY(scripts) ADD_SUBDIRECTORY(examples) +ADD_SUBDIRECTORY(scripts) -# -# Compile the library: -# -ADD_SUBDIRECTORY(source) - diff --git a/deal.II/contrib/cmake/setup_deal_ii.cmake b/deal.II/contrib/cmake/setup_deal_ii.cmake index 2ab68cf437..b7536d7ef5 100644 --- a/deal.II/contrib/cmake/setup_deal_ii.cmake +++ b/deal.II/contrib/cmake/setup_deal_ii.cmake @@ -2,20 +2,15 @@ # Set up deal.II specific definitions # -SET(DEAL_II_PACKAGE_BUGREPORT "dealii@dealii.org") SET(DEAL_II_PACKAGE_NAME "deal.II") -SET(DEAL_II_PACKAGE_TARNAME ${DEAL_II_PACKAGE_NAME}) - SET(DEAL_II_PACKAGE_VERSION ${VERSION}) SET(DEAL_II_PACKAGE_STRING "${DEAL_II_PACKAGE_NAME} ${DEAL_II_PACKAGE_VERSION}" ) -SET(DEAL_II_PACKAGE_URL "") - STRING(REGEX REPLACE "^([0-9]+)\\..*" "\\1" DEAL_II_MAJOR "${VERSION}" ) @@ -24,3 +19,10 @@ STRING(REGEX REPLACE ) SET(DEAL_II_PATH ${CMAKE_INSTALL_PREFIX}) + +SET(DEAL_II_PACKAGE_BUGREPORT "dealii@dealii.org") + +SET(DEAL_II_PACKAGE_TARNAME ${DEAL_II_PACKAGE_NAME}) #TODO + +SET(DEAL_II_PACKAGE_URL "http://www.dealii.org") + diff --git a/deal.II/contrib/config/deal.IIConfig.cmake.in b/deal.II/contrib/config/deal.IIConfig.cmake.in new file mode 100644 index 0000000000..b8c6b7d148 --- /dev/null +++ b/deal.II/contrib/config/deal.IIConfig.cmake.in @@ -0,0 +1,55 @@ +# +# The deal.II project configuration file +# + + +# +# General information +# + +SET(DEAL_II_VERSION "${DEAL_II_VERSION}") +SET(DEAL_II_MAJOR "${DEAL_II_MAJOR}") +SET(DEAL_II_MINOR "${DEAL_II_MINOR}") + +SET(DEAL_II_PATH "${CMAKE_INSTALL_PREFIX}") + +SET(DEAL_II_PACKAGE_NAME "${DEAL_II_PACKAGE_NAME}") +SET(DEAL_II_PACKAGE_VERSION "${DEAL_II_PACKAGE_VERSION}") +SET(DEAL_II_PACKAGE_STRING "${DEAL_II_PACKAGE_STRING}") + +SET(DEAL_II_PACKAGE_BUGREPORT "${DEAL_II_PACKAGE_BUGREPORT}") +SET(DEAL_II_PACKAGE_TARNAME "${DEAL_II_PACKAGE_TARNAME}") +SET(DEAL_II_PACKAGE_URL "${DEAL_II_PACKAGE_URL}") + + +# +# Compiler and linker configuration +# + +SET(DEAL_II_CXX_COMPILER "${CMAKE_CXX_COMPILER}") +SET(DEAL_II_CXX_COMPILER_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}}") + +SET(DEAL_II_C_COMPILER "${CMAKE_C_COMPILER}") +SET(DEAL_II_C_COMPILER_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE}}") + +SET(DEAL_II_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}") + +SET(DEAL_II_LINKER ${CMAKE_LINKER}) +SET(DEAL_II_AR ${CMAKE_AR}) + + +# +# Information on how to find and use the deal.II installation +# + +SET(DEAL_II_INCLUDE_DIRS "${DEAL_II_CONFIG_INCLUDE_DIRS}") + +SET(DEAL_II_LIBRARIES "${DEAL_II_CONFIG_LIBRARIES}") + + +# +# External libraries we have to link against +# + +SET(DEAL_II_EXTERNAL_LIBRARIES "${DEAL_II_EXTERNAL_LIBRARIES}") + diff --git a/deal.II/contrib/config/deal.IIConfigVersion.cmake.in b/deal.II/contrib/config/deal.IIConfigVersion.cmake.in new file mode 100644 index 0000000000..f1824043cd --- /dev/null +++ b/deal.II/contrib/config/deal.IIConfigVersion.cmake.in @@ -0,0 +1,17 @@ + +# +# A suggested by the cmake documentation +# + +set(PACKAGE_VERSION "@DEAL_II_VERSION@") + +# Check whether the requested PACKAGE_FIND_VERSION is compatible +if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}") + set(PACKAGE_VERSION_COMPATIBLE FALSE) +else() + set(PACKAGE_VERSION_COMPATIBLE TRUE) + if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}") + set(PACKAGE_VERSION_EXACT TRUE) + endif() +endif() + -- 2.39.5