Ensure that we only find '.a's when building statically (#4785)
authorAndrew V. Jones <andrew.jones@vector.com>
Sat, 1 Aug 2020 07:34:37 +0000 (08:34 +0100)
committerGitHub <noreply@github.com>
Sat, 1 Aug 2020 07:34:37 +0000 (00:34 -0700)
commit230d27bad9b4cd49bad1164145cf83c9f04e9aca
tree5d1199aa16d86db95f79bbbe7ace29fabfe7a8ac
parentd8c343c00426577ba94b3dc984557a9440b6b1bd
Ensure that we only find '.a's when building statically (#4785)

## Issue

When trying to building statically, and if your machine *does not* have static libraries (e.g., there is [no static GMP on CentOS 8](https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/considerations_in_adopting_rhel_8/index#removed-packages_changes-to-packages)), then CVC4's CMake does not detect this:

```
FAILED: bin/cvc4
: && /usr/bin/c++  -O3 -Wall -Wno-deprecated -Wsuggest-override -Wnon-virtual-dtor -Wimplicit-fallthrough -Wshadow -Wno-class-memaccess  -fuse-ld=gold   -static src/main/CMakeFiles/main.dir/command_executor.cpp.o src/main/CMakeFiles/main.dir/interactive_shell.cpp.o src/main/CMakeFiles/main.dir/signal_handlers.cpp.o src/main/CMakeFiles/main.dir/time_limit.cpp.o src/main/CMakeFiles/cvc4-bin.dir/driver_unified.cpp.o src/main/CMakeFiles/cvc4-bin.dir/main.cpp.o  -o bin/cvc4  src/libcvc4.a  src/parser/libcvc4parser.a  src/libcvc4.a  -Wl,-Bdynamic  /usr/lib64/libgmp.so  -Wl,-Bstatic  ../deps/install/lib/libantlr3c.a && :
/usr/bin/ld.gold: error: cannot mix -static with dynamic object /usr/lib64/libgmp.so
```

## Resolution

This PR changes CVC4's CMakeLists such that, if you're building statically, it *only* allows for linking against `.a`s (or `.a`s + `.lib`s on Windows).

Signed-off-by: Andrew V. Jones <andrew.jones@vector.com>
CMakeLists.txt