From 19a31a8363fd1169661cc61f1f8bf009487a9664 Mon Sep 17 00:00:00 2001 From: maier Date: Fri, 5 Oct 2012 16:01:05 +0000 Subject: [PATCH] Big overhaul: Do it the cmake way. (At least a bit...) git-svn-id: https://svn.dealii.org/branches/branch_cmake@26964 0785d39b-7218-0410-832d-ea1e28bc413d --- ...macro_deal_ii_import_library_targets.cmake | 51 ++++++++ ..._deal_ii_initialize_cached_variables.cmake | 6 +- .../macros/macro_deal_ii_setup_target.cmake | 33 ++--- deal.II/cmake/setup_deal_ii.cmake | 37 ++---- deal.II/config/CMakeLists.txt | 85 +++++++------ deal.II/config/Config.cmake.in | 113 ++++++------------ deal.II/examples/step-1/CMakeLists.txt | 2 + deal.II/source/CMakeLists.txt | 10 +- 8 files changed, 168 insertions(+), 169 deletions(-) create mode 100644 deal.II/cmake/macros/macro_deal_ii_import_library_targets.cmake diff --git a/deal.II/cmake/macros/macro_deal_ii_import_library_targets.cmake b/deal.II/cmake/macros/macro_deal_ii_import_library_targets.cmake new file mode 100644 index 0000000000..7e7b64a0f8 --- /dev/null +++ b/deal.II/cmake/macros/macro_deal_ii_import_library_targets.cmake @@ -0,0 +1,51 @@ +##### +## +## Copyright (C) 2012 by the deal.II authors +## +## This file is part of the deal.II library. +## +## +## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later +## version of the LGPL license. +## +## Author: Matthias Maier +## +##### + +# +# This file implements the DEAL_II_IMPORT_LIBRARY macro, which is +# part of the deal.II library. +# +# Usage: +# DEAL_II_IMPORT_LIBRARY() +# +# This sets some cached variables to the values used for compiling the +# deal.II library. +# +# This macro has to be called before PROJECT()! +# + +MACRO(DEAL_II_IMPORT_LIBRARY) + + IF(NOT DEAL_II_PROJECT_CONFIG_INCLUDED) + MESSAGE(FATAL_ERROR + "DEAL_II_SETUP_TARGET can only be called in external projects after " + "the inclusion of deal.IIConfig.cmake. It is not intended for " + "internal use." + ) + ENDIF() + + INCLUDE(${DEAL_II_TARGET_CONFIG}) + + # + # Fixup the CONFIGURATION types for debug and release targets: + # + FOREACH(build ${DEAL_II_BUILD_TYPES}) + SET_TARGET_PROPERTIES(${DEAL_II_TARGET_${build}} + PROPERTIES + MAP_IMPORTED_CONFIG ${build} + ) + ENDFOREACH() + +ENDMACRO() + diff --git a/deal.II/cmake/macros/macro_deal_ii_initialize_cached_variables.cmake b/deal.II/cmake/macros/macro_deal_ii_initialize_cached_variables.cmake index a8a90eae3b..40c1d32d20 100644 --- a/deal.II/cmake/macros/macro_deal_ii_initialize_cached_variables.cmake +++ b/deal.II/cmake/macros/macro_deal_ii_initialize_cached_variables.cmake @@ -19,15 +19,15 @@ # Usage: # DEAL_II_INITIALIZE_CACHED_VARIABLES() # -# This macro sets some cached variables to the values used for compiling -# the deal.II library. +# This sets some cached variables to the values used for compiling the +# deal.II library. # # This macro has to be called before PROJECT()! # MACRO(DEAL_II_INITIALIZE_CACHED_VARIABLES) - IF(NOT DEAL_II_PROJECT_CONFIG_INCLUDE) + IF(NOT DEAL_II_PROJECT_CONFIG_INCLUDED) MESSAGE(FATAL_ERROR "DEAL_II_INITIALIZE_CACHED_VARIABLES can only be called in external " "projects after the inclusion of deal.IIConfig.cmake. It is not " diff --git a/deal.II/cmake/macros/macro_deal_ii_setup_target.cmake b/deal.II/cmake/macros/macro_deal_ii_setup_target.cmake index 6c175d2ae7..009ab4fd6e 100644 --- a/deal.II/cmake/macros/macro_deal_ii_setup_target.cmake +++ b/deal.II/cmake/macros/macro_deal_ii_setup_target.cmake @@ -19,13 +19,14 @@ # Usage: # DEAL_II_SETUP_TARGET(target) # -# This macro sets the necessary include directories, linker flags, compile +# This sets the necessary include directories, linker flags, compile # definitions and the external libraries the target will be linked against. # +# MACRO(DEAL_II_SETUP_TARGET target) - IF(NOT DEAL_II_PROJECT_CONFIG_INCLUDE) + IF(NOT DEAL_II_PROJECT_CONFIG_INCLUDED) MESSAGE(FATAL_ERROR "DEAL_II_SETUP_TARGET can only be called in external projects after " "the inclusion of deal.IIConfig.cmake. It is not intended for " @@ -33,6 +34,7 @@ MACRO(DEAL_II_SETUP_TARGET target) ) ENDIF() + # Necessary for setting INCLUDE_DIRECTORIES via SET_TARGET_PROPERTIES CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) SET_TARGET_PROPERTIES(${target} PROPERTIES @@ -40,22 +42,25 @@ MACRO(DEAL_II_SETUP_TARGET target) "${DEAL_II_EXTERNAL_INCLUDE_DIRS};${DEAL_II_INCLUDE_DIRS}" LINK_FLAGS "${DEAL_II_LINKER_FLAGS}" - LINK_FLAGS_DEBUG - "${DEAL_II_LINKER_FLAGS_DEBUG}" - LINK_FLAGS_RELEASE - "${DEAL_II_LINKER_FLAGS_RELEASE}" COMPILE_DEFINITIONS "${DEAL_II_USER_DEFINITIONS}" - COMPILE_DEFINITIONS_DEBUG - "${DEAL_II_USER_DEFINITIONS_DEBUG}" - COMPILE_DEFINITIONS_RELEASE - "${DEAL_II_USER_DEFINITIONS_RELEASE}" ) - TARGET_LINK_LIBRARIES(${target} - ${DEAL_II_LIBRARIES} - ${DEAL_II_EXTERNAL_LIBRARIES} - ) + # TODO: A bit more magic... + FOREACH(build ${DEAL_II_BUILD_TYPES}) + IF(CMAKE_BUILD_TYPE MATCHES "${build}") + SET_TARGET_PROPERTIES(${target} PROPERTIES + LINK_FLAGS_${CMAKE_BUILD_TYPE} + "${DEAL_II_LINKER_FLAGS_${build}}" + COMPILE_DEFINITIONS_${CMAKE_BUILD_TYPE} + "${DEAL_II_USER_DEFINITIONS_${build}}" + ) + TARGET_LINK_LIBRARIES(${target} + ${DEAL_II_TARGET_${build}} + ) + RETURN() + ENDIF() + ENDFOREACH() ENDMACRO() diff --git a/deal.II/cmake/setup_deal_ii.cmake b/deal.II/cmake/setup_deal_ii.cmake index dc59a60116..07f0b58876 100644 --- a/deal.II/cmake/setup_deal_ii.cmake +++ b/deal.II/cmake/setup_deal_ii.cmake @@ -56,11 +56,9 @@ # DEAL_II_PROJECT_CONFIG_RELDIR *) # # DEAL_II_INCLUDE_DIRS -# DEAL_II_LIBRARIES -# DEAL_II_LIBRARIES_DEBUG -# DEAL_II_LIBRARIES_RELEASE +# DEAL_II_LIBRARY_DIRS # -# DEAL_II_BUILD_TYPES +# DEAL_II_BUILD_TYPE # DEAL_II_WITH_BUNDLED_DIRECTORY # DEAL_II_WITH_DOC_DIRECTORY # @@ -68,6 +66,8 @@ # -D<...> # **) Cached Options. Can be set via ccmake or on the command line via -D<...> # +# #) Set in source/CmakeLists.txt after the target names are known. +# # @@ -199,39 +199,16 @@ LIST(APPEND DEAL_II_INCLUDE_DIRS "${CMAKE_INSTALL_PREFIX}/${DEAL_II_INCLUDE_RELDIR}/deal.II/bundled" ) +LIST(APPEND DEAL_II_LIBRARY_DIRS + "${CMAKE_INSTALL_PREFIX}/${DEAL_II_LIBRARY_RELDIR}" + ) -# -# A lot of magic to guess the resulting library names: -# -IF(BUILD_SHARED_LIBS) - SET(DEAL_II_LIBRARY_NAME_RELEASE ${CMAKE_SHARED_LIBRARY_PREFIX}${DEAL_II_BASE_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX} ) - SET(DEAL_II_LIBRARY_NAME_DEBUG ${CMAKE_SHARED_LIBRARY_PREFIX}${DEAL_II_BASE_NAME}${DEAL_II_DEBUG_SUFFIX}${CMAKE_SHARED_LIBRARY_SUFFIX} ) -ELSE() - SET(DEAL_II_LIBRARY_NAME_RELEASE ${CMAKE_STATIC_LIBRARY_PREFIX}${DEAL_II_BASE_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX} ) - SET(DEAL_II_LIBRARY_NAME_DEBUG ${CMAKE_STATIC_LIBRARY_PREFIX}${DEAL_II_BASE_NAME}${DEAL_II_DEBUG_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX} ) -ENDIF() IF(CMAKE_BUILD_TYPE MATCHES "Debug") - LIST(APPEND DEAL_II_LIBRARIES_DEBUG - "${CMAKE_INSTALL_PREFIX}/${DEAL_II_LIBRARY_RELDIR}/${DEAL_II_LIBRARY_NAME_DEBUG}" - ) - LIST(APPEND DEAL_II_LIBRARIES - debug - "${CMAKE_INSTALL_PREFIX}/${DEAL_II_LIBRARY_RELDIR}/${DEAL_II_LIBRARY_NAME_DEBUG}" - ) - LIST(APPEND DEAL_II_BUILD_TYPES "DEBUG") ENDIF() IF(CMAKE_BUILD_TYPE MATCHES "Release") - LIST(APPEND DEAL_II_LIBRARIES_RELEASE - "${CMAKE_INSTALL_PREFIX}/${DEAL_II_LIBRARY_RELDIR}/${DEAL_II_LIBRARY_NAME_RELEASE}" - ) - LIST(APPEND DEAL_II_LIBRARIES - optimized - "${CMAKE_INSTALL_PREFIX}/${DEAL_II_LIBRARY_RELDIR}/${DEAL_II_LIBRARY_NAME_RELEASE}" - ) - LIST(APPEND DEAL_II_BUILD_TYPES "RELEASE") ENDIF() diff --git a/deal.II/config/CMakeLists.txt b/deal.II/config/CMakeLists.txt index a084ada088..a0f4a035e1 100644 --- a/deal.II/config/CMakeLists.txt +++ b/deal.II/config/CMakeLists.txt @@ -12,69 +12,61 @@ ## ##### + CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/template-arguments.in ${CMAKE_CURRENT_BINARY_DIR}/template-arguments ) -# -# Setup and install the convenience macros: -# + +########################################################################### +# # +# Setup and install the convenience macros: # +# # +########################################################################### LIST(APPEND DEAL_II_MACROS + ${CMAKE_INSTALL_PREFIX}/${DEAL_II_CMAKE_MACROS_RELDIR}/macro_deal_ii_import_library_targets.cmake ${CMAKE_INSTALL_PREFIX}/${DEAL_II_CMAKE_MACROS_RELDIR}/macro_deal_ii_initialize_cached_variables.cmake ${CMAKE_INSTALL_PREFIX}/${DEAL_II_CMAKE_MACROS_RELDIR}/macro_deal_ii_setup_target.cmake ) INSTALL(FILES + ${CMAKE_SOURCE_DIR}/cmake/macros/macro_deal_ii_import_library_targets.cmake ${CMAKE_SOURCE_DIR}/cmake/macros/macro_deal_ii_initialize_cached_variables.cmake ${CMAKE_SOURCE_DIR}/cmake/macros/macro_deal_ii_setup_target.cmake DESTINATION ${DEAL_II_CMAKE_MACROS_RELDIR} COMPONENT library ) -# -# Configure and install the cmake project configuration: -# - -IF(NOT "${DEAL_II_EXTERNAL_LIBRARIES}" STREQUAL "") - SET(CONFIG_EXTERNAL_LIBRARIES - general - ${DEAL_II_EXTERNAL_LIBRARIES} - ) -ENDIF() -IF(CMAKE_BUILD_TYPE MATCHES "Debug") - SET(CONFIG_EXTERNAL_LIBRARIES_DEBUG - ${DEAL_II_EXTERNAL_LIBRARIES} - ${DEAL_II_EXTERNAL_LIBRARIES_DEBUG} - ) - IF(NOT "${DEAL_II_EXTERNAL_LIBRARIES_DEBUG}" STREQUAL "") - LIST(APPEND CONFIG_EXTERNAL_LIBRARIES - debug - ${DEAL_II_EXTERNAL_LIBRARIES_DEBUG} - ) - ENDIF() -ENDIF() - -IF(CMAKE_BUILD_TYPE MATCHES "Release") - SET(CONFIG_EXTERNAL_LIBRARIES_RELEASE - ${DEAL_II_EXTERNAL_LIBRARIES} - ${DEAL_II_EXTERNAL_LIBRARIES_RELEASE} - ) - IF(NOT "${DEAL_II_EXTERNAL_LIBRARIES_RELEASE}" STREQUAL "") - LIST(APPEND CONFIG_EXTERNAL_LIBRARIES - optimized - ${DEAL_II_EXTERNAL_LIBRARIES_RELEASE} - ) - ENDIF() -ENDIF() +########################################################################### +# # +# Configure and install the cmake project configuration: # +# # +########################################################################### CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_NAME}Config.cmake + @ONLY ) +# +# Append target information: +# +FOREACH(build ${DEAL_II_BUILD_TYPES}) + FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_NAME}Config.cmake + "SET(DEAL_II_TARGET_${build} \"${DEAL_II_BASE_NAME}${DEAL_II_${build}_SUFFIX}\")\n" + ) +ENDFOREACH() + +# +# Append the feature configuration: +# +FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_NAME}Config.cmake + "\n\n#\n# Feature configuration:\n#\n\n" + ) GET_CMAKE_PROPERTY(res VARIABLES) FOREACH(var ${res}) IF(var MATCHES "DEAL_II_WITH") @@ -89,7 +81,7 @@ ENDFOREACH() # config: # FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_NAME}Config.cmake - "\n#\n# Include some convenience macros directly in the project config:\n#\n" + "\n\n#\n# Include some convenience macros directly in the project config:\n#\n\n" ) FOREACH(var ${DEAL_II_MACROS}) FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_NAME}Config.cmake @@ -97,6 +89,7 @@ FOREACH(var ${DEAL_II_MACROS}) ) ENDFOREACH() + CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/ConfigVersion.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_NAME}ConfigVersion.cmake @@ -111,16 +104,18 @@ INSTALL(FILES ) +########################################################################### +# # +# Configure and install the old Makefile configuration: # +# # +########################################################################### + IF(DEAL_II_COMPONENT_COMPAT_FILES) - # - # Configure and install the old Makefile configuration: - # # - # Therefore, transform some cmake lists into a string that the old - # Makefile mechanism actually understands: + # Transform some cmake lists into a string that the old Makefile + # mechanism actually understands: # - TO_STRING_AND_ADD_PREFIX(MAKEFILE_INCLUDE_DIRS "${CMAKE_INCLUDE_FLAG_C}" ${DEAL_II_USER_INCLUDE_DIRS} ${DEAL_II_INCLUDE_DIRS} diff --git a/deal.II/config/Config.cmake.in b/deal.II/config/Config.cmake.in index ce5a230bd6..42a311a752 100644 --- a/deal.II/config/Config.cmake.in +++ b/deal.II/config/Config.cmake.in @@ -19,129 +19,92 @@ ## ## ########################################################################## -SET(DEAL_II_PROJECT_CONFIG_INCLUDE TRUE) +SET(DEAL_II_PROJECT_CONFIG_INCLUDED TRUE) # # General information # -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_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_VERSION "${DEAL_II_VERSION_MAJOR}.${DEAL_II_VERSION_MINOR}") -SET(DEAL_II_VERSION_MAJOR "${DEAL_II_VERSION_MAJOR}") -SET(DEAL_II_VERSION_MINOR "${DEAL_II_VERSION_MINOR}") +SET(DEAL_II_PACKAGE_BUGREPORT "@DEAL_II_PACKAGE_BUGREPORT@") +SET(DEAL_II_PACKAGE_URL "@DEAL_II_PACKAGE_URL@") -SET(DEAL_II_PACKAGE_BUGREPORT "${DEAL_II_PACKAGE_BUGREPORT}") -SET(DEAL_II_PACKAGE_URL "${DEAL_II_PACKAGE_URL}") +SET(DEAL_II_VERSION "@DEAL_II_VERSION_MAJOR@.@DEAL_II_VERSION_MINOR@") +SET(DEAL_II_VERSION_MAJOR "@DEAL_II_VERSION_MAJOR@") +SET(DEAL_II_VERSION_MINOR "@DEAL_II_VERSION_MINOR@") -SET(DEAL_II_PROJECT_CONFIG_NAME "${DEAL_II_PROJECT_CONFIG_NAME}") -SET(DEAL_II_MACROS "${DEAL_II_MACROS}") +SET(DEAL_II_PROJECT_CONFIG_NAME "@DEAL_II_PROJECT_CONFIG_NAME@") +SET(DEAL_II_BUILD_TYPE "@CMAKE_BUILD_TYPE@") # # Information about the project location # -SET(DEAL_II_PATH "${DEAL_II_PATH}") -SET(DEAL_II_CMAKE_MACROS_RELDIR "${DEAL_II_CMAKE_MACROS_RELDIR}") -SET(DEAL_II_DOCUMENTATION_RELDIR "${DEAL_II_DOCUMENTATION_RELDIR}") -SET(DEAL_II_EXAMPLES_RELDIR "${DEAL_II_EXAMPLES_RELDIR}") -SET(DEAL_II_EXECUTABLE_RELDIR "${DEAL_II_EXECUTABLE_RELDIR}") -SET(DEAL_II_INCLUDE_RELDIR "${DEAL_II_INCLUDE_RELDIR}") -SET(DEAL_II_LIBRARY_RELDIR "${DEAL_II_LIBRARY_RELDIR}") -SET(DEAL_II_PROJECT_CONFIG_RELDIR "${DEAL_II_PROJECT_CONFIG_RELDIR}") +SET(DEAL_II_PATH "@DEAL_II_PATH@") +SET(DEAL_II_CMAKE_MACROS_RELDIR "@DEAL_II_CMAKE_MACROS_RELDIR@") +SET(DEAL_II_DOCUMENTATION_RELDIR "@DEAL_II_DOCUMENTATION_RELDIR@") +SET(DEAL_II_EXAMPLES_RELDIR "@DEAL_II_EXAMPLES_RELDIR@") +SET(DEAL_II_EXECUTABLE_RELDIR "@DEAL_II_EXECUTABLE_RELDIR@") +SET(DEAL_II_INCLUDE_RELDIR "@DEAL_II_INCLUDE_RELDIR@") +SET(DEAL_II_LIBRARY_RELDIR "@DEAL_II_LIBRARY_RELDIR@") +SET(DEAL_II_PROJECT_CONFIG_RELDIR "@DEAL_II_PROJECT_CONFIG_RELDIR@") # # Compiler and linker configuration # -SET(DEAL_II_BUILD_TYPE "${CMAKE_BUILD_TYPE}") -SET(DEAL_II_BUILD_TYPES "${DEAL_II_BUILD_TYPES}") - -SET(DEAL_II_CXX_COMPILER "${CMAKE_CXX_COMPILER}") +SET(DEAL_II_CXX_COMPILER "@CMAKE_CXX_COMPILER@") # used for all targets: -SET(DEAL_II_CXX_FLAGS "${CMAKE_CXX_FLAGS}") +SET(DEAL_II_CXX_FLAGS "@CMAKE_CXX_FLAGS@") # _additionally_ used for debug targets: -SET(DEAL_II_CXX_FLAGS_DEBUG "${DEAL_II_CXX_FLAGS_DEBUG}") +SET(DEAL_II_CXX_FLAGS_DEBUG "@DEAL_II_CXX_FLAGS_DEBUG@") # _additionally_ used for release targets: -SET(DEAL_II_CXX_FLAGS_RELEASE "${DEAL_II_CXX_FLAGS_RELEASE}") - -SET(DEAL_II_C_COMPILER "${CMAKE_C_COMPILER}") +SET(DEAL_II_CXX_FLAGS_RELEASE "@DEAL_II_CXX_FLAGS_RELEASE@") # used for all targets: -SET(DEAL_II_C_FLAGS "${CMAKE_C_FLAGS}") +SET(DEAL_II_LINKER_FLAGS "@CMAKE_SHARED_LINKER_FLAGS@") # _additionally_ used for debug targets: -SET(DEAL_II_C_FLAGS_DEBUG "${DEAL_II_C_FLAGS_DEBUG}") +SET(DEAL_II_LINKER_FLAGS_DEBUG "@DEAL_II_SHARED_LINKER_FLAGS_DEBUG@") # _additionally_ used for release targets: -SET(DEAL_II_C_FLAGS_RELEASE "${DEAL_II_C_FLAGS_RELEASE}") +SET(DEAL_II_LINKER_FLAGS_RELEASE "@DEAL_II_SHARED_LINKER_FLAGS_RELEASE@") # used for all targets: -SET(DEAL_II_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}") +SET(DEAL_II_USER_DEFINITIONS "@DEAL_II_USER_DEFINITIONS@") # _additionally_ used for debug targets: -SET(DEAL_II_LINKER_FLAGS_DEBUG "${DEAL_II_SHARED_LINKER_FLAGS_DEBUG}") +SET(DEAL_II_USER_DEFINITIONS_DEBUG "@DEAL_II_USER_DEFINITIONS_DEBUG@") # _additionally_ used for release targets: -SET(DEAL_II_LINKER_FLAGS_RELEASE "${DEAL_II_SHARED_LINKER_FLAGS_RELEASE}") - -# used for all targets: -SET(DEAL_II_USER_DEFINITIONS "${DEAL_II_USER_DEFINITIONS}") - -# _additionally_ used for debug targets: -SET(DEAL_II_USER_DEFINITIONS_DEBUG "${DEAL_II_USER_DEFINITIONS_DEBUG}") - -# _additionally_ used for release targets: -SET(DEAL_II_USER_DEFINITIONS_RELEASE "${DEAL_II_USER_DEFINITIONS_RELEASE}") +SET(DEAL_II_USER_DEFINITIONS_RELEASE "@DEAL_II_USER_DEFINITIONS_RELEASE@") # -# Information about the the deal.II libraries and headers +# Information about include directories # -SET(DEAL_II_INCLUDE_DIRS "${DEAL_II_INCLUDE_DIRS}") - -# -# The _full_ list of libraries with "general", "debug" and "optimized" -# keywords for easy use with TARGET_LINK_LIBRARIES: -# -SET(DEAL_II_LIBRARIES "${DEAL_II_LIBRARIES}") +# Include directories of the deal.II library +SET(DEAL_II_INCLUDE_DIRS "@DEAL_II_INCLUDE_DIRS@") -# The full list of library/ies for the debug target: -SET(DEAL_II_LIBRARIES_DEBUG "${DEAL_II_LIBRARIES_DEBUG}") +# External include directories +SET(DEAL_II_EXTERNAL_INCLUDE_DIRS "@DEAL_II_USER_INCLUDE_DIRS@") -# The full lis of libraries/ies for the release target: -SET(DEAL_II_LIBRARIES_RELEASE "${DEAL_II_LIBRARIES_RELEASE}") - - -# -# External libraries we have to link against -# - -SET(DEAL_II_EXTERNAL_INCLUDE_DIRS "${DEAL_II_USER_INCLUDE_DIRS}") # -# The _full_ list of libraries with "general", "debug" and "optimized" -# keywords for easy use with TARGET_LINK_LIBRARIES: +# Information about library targets # -SET(DEAL_II_EXTERNAL_LIBRARIES "${CONFIG_EXTERNAL_LIBRARIES}") -# The full lis of libraries for the debug target: -SET(DEAL_II_EXTERNAL_LIBRARIES_DEBUG "${CONFIG_EXTERNAL_LIBRARIES_DEBUG}") - -# The full lis of libraries for the release target: -SET(DEAL_II_EXTERNAL_LIBRARIES_RELEASE "${CONFIG_EXTERNAL_LIBRARIES_RELEASE}") - - -# -# Feature configuration of the deal.II library -# +SET(DEAL_II_BUILD_TYPES "@DEAL_II_BUILD_TYPES@") +SET(DEAL_II_TARGET_CONFIG "${DEAL_II_PATH}/${DEAL_II_PROJECT_CONFIG_RELDIR}/${DEAL_II_PROJECT_CONFIG_NAME}Targets.cmake") +SET(DEAL_II_TARGET_BASE_NAME "@DEAL_II_BASE_NAME@") diff --git a/deal.II/examples/step-1/CMakeLists.txt b/deal.II/examples/step-1/CMakeLists.txt index 7b8de8c643..2c86a939f6 100644 --- a/deal.II/examples/step-1/CMakeLists.txt +++ b/deal.II/examples/step-1/CMakeLists.txt @@ -10,6 +10,8 @@ DEAL_II_INITIALIZE_CACHED_VARIABLES() PROJECT(step-1) +DEAL_II_IMPORT_LIBRARY() + ADD_EXECUTABLE(step-1 step-1.cc) DEAL_II_SETUP_TARGET(step-1) diff --git a/deal.II/source/CMakeLists.txt b/deal.II/source/CMakeLists.txt index 053c208304..0c51e4148e 100644 --- a/deal.II/source/CMakeLists.txt +++ b/deal.II/source/CMakeLists.txt @@ -66,10 +66,16 @@ FOREACH(build ${DEAL_II_BUILD_TYPES}) ) INSTALL(TARGETS ${DEAL_II_BASE_NAME}${DEAL_II_${build}_SUFFIX} - LIBRARY - DESTINATION ${DEAL_II_LIBRARY_RELDIR} + EXPORT ${DEAL_II_PROJECT_CONFIG_NAME}Targets + ARCHIVE DESTINATION ${DEAL_II_LIBRARY_RELDIR} + LIBRARY DESTINATION ${DEAL_II_LIBRARY_RELDIR} COMPONENT library ) ENDFOREACH() +INSTALL(EXPORT ${DEAL_II_PROJECT_CONFIG_NAME}Targets + DESTINATION ${DEAL_II_PROJECT_CONFIG_RELDIR} + COMPONENT library + ) + -- 2.39.5