From: Mathias Preiner Date: Wed, 29 Aug 2018 17:26:10 +0000 (-0700) Subject: cmake: Add support for building static binaries/libraries. X-Git-Tag: cvc5-1.0.0~4580 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6d1ee1f6b26c77d77510e39c09c063537810f457;p=cvc5.git cmake: Add support for building static binaries/libraries. --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 69f56f0bf..aa91a631f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -201,18 +201,6 @@ set(CVC4_BUILD_PROFILE_COMPETITION 0) # Whether CVC4 is built with the (optional) GPLed library dependences. set(CVC4_GPL_DEPS 0) -#-----------------------------------------------------------------------------# - -find_package(PythonInterp REQUIRED) - -set(ANTLR_HOME ${ANTLR_DIR}) -find_package(ANTLR REQUIRED) - -set(GMP_HOME ${GMP_DIR}) -find_package(GMP REQUIRED) -cvc4_link_library(${GMP_LIBRARIES}) -include_directories(${GMP_INCLUDE_DIR}) - #-----------------------------------------------------------------------------# # Compiler flags @@ -258,6 +246,27 @@ cvc4_set_option(ENABLE_PORTFOLIO OFF) cvc4_set_option(ENABLE_SHARED ON) cvc4_set_option(ENABLE_VALGRIND OFF) +#-----------------------------------------------------------------------------# + +# This needs to be set before any find_package(...) command since we want to +# search for static libraries with suffix .a. +if(NOT ENABLE_SHARED) + set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") + set(CMAKE_EXE_LINKER_FLAGS "-static") + set(BUILD_SHARED_LIBS OFF) +endif() + +find_package(PythonInterp REQUIRED) + +set(ANTLR_HOME ${ANTLR_DIR}) +find_package(ANTLR REQUIRED) + +set(GMP_HOME ${GMP_DIR}) +find_package(GMP REQUIRED) +cvc4_link_library(${GMP_LIBRARIES}) +include_directories(${GMP_INCLUDE_DIR}) + + #-----------------------------------------------------------------------------# # Enable the ctest testing framework