]> https://gitweb.dealii.org/ - dealii.git/commitdiff
CMake: Export Makefile compatible definitions
authorMatthias Maier <tamiko@kyomu.43-1.org>
Tue, 13 Jan 2015 12:06:21 +0000 (13:06 +0100)
committerMatthias Maier <tamiko@kyomu.43-1.org>
Sun, 18 Jan 2015 19:08:25 +0000 (20:08 +0100)
This commit reintroduces Make.global_options that closely mirrors the
information and layout of the CMake project configuration
deal.IIConfig.cmake.

it is intended for sourcing in Makefiles.

cmake/config/CMakeLists.txt
cmake/config/Make.global_options.in
cmake/macros/macro_cond_set_to_yes.cmake [deleted file]

index 0277d0b60565a6c704668e4e0517cf57982ffe29..621a79b79931102f77f5ff521fc281ffea2b20d4 100644 (file)
@@ -18,6 +18,7 @@
 #
 #   deal.IIConfig.cmake
 #   deal.IIVersionConfig.cmake
+#   Make.global_options
 #
 # 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
@@ -113,17 +114,29 @@ FOREACH(_build ${DEAL_II_BUILD_TYPES})
     ${DEAL_II_LIBRARIES_${_build}}
     ${DEAL_II_LIBRARIES}
     )
+  TO_STRING(MAKEFILE_LIBRARIES_${_build} ${CONFIG_LIBRARIES_${_build}})
+  TO_STRING(MAKEFILE_USER_DEFINITIONS_${_build} ${DEAL_II_USER_DEFINITIONS_${_build}})
   LIST(APPEND CONFIG_LIBRARIES ${_keyword} \${DEAL_II_LIBRARIES_${_build}})
 
   SET(CONFIG_TARGET_${_build} ${DEAL_II_BASE_NAME}${DEAL_II_${_build}_SUFFIX})
   LIST(APPEND CONFIG_TARGET ${_keyword} \${DEAL_II_TARGET_${_build}})
 ENDFOREACH()
 
+TO_STRING(MAKEFILE_BUILD_TYPES ${DEAL_II_BUILD_TYPES})
+TO_STRING(MAKEFILE_USER_DEFINITIONS ${DEAL_II_USER_DEFINITIONS})
+
+IF(DEAL_II_STATIC_EXECUTABLE)
+  SET(MAKEFILE_STATIC_EXECUTABLE "true")
+ELSE()
+  SET(MAKEFILE_STATIC_EXECUTABLE "false")
+ENDIF()
+
 #
 # For binary dir:
 #
 
 SET(CONFIG_BUILD_DIR TRUE)
+SET(MAKEFILE_BUILD_DIR "true")
 SET(CONFIG_INCLUDE_DIRS
   \${DEAL_II_PATH}/include
   ${CMAKE_SOURCE_DIR}/include/
@@ -140,12 +153,19 @@ CONFIGURE_FILE(
   ${CMAKE_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_RELDIR}/${DEAL_II_PROJECT_CONFIG_NAME}ConfigVersion.cmake
   @ONLY
   )
+TO_STRING(MAKEFILE_INCLUDE_DIRS ${CONFIG_INCLUDE_DIRS})
+CONFIGURE_FILE(
+  ${CMAKE_CURRENT_SOURCE_DIR}/Make.global_options.in
+  ${CMAKE_BINARY_DIR}/${DEAL_II_SHARE_RELDIR}/Make.global_options
+  @ONLY
+  )
 
 #
 # For installation:
 #
 
 SET(CONFIG_BUILD_DIR FALSE)
+SET(MAKEFILE_BUILD_DIR "false")
 SET(CONFIG_INCLUDE_DIRS
   \${DEAL_II_PATH}/\${DEAL_II_INCLUDE_RELDIR}
   \${DEAL_II_PATH}/\${DEAL_II_INCLUDE_RELDIR}/deal.II/bundled
@@ -161,33 +181,52 @@ CONFIGURE_FILE(
   ${CMAKE_CURRENT_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_NAME}ConfigVersion.cmake
   @ONLY
   )
+TO_STRING(MAKEFILE_INCLUDE_DIRS ${CONFIG_INCLUDE_DIRS})
+CONFIGURE_FILE(
+  ${CMAKE_CURRENT_SOURCE_DIR}/Make.global_options.in
+  ${CMAKE_CURRENT_BINARY_DIR}/Make.global_options
+  @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
   )
+INSTALL(FILES
+  ${CMAKE_CURRENT_BINARY_DIR}/Make.global_options
+  DESTINATION ${DEAL_II_SHARE_RELDIR}
+  COMPONENT library
+  )
 
 #
-# Append feature configuration to both configuration files:
+# Append feature configuration to all configuration files:
 #
 
 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
   )
-FOREACH(_file ${_files})
-  FILE(APPEND ${_file}
-    "\n\n#\n# Feature configuration:\n#\n\n"
-    )
+SET(_makefiles
+  ${CMAKE_BINARY_DIR}/${DEAL_II_SHARE_RELDIR}/Make.global_options
+  ${CMAKE_CURRENT_BINARY_DIR}/${DEAL_II_SHARE_RELDIR}/Make.global_options
+  )
+FOREACH(_file ${_files} ${_makefiles})
+  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")
     FOREACH(_file ${_files})
-      FILE(APPEND ${_file}
-        "SET(${var} ${${var}})\n"
-        )
+      FILE(APPEND ${_file} "SET(${var} ${${var}})\n")
+    ENDFOREACH()
+    FOREACH(_file ${_makefiles})
+      IF(${var})
+        FILE(APPEND ${_file} "${var} = true\n")
+      ELSE()
+        FILE(APPEND ${_file} "${var} = false\n")
+      ENDIF()
     ENDFOREACH()
   ENDIF()
 ENDFOREACH()
index a0ed43c37c65803363b4a85117ba747f6cd8598f..a2e23124263752d4748b1c0324409ef60a695acd 100644 (file)
@@ -38,7 +38,7 @@ DEAL_II_VERSION = @DEAL_II_VERSION@
 DEAL_II_PROJECT_CONFIG_NAME = @DEAL_II_PROJECT_CONFIG_NAME@
 
 DEAL_II_BUILD_TYPE = @CMAKE_BUILD_TYPE@
-DEAL_II_BUILD_TYPES = @DEAL_II_BUILD_TYPES@
+DEAL_II_BUILD_TYPES = @MAKEFILE_BUILD_TYPES@
 
 #
 # Information about the project location
@@ -55,19 +55,17 @@ DEAL_II_LIBRARY_RELDIR = @DEAL_II_LIBRARY_RELDIR@
 DEAL_II_PROJECT_CONFIG_RELDIR = @DEAL_II_PROJECT_CONFIG_RELDIR@
 
 #
-# Determine DEAL_II_PATH from CMAKE_CURRENT_LIST_DIR:
+# Determine DEAL_II_PATH from MAKEFILE_LIST:
 #
-
-mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
-
-DEAL_II_PATH := 
+DEAL_II_MAKEFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
+DEAL_II_PATH := $(subst /${DEAL_II_SHARE_RELDIR}/Make.global_options,,${DEAL_II_MAKEFILE_PATH})
 
 #
 # Information about configuration:
 #
 
 DEAL_II_PROJECT_CONFIG_INCLUDED = true
-DEAL_II_BUILD_DIR = @CONFIG_BUILD_DIR@
+DEAL_II_BUILD_DIR = @MAKEFILE_BUILD_DIR@
 
 
 #
@@ -95,20 +93,20 @@ DEAL_II_LINKER_FLAGS_DEBUG = @DEAL_II_LINKER_FLAGS_DEBUG@
 DEAL_II_LINKER_FLAGS_RELEASE = @DEAL_II_LINKER_FLAGS_RELEASE@
 
 # used for all targets:
-DEAL_II_USER_DEFINITIONS = @DEAL_II_USER_DEFINITIONS@
+DEAL_II_USER_DEFINITIONS = @MAKEFILE_USER_DEFINITIONS@
 
 # _additionally_ used for debug targets:
-DEAL_II_USER_DEFINITIONS_DEBUG = @DEAL_II_USER_DEFINITIONS_DEBUG@
+DEAL_II_USER_DEFINITIONS_DEBUG = @MAKEFILE_USER_DEFINITIONS_DEBUG@
 
 # _additionally_ used for release targets:
-DEAL_II_USER_DEFINITIONS_RELEASE = @DEAL_II_USER_DEFINITIONS_RELEASE@
+DEAL_II_USER_DEFINITIONS_RELEASE = @MAKEFILE_USER_DEFINITIONS_RELEASE@
 
 
 #
 # Build a static executable:
 #
 
-DEAL_II_STATIC_EXECUTABLE = @DEAL_II_STATIC_EXECUTABLE@
+DEAL_II_STATIC_EXECUTABLE = @MAKEFILE_STATIC_EXECUTABLE@
 
 
 #
@@ -116,10 +114,10 @@ DEAL_II_STATIC_EXECUTABLE = @DEAL_II_STATIC_EXECUTABLE@
 #
 
 # Full list of include directories:
-DEAL_II_INCLUDE_DIRS = @CONFIG_INCLUDE_DIRS@
+DEAL_II_INCLUDE_DIRS = ${DEAL_II_PATH}@MAKEFILE_INCLUDE_DIRS@
 
 # Full list of libraries for the debug target:
-DEAL_II_LIBRARIES_DEBUG = @CONFIG_LIBRARIES_DEBUG@
+DEAL_II_LIBRARIES_DEBUG = ${DEAL_II_PATH}@MAKEFILE_LIBRARIES_DEBUG@
 
 # Full list of libraries for the release target:
-DEAL_II_LIBRARIES_RELEASE = @CONFIG_LIBRARIES_RELEASE@
+DEAL_II_LIBRARIES_RELEASE = ${DEAL_II_PATH}@MAKEFILE_LIBRARIES_RELEASE@
diff --git a/cmake/macros/macro_cond_set_to_yes.cmake b/cmake/macros/macro_cond_set_to_yes.cmake
deleted file mode 100644 (file)
index 43b72f5..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-## ---------------------------------------------------------------------
-##
-## Copyright (C) 2012 - 2014 by the deal.II authors
-##
-## This file is part of the deal.II library.
-##
-## The deal.II library is free software; you can use it, redistribute
-## it, and/or modify it under the terms of the GNU Lesser General
-## Public License as published by the Free Software Foundation; either
-## version 2.1 of the License, or (at your option) any later version.
-## The full text of the license can be found in the file LICENSE at
-## the top level of the deal.II distribution.
-##
-## ---------------------------------------------------------------------
-
-#
-# If bool is "true" (in a cmake fashion...), set variable to "yes",
-# otherwise to "no".
-#
-# Usage:
-#     COND_SET_TO_YES(bool variable)
-#
-
-MACRO(COND_SET_TO_YES _bool _variable)
-  IF(${_bool})
-    SET(${_variable} "yes")
-  ELSE()
-    SET(${_variable} "no")
-  ENDIF()
-ENDMACRO()
-

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.