cmake: Disable unit tests for static builds. (#2775)
authorMathias Preiner <mathias.preiner@gmail.com>
Sat, 5 Jan 2019 04:21:10 +0000 (20:21 -0800)
committerAndres Noetzli <andres.noetzli@gmail.com>
Sat, 5 Jan 2019 04:21:10 +0000 (20:21 -0800)
--static now implies --no-unit-testing.

Fixes #2672.

CMakeLists.txt

index 3265830ccd1b454fd0c8cf9cfb0d583cc757eced..33e06840ed8c0df3e4f886af7dcaeea3df9b8a94 100644 (file)
@@ -212,15 +212,6 @@ if(NOT ENABLE_ASSERTIONS)
   set(ENABLE_UNIT_TESTING OFF)
 endif()
 
-# Never build unit tests as static binaries, otherwise we'll end up with
-# ~300MB per unit test.
-if(ENABLE_UNIT_TESTING)
-  if(NOT ENABLE_SHARED)
-    message(WARNING "Disabling static build since unit testing is enabled.")
-  endif()
-  set(ENABLE_SHARED ON)
-endif()
-
 #-----------------------------------------------------------------------------#
 # Shared/static libraries
 #
@@ -239,6 +230,13 @@ else()
   # This is required to force find_package(Boost) to use static libraries.
   set(Boost_USE_STATIC_LIBS ON)
   cvc4_set_option(ENABLE_STATIC_BINARY ON)
+
+  # Never build unit tests as static binaries, otherwise we'll end up with
+  # ~300MB per unit test.
+  if(ENABLE_UNIT_TESTING)
+    message(WARNING "Disabling unit tests since static build is enabled.")
+    set(ENABLE_UNIT_TESTING OFF)
+  endif()
 endif()
 
 #-----------------------------------------------------------------------------#