diff options
author | Mathias Preiner <mathias.preiner@gmail.com> | 2018-11-08 11:10:16 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-08 11:10:16 -0800 |
commit | 223431aaa5a95d48a6aff20134ed4e2481de3cf3 (patch) | |
tree | 7f951480dde3b3bd05d862a7a32b1d32a7d88a20 /CMakeLists.txt | |
parent | 7b0efcd75f471b4252c65b8d18aa4c3266649626 (diff) |
cmake: Add option to explicitely enable/disable static binaries. (#2698)
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 33824d186..099fc00fa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -71,6 +71,8 @@ cvc4_option(ENABLE_TRACING "Enable tracing") cvc4_option(ENABLE_UNIT_TESTING "Enable unit testing") cvc4_option(ENABLE_VALGRIND "Enable valgrind instrumentation") cvc4_option(ENABLE_SHARED "Build as shared library") +cvc4_option(ENABLE_STATIC_BINARY + "Build static binaries with statically linked system libraries") # >> 2-valued: ON OFF # > for options where we don't need to detect if set by user (default: OFF) option(ENABLE_BEST "Enable dependencies known to give best performance") @@ -184,7 +186,11 @@ add_check_cxx_flag("-Wno-class-memaccess") # These options are only set if their value is IGNORE. Otherwise, the user # already set the option, which we don't want to overwrite. -cvc4_set_option(ENABLE_SHARED ON) +if(ENABLE_STATIC_BINARY) + cvc4_set_option(ENABLE_SHARED OFF) +else() + cvc4_set_option(ENABLE_SHARED ON) +endif() #-----------------------------------------------------------------------------# # Set options for best configuration @@ -221,11 +227,16 @@ endif() if(ENABLE_SHARED) set(BUILD_SHARED_LIBS ON) + if(ENABLE_STATIC_BINARY) + set(ENABLE_STATIC_BINARY OFF) + message(WARNING "Disabling static binary since shared build is enabled.") + endif() else() set(CMAKE_FIND_LIBRARY_SUFFIXES ".a ${CMAKE_FIND_LIBRARY_SUFFIXES}") set(BUILD_SHARED_LIBS OFF) # 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) endif() #-----------------------------------------------------------------------------# @@ -501,6 +512,7 @@ print_config("Unit tests :" ENABLE_UNIT_TESTING) print_config("Valgrind :" ENABLE_VALGRIND) message("") print_config("Shared libs :" ENABLE_SHARED) +print_config("Static binary :" ENABLE_STATIC_BINARY) print_config("Java bindings :" BUILD_BINDINGS_JAVA) print_config("Python bindings :" BUILD_BINDINGS_PYTHON) print_config("Python2 :" USE_PYTHON2) |