diff options
author | Mathias Preiner <mathias.preiner@gmail.com> | 2021-03-16 10:56:01 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-16 10:56:01 -0700 |
commit | d6890791897ddebf1212d3e3147bf7aeb2415b27 (patch) | |
tree | 51c69ba48a7550b6a7660e2488b4b39cbedba539 /CMakeLists.txt | |
parent | 0d3ea6f2dcaf80d386c7765ee8a708c18e3ed574 (diff) |
cmake: Generate cvc4_export.h and set visibility to hidden. (#6139)
The build system (cmake) will automatically generate an export header
cvc4_export.h, which makes sure that the correct export features are
defined depending on the compiler and target platform. The macro CVC4_EXPORT
replaces CVC4_PUBLIC and its usage is reduced by 2/3.
Co-authored-by: Gereon Kremer <nafur42@gmail.com>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index dc244917d..c06c360ac 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,6 +40,8 @@ set(CMAKE_C_STANDARD 99) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_VISIBILITY_PRESET hidden) +set(CMAKE_VISIBILITY_INLINES_HIDDEN 1) # Generate compile_commands.json, which can be used for various code completion # plugins. @@ -292,6 +294,12 @@ if(ENABLE_SHARED) message(WARNING "Disabling static binary since shared build is enabled.") endif() + # Set visibility to default if unit tests are enabled + if(ENABLE_UNIT_TESTING) + set(CMAKE_CXX_VISIBILITY_PRESET default) + set(CMAKE_VISIBILITY_INLINES_HIDDEN 0) + endif() + # Embed the installation prefix as an RPATH in the executable such that the # linker can find our libraries (such as libcvc4parser) when executing the # cvc4 binary. This is for example useful when installing CVC4 with a custom |