diff options
author | Mathias Preiner <mathias.preiner@gmail.com> | 2018-08-29 10:26:10 -0700 |
---|---|---|
committer | Mathias Preiner <mathias.preiner@gmail.com> | 2018-09-22 16:30:59 -0700 |
commit | 6d1ee1f6b26c77d77510e39c09c063537810f457 (patch) | |
tree | 901534ff5ea05ed6a340d1976c0ae9f90fd35e5c /CMakeLists.txt | |
parent | 8f311f52037a9fb6a82d062342fec4b5396173c6 (diff) |
cmake: Add support for building static binaries/libraries.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 69f56f0bf..aa91a631f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -202,18 +202,6 @@ set(CVC4_BUILD_PROFILE_COMPETITION 0) 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 add_check_c_cxx_flag("-O${OPT_LEVEL}") @@ -259,6 +247,27 @@ 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 enable_testing() |