]> https://gitweb.dealii.org/ - dealii.git/commitdiff
CMake: Split preference for static libraries in its own configuration
authorMatthias Maier <tamiko@kyomu.43-1.org>
Sat, 13 Jul 2013 10:08:17 +0000 (10:08 +0000)
committerMatthias Maier <tamiko@kyomu.43-1.org>
Sat, 13 Jul 2013 10:08:17 +0000 (10:08 +0000)
toggle

git-svn-id: https://svn.dealii.org/trunk@29990 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/cmake/setup_cached_variables.cmake
deal.II/cmake/setup_deal_ii.cmake
deal.II/doc/development/cmake.html

index 0439cf354ab1266b98d21a1548bce06bd6d144cd..8b6a6d4465eb61bdbb794bd79b77506e20c4928b 100644 (file)
@@ -33,8 +33,9 @@
 #     CMAKE_BUILD_TYPE
 #     DEAL_II_ALLOW_PLATFORM_INTROSPECTION
 #     DEAL_II_SETUP_DEFAULT_COMPILER_FLAGS
-#     DEAL_II_STATIC_EXECUTABLE
 #     BUILD_SHARED_LIBS
+#     DEAL_II_PREFER_STATIC_LIBS
+#     DEAL_II_STATIC_EXECUTABLE
 #     CMAKE_INSTALL_RPATH_USE_LINK_PATH
 #     CMAKE_C_FLAGS                     *)
 #     CMAKE_CXX_FLAGS                   *)
@@ -150,22 +151,32 @@ OPTION(DEAL_II_SETUP_DEFAULT_COMPILER_FLAGS
   )
 MARK_AS_ADVANCED(DEAL_II_SETUP_DEFAULT_COMPILER_FLAGS)
 
+SET(BUILD_SHARED_LIBS "ON" CACHE BOOL
+  "Build a shared library"
+  )
+
+OPTION(DEAL_II_PREFER_STATIC_LIBS
+  "Prefer static libraries over dynamic libraries when searching for features and corresponding link interface"
+  OFF
+  )
+MARK_AS_ADVANCED(DEAL_II_PREFER_STATIC_LIBS)
+
 OPTION(DEAL_II_STATIC_EXECUTABLE
-  "Provide a link interface that is suitable for static linkage of executables. Enabling this option forces BUILD_SHARED_LIBS=OFF"
+  "Provide a link interface that is suitable for static linkage of executables. Enabling this option forces BUILD_SHARED_LIBS=OFF and DEAL_II_PREFER_STATIC_LIBS=ON"
   OFF
   )
 MARK_AS_ADVANCED(DEAL_II_STATIC_EXECUTABLE)
 
 IF(DEAL_II_STATIC_EXECUTABLE)
   SET(BUILD_SHARED_LIBS "OFF" CACHE BOOL
-    "Build a shared library" FORCE
-    )
-ELSE()
-  SET(BUILD_SHARED_LIBS "ON" CACHE BOOL
     "Build a shared library"
+    FORCE
+    )
+  SET(DEAL_II_PREFER_STATIC_LIBS "ON" CACHE BOOL
+    "Prefer static libraries over dynamic libraries when searching for features and corresponding link interface"
+    FORCE
     )
 ENDIF()
-MARK_AS_ADVANCED(BUILD_SHARED_LIBS)
 
 
 #
index 4b3f6cdbb8b3836e2fbed06d714a2af83f240ea8..346d69d51c194212d43934918cace62ad1cd18a6 100644 (file)
@@ -164,11 +164,11 @@ FOREACH(_build ${DEAL_II_BUILD_TYPES})
     )
 ENDFOREACH()
 
-#
-# Invert the search order for libraries when BUILD_SHARED_LIBS=OFF to
-# prefer static archives instead of shared libraries:
-#
-IF(NOT BUILD_SHARED_LIBS)
+IF(DEAL_II_PREFER_STATIC_LIBS)
+  #
+  # Invert the search order for libraries when DEAL_II_PREFER_STATIC_LIBS
+  # is set. This will prefer static archives instead of shared libraries:
+  #
   # TODO: Does this work on a Windows or CYGWIN target?
   LIST(REVERSE CMAKE_FIND_LIBRARY_SUFFIXES)
 ENDIF()
index b169825b1d29e5f91f802a6cad880dc20ed859fd..75c7bb845187652588cbdf022cfb5b9f4f9c0539 100644 (file)
           <code>BUILD_SHARED_LIBS</code>: If set (default),
           <acronym>deal.II</acronym> will be linked as a shared library
 
+        <li>
+        <code>DEAL_II_PREFER_STATIC_LIBS</code> (defaults to off): If set
+        to true, static archives will be preferred over dynamic libraries when
+        searching for features and corresponding link interface.
+
        <li>
           <code>DEAL_II_STATIC_EXECUTABLE</code> (defaults to off):
           If set to true, <acronym>deal.II</acronym> will be configured in
           a way to provide a link interface that is suitable for static
           linkage of executables. Enabling this option forces
-          <code>BUILD_SHARED_LIBS=OFF</code>
+          <code>BUILD_SHARED_LIBS=OFF</code> and
+          <code>DEAL_II_PERFER_STATIC_LIBS</code>.
 
        <li>
          <code>CMAKE_INSTALL_RPATH_USE_LINK_PATH</code>: If set

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.