[libcxx-commits] [libcxxabi] r352688 - [CMake] Use correct visibility for linked libraries in CMake

Petr Hosek via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jan 30 15:18:05 PST 2019


Author: phosek
Date: Wed Jan 30 15:18:05 2019
New Revision: 352688

URL: http://llvm.org/viewvc/llvm-project?rev=352688&view=rev
Log:
[CMake] Use correct visibility for linked libraries in CMake

When linking library dependencies, we shouldn't need to export linked
libraries to dependents. We should be explicit about this in
target_link_libraries, otherwise other targets that depend on these such
as sanitizers get repeated (and possibly even conflicting) dependencies.

Differential Revision: https://reviews.llvm.org/D57456

Modified:
    libcxxabi/trunk/src/CMakeLists.txt

Modified: libcxxabi/trunk/src/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/CMakeLists.txt?rev=352688&r1=352687&r2=352688&view=diff
==============================================================================
--- libcxxabi/trunk/src/CMakeLists.txt (original)
+++ libcxxabi/trunk/src/CMakeLists.txt Wed Jan 30 15:18:05 2019
@@ -189,7 +189,7 @@ if (LIBCXXABI_ENABLE_SHARED)
   if(COMMAND llvm_setup_rpath)
     llvm_setup_rpath(cxxabi_shared)
   endif()
-  target_link_libraries(cxxabi_shared ${LIBCXXABI_LIBRARIES} ${LIBCXXABI_SHARED_LIBRARIES})
+  target_link_libraries(cxxabi_shared PRIVATE ${LIBCXXABI_LIBRARIES} ${LIBCXXABI_SHARED_LIBRARIES})
   set_target_properties(cxxabi_shared
                         PROPERTIES
                           CXX_EXTENSIONS
@@ -226,7 +226,7 @@ if (LIBCXXABI_ENABLE_STATIC)
     endif()
   endif()
   add_library(cxxabi_static STATIC ${cxxabi_static_sources})
-  target_link_libraries(cxxabi_static ${LIBCXXABI_LIBRARIES} ${LIBCXXABI_STATIC_LIBRARIES})
+  target_link_libraries(cxxabi_static PRIVATE ${LIBCXXABI_LIBRARIES} ${LIBCXXABI_STATIC_LIBRARIES})
   set_target_properties(cxxabi_static
                         PROPERTIES
                           CXX_EXTENSIONS




More information about the libcxx-commits mailing list