# deal.IIConfig.cmake
# deal.IIVersionConfig.cmake
#
-# and copies it (a) to the build directory and (b) prepares it for later
-# installation.
+# We support two configurations out of which deal.II can be used - directly
+# from the build directory or after installation. So we have to prepare
+# two distinct set ups.
#
#
#
# For binary dir:
#
-SET(CONFIG_INCLUDE_DIRS_BINARY
+
+SET(CONFIG_BUILD_DIR TRUE)
+SET(CONFIG_INCLUDE_DIRS
\${DEAL_II_PATH}/include
\${DEAL_II_PATH}/include/deal.II
${CMAKE_SOURCE_DIR}/include/
${deal_ii_source_includes}
${DEAL_II_USER_INCLUDE_DIRS}
)
+CONFIGURE_FILE(
+ ${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in
+ ${CMAKE_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_RELDIR}/${DEAL_II_PROJECT_CONFIG_NAME}Config.cmake
+ @ONLY
+ )
+CONFIGURE_FILE(
+ ${CMAKE_CURRENT_SOURCE_DIR}/ConfigVersion.cmake.in
+ ${CMAKE_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_RELDIR}/${DEAL_II_PROJECT_CONFIG_NAME}ConfigVersion.cmake
+ @ONLY
+ )
+
#
# For installation:
#
-SET(CONFIG_INCLUDE_DIRS_INSTALLATION
+
+SET(CONFIG_BUILD_DIR FALSE)
+SET(CONFIG_INCLUDE_DIRS
\${DEAL_II_PATH}/\${DEAL_II_INCLUDE_RELDIR}
\${DEAL_II_PATH}/\${DEAL_II_INCLUDE_RELDIR}/deal.II
\${DEAL_II_PATH}/\${DEAL_II_INCLUDE_RELDIR}/deal.II/bundled
)
CONFIGURE_FILE(
${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in
- ${CMAKE_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_RELDIR}/${DEAL_II_PROJECT_CONFIG_NAME}Config.cmake
+ ${CMAKE_CURRENT_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_NAME}Config.cmake
@ONLY
)
+CONFIGURE_FILE(
+ ${CMAKE_CURRENT_SOURCE_DIR}/ConfigVersion.cmake.in
+ ${CMAKE_CURRENT_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_NAME}ConfigVersion.cmake
+ @ONLY
+ )
+INSTALL(FILES
+ ${CMAKE_CURRENT_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_NAME}Config.cmake
+ ${CMAKE_CURRENT_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_NAME}ConfigVersion.cmake
+ DESTINATION ${DEAL_II_PROJECT_CONFIG_RELDIR}
+ COMPONENT library
+ )
+
#
-# Append feature configuration:
+# Append feature configuration to both configuration files:
#
-SET(_file
+
+SET(_files
${CMAKE_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_RELDIR}/${DEAL_II_PROJECT_CONFIG_NAME}Config.cmake
+ ${CMAKE_CURRENT_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_NAME}Config.cmake
)
-FILE(APPEND ${_file}
- "\n\n#\n# Feature configuration:\n#\n\n"
- )
+FOREACH(_file ${_files})
+ FILE(APPEND ${_file}
+ "\n\n#\n# Feature configuration:\n#\n\n"
+ )
+ENDFOREACH()
GET_CMAKE_PROPERTY(res VARIABLES)
FOREACH(var ${res})
IF(var MATCHES "DEAL_II_WITH")
- FILE(APPEND ${_file}
- "SET(${var} ${${var}})\n"
- )
+ FOREACH(_file ${_files})
+ FILE(APPEND ${_file}
+ "SET(${var} ${${var}})\n"
+ )
+ ENDFOREACH()
ENDIF()
ENDFOREACH()
-CONFIGURE_FILE(
- ${CMAKE_CURRENT_SOURCE_DIR}/ConfigVersion.cmake.in
- ${CMAKE_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_RELDIR}/${DEAL_II_PROJECT_CONFIG_NAME}ConfigVersion.cmake
- @ONLY
- )
-
-INSTALL(FILES
- ${CMAKE_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_RELDIR}/${DEAL_II_PROJECT_CONFIG_NAME}Config.cmake
- ${CMAKE_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_RELDIR}/${DEAL_II_PROJECT_CONFIG_NAME}ConfigVersion.cmake
- DESTINATION ${DEAL_II_PROJECT_CONFIG_RELDIR}
- COMPONENT library
- )
-
########################################################################
# #
# #
########################################################################
-
IF(DEAL_II_COMPONENT_COMPAT_FILES)
#
# Transform some cmake lists into a string that the old Makefile
#
# For binary dir:
#
- SET(MAKEFILE_D_BINARY ${CMAKE_BINARY_DIR})
- TO_STRING_AND_ADD_PREFIX(MAKEFILE_INCLUDE_DIRS_BINARY "${CMAKE_INCLUDE_FLAG_CXX}"
+ SET(MAKEFILE_D ${CMAKE_BINARY_DIR})
+ TO_STRING_AND_ADD_PREFIX(MAKEFILE_INCLUDE_DIRS "${CMAKE_INCLUDE_FLAG_CXX}"
$(D)/install
$(D)/install/deal.II
${CMAKE_SOURCE_DIR}/include/
${deal_ii_source_includes}
${DEAL_II_USER_INCLUDE_DIRS}
)
+ CONFIGURE_FILE(
+ ${CMAKE_CURRENT_SOURCE_DIR}/Make.global_options.in
+ ${CMAKE_BINARY_DIR}/${DEAL_II_COMMON_RELDIR}/Make.global_options
+ )
#
# For installation:
#
- SET(MAKEFILE_D_INSTALLATION ${CMAKE_INSTALL_PREFIX})
- TO_STRING_AND_ADD_PREFIX(MAKEFILE_INCLUDE_DIRS_INSTALLATION "${CMAKE_INCLUDE_FLAG_CXX}"
+ SET(MAKEFILE_D ${CMAKE_INSTALL_PREFIX})
+ TO_STRING_AND_ADD_PREFIX(MAKEFILE_INCLUDE_DIRS "${CMAKE_INCLUDE_FLAG_CXX}"
$(D)/${DEAL_II_INCLUDE_RELDIR}
$(D)/${DEAL_II_INCLUDE_RELDIR}/deal.II
$(D)/${DEAL_II_INCLUDE_RELDIR}/deal.II/bundled
)
CONFIGURE_FILE(
${CMAKE_CURRENT_SOURCE_DIR}/Make.global_options.in
- ${CMAKE_BINARY_DIR}/${DEAL_II_COMMON_RELDIR}/Make.global_options
+ ${CMAKE_CURRENT_BINARY_DIR}/Make.global_options
)
-
INSTALL(FILES
${CMAKE_BINARY_DIR}/${DEAL_II_COMMON_RELDIR}/template-arguments
- ${CMAKE_BINARY_DIR}/${DEAL_II_COMMON_RELDIR}/Make.global_options
+ ${CMAKE_CURRENT_BINARY_DIR}/Make.global_options
DESTINATION ${DEAL_II_COMMON_RELDIR}
COMPONENT compat_files
)
ENDIF()
-
-FILE(WRITE ${CMAKE_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_RELDIR}/binary "")
-
-#
-# And a script to remove it upon installation from the install prefix:
-# This is necessary if somebody wants to install into the build directory
-# (yes this is a valid use case...).
-#
-INSTALL(CODE
- "FILE(REMOVE ${CMAKE_INSTALL_PREFIX}/${DEAL_II_PROJECT_CONFIG_RELDIR}/binary)"
- COMPONENT library
- )
GET_FILENAME_COMPONENT(_path "${_path}" PATH)
ENDWHILE()
-#
-# Is this project reside in a build directory or at an installed location?
-#
-
-IF(EXISTS ${DEAL_II_PATH}/${DEAL_II_PROJECT_CONFIG_RELDIR}/binary)
- SET(DEAL_II_BUILD_DIR TRUE)
-ENDIF()
-
#
# Print a message after inclusion of this file:
#
SET(DEAL_II_PROJECT_CONFIG_INCLUDED TRUE)
+SET(DEAL_II_BUILD_DIR @CONFIG_BUILD_DIR@)
+
IF(NOT ${DEAL_II_PACKAGE_NAME}_FIND_QUIETLY)
IF(DEAL_II_BUILD_DIR)
MESSAGE(STATUS
#
# Information about include directories and libraries
#
-IF(DEAL_II_BUILD_DIR)
- SET(DEAL_II_INCLUDE_DIRS "@CONFIG_INCLUDE_DIRS_BINARY@")
-ELSE()
- SET(DEAL_II_INCLUDE_DIRS "@CONFIG_INCLUDE_DIRS_INSTALLATION@")
-ENDIF()
+
+# Full list of include directories:
+SET(DEAL_II_INCLUDE_DIRS "@CONFIG_INCLUDE_DIRS@")
# Full list of libraries for the debug target:
SET(DEAL_II_LIBRARIES_DEBUG "@CONFIG_LIBRARIES_DEBUG@")
# Information about library targets
#
-IF(DEAL_II_BUILD_DIR)
- SET(DEAL_II_EXECUTABLE_CONFIG "${DEAL_II_PATH}/${DEAL_II_PROJECT_CONFIG_RELDIR}/${DEAL_II_PROJECT_CONFIG_NAME}Executables.cmake")
- SET(DEAL_II_TARGET_CONFIG "${DEAL_II_PATH}/${DEAL_II_PROJECT_CONFIG_RELDIR}/${DEAL_II_PROJECT_CONFIG_NAME}BuildTargets.cmake")
-ELSE()
- SET(DEAL_II_TARGET_CONFIG "${DEAL_II_PATH}/${DEAL_II_PROJECT_CONFIG_RELDIR}/${DEAL_II_PROJECT_CONFIG_NAME}Targets.cmake")
-ENDIF()
+# The library targets file:
+SET(DEAL_II_TARGET_CONFIG "${DEAL_II_PATH}/${DEAL_II_PROJECT_CONFIG_RELDIR}/${DEAL_II_PROJECT_CONFIG_NAME}Targets.cmake")
# The Debug target:
SET(DEAL_II_TARGET_DEBUG "@CONFIG_TARGET_DEBUG@")
# Full list of targets with "debug" and "optimized" keywords for easy use with TARGET_LINK_LIBRARIES:
SET(DEAL_II_TARGET "@CONFIG_TARGET@")
+
+# Executable targets (such as mesh_converter, expand_instantiations, etc):
+SET(DEAL_II_EXECUTABLE_CONFIG "${DEAL_II_PATH}/${DEAL_II_PROJECT_CONFIG_RELDIR}/${DEAL_II_PROJECT_CONFIG_NAME}Executables.cmake")
OFF
)
-IF("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
- SET(CMAKE_INSTALL_PREFIX
- "${CMAKE_BINARY_DIR}"
- CACHE STRING
- "Install path prefix, prepended onto install directories."
- )
-ENDIF()
-
########################################################################
# #
# #
########################################################################
+#
+# We do not support installation into the binary directory any more ("too
+# much pain, not enough profit"):
+#
+
+IF("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_INSTALL_PREFIX}")
+ MESSAGE(FATAL_ERROR "
+Error CMAKE_INSTALL_PREFIX is equal to CMAKE_BINARY_DIR.
+It is not possible to install into the build directory. Please set
+CMAKE_INSTALL_PREFIX to a designated install directory different than
+CMAKE_BINARY_DIR.
+(Please note that you can use deal.II directly out of a build directory
+if this is what you tried to do.)
+"
+ )
+ENDIF()
+
+
GET_CMAKE_PROPERTY(_res VARIABLES)
FOREACH(_var ${_res})
#