From 4ef55505e7f8ca5b35b88ec1c2e1a2c331460d40 Mon Sep 17 00:00:00 2001 From: Dan Liew Date: Mon, 17 Oct 2016 17:12:04 +0100 Subject: [PATCH] [CMake] Fix #763 reported by @jirislaby. `INTERFACE` was the not appropriate usage requirement to use. However it only caused a problem when USE_LIB_GMP was enabled. With `INTERFACE` `-lgmp` was not specified on the link line so `libz3.so` did not have a reference to the library and linking against `libz3.so` by clients would fail with missing references to symbols in `libgmp`. --- contrib/cmake/src/CMakeLists.txt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/contrib/cmake/src/CMakeLists.txt b/contrib/cmake/src/CMakeLists.txt index cba30c46f..f12c56f8e 100644 --- a/contrib/cmake/src/CMakeLists.txt +++ b/contrib/cmake/src/CMakeLists.txt @@ -136,9 +136,10 @@ if (NOT MSVC) set_target_properties(libz3 PROPERTIES OUTPUT_NAME z3) endif() -# Using INTERFACE means that targets that try link against libz3 will -# automatically link against the libs in Z3_DEPENDENT_LIBS -target_link_libraries(libz3 INTERFACE ${Z3_DEPENDENT_LIBS}) +# The `PRIVATE` usage requirement is specified so that when building Z3 as a +# shared library the dependent libraries are specified on the link command line +# so that if those are also shared libraries they are referenced by `libz3.so`. +target_link_libraries(libz3 PRIVATE ${Z3_DEPENDENT_LIBS}) z3_append_linker_flag_list_to_target(libz3 ${Z3_DEPENDENT_EXTRA_CXX_LINK_FLAGS})