]> https://gitweb.dealii.org/ - dealii.git/commitdiff
CMake: Let FindADOLC.cmake check whether adolc uses Boost pool allocator
authorMatthias Maier <tamiko@43-1.org>
Wed, 25 Apr 2018 20:23:17 +0000 (15:23 -0500)
committerMatthias Maier <tamiko@43-1.org>
Thu, 26 Apr 2018 13:56:50 +0000 (08:56 -0500)
Let the find module check whether adolc uses the Boost pool allocator.
If yes, add all boost libraries to the link interface.

cmake/modules/FindADOLC.cmake

index a178b738ba72dfe4fd45dd23ac7e4091d1723351..6702e403e815e96ce1c654b7ba5e9bbda498fcf9 100644 (file)
@@ -22,8 +22,9 @@
 #
 #   ADOLC_INCLUDE_DIR
 #   ADOLC_LIBRARY
-#   ADOLC_WITH_ATRIG_ERF
 #   ADOLC_WITH_ADVANCED_BRANCHING
+#   ADOLC_WITH_ATRIG_ERF
+#   ADOLC_WITH_BOOST_ALLOCATOR
 #
 
 SET(ADOLC_DIR "" CACHE PATH "An optional hint to an ADOL-C installation")
@@ -75,11 +76,27 @@ IF(EXISTS ${ADOLC_SETTINGS_H})
   ELSE()
     SET(ADOLC_WITH_ADVANCED_BRANCHING FALSE)
   ENDIF()
+
+  #
+  # Check whether ADOL-C is configured to use the Boost pool allocator
+  #
+  FILE(STRINGS "${ADOLC_SETTINGS_H}" ADOLC_BOOST_POOL_STRING
+    REGEX "#define USE_BOOST_POOL"
+    )
+  IF(NOT "${ADOLC_BOOST_POOL_STRING}" STREQUAL "")
+    SET(ADOLC_WITH_BOOST_ALLOCATOR TRUE)
+    SET(_additional_library OPTIONAL BOOST_LIBRARIES)
+  ELSE()
+    SET(ADOLC_WITH_BOOST_ALLOCATOR FALSE)
+    SET(_additional_library)
+  ENDIF()
 ENDIF()
 
 
 DEAL_II_PACKAGE_HANDLE(ADOLC
-  LIBRARIES REQUIRED ADOLC_LIBRARY
+  LIBRARIES
+    REQUIRED ADOLC_LIBRARY
+    ${_additional_library}
   INCLUDE_DIRS REQUIRED ADOLC_INCLUDE_DIR
   USER_INCLUDE_DIRS REQUIRED ADOLC_INCLUDE_DIR
   CLEAR ADOLC_INCLUDE_DIR ADOLC_LIBRARY ADOLC_SETTINGS_H

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.