[libcxx-commits] [PATCH] D57456: [CMake] Use correct visibility for linked libraries in CMake

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


This revision was automatically updated to reflect the committed changes.
Closed by commit rCXX352688: [CMake] Use correct visibility for linked libraries in CMake (authored by phosek, committed by ).
Herald added a subscriber: libcxx-commits.

Changed prior to commit:
  https://reviews.llvm.org/D57456?vs=184384&id=184386#toc

Repository:
  rCXX libc++

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D57456/new/

https://reviews.llvm.org/D57456

Files:
  benchmarks/CMakeLists.txt
  lib/CMakeLists.txt


Index: benchmarks/CMakeLists.txt
===================================================================
--- benchmarks/CMakeLists.txt
+++ benchmarks/CMakeLists.txt
@@ -137,6 +137,7 @@
   add_executable(${libcxx_target} EXCLUDE_FROM_ALL ${source_file})
   add_dependencies(${libcxx_target} cxx cxx-headers google-benchmark-libcxx)
   add_dependencies(cxx-benchmarks ${libcxx_target})
+  target_link_libraries(${libcxx_target} ${LIBCXX_LIBRARIES})
   if (LIBCXX_ENABLE_SHARED)
     target_link_libraries(${libcxx_target} cxx_shared)
   else()
Index: lib/CMakeLists.txt
===================================================================
--- lib/CMakeLists.txt
+++ lib/CMakeLists.txt
@@ -241,7 +241,7 @@
   if(COMMAND llvm_setup_rpath)
     llvm_setup_rpath(cxx_shared)
   endif()
-  target_link_libraries(cxx_shared ${LIBCXX_LIBRARIES})
+  target_link_libraries(cxx_shared PRIVATE ${LIBCXX_LIBRARIES})
   set_target_properties(cxx_shared
     PROPERTIES
       LINK_FLAGS    "${LIBCXX_LINK_FLAGS}"
@@ -265,7 +265,7 @@
 # Build the static library.
 if (LIBCXX_ENABLE_STATIC)
   add_library(cxx_static STATIC ${cxx_static_sources})
-  target_link_libraries(cxx_static ${LIBCXX_LIBRARIES})
+  target_link_libraries(cxx_static PRIVATE ${LIBCXX_LIBRARIES})
   set(CMAKE_STATIC_LIBRARY_PREFIX "lib")
   set_target_properties(cxx_static
     PROPERTIES
@@ -461,3 +461,8 @@
                       -P "${LIBCXX_BINARY_DIR}/cmake_install.cmake")
     add_custom_target(install-libcxx DEPENDS install-cxx)
 endif()
+
+# TODO: This is needed by cxx-benchmarks but this variable isn't
+# available outside of the scope of this file so we need to export
+# it. This is not necessarily the cleanest solution.
+set(LIBCXX_LIBRARIES ${LIBCXX_LIBRARIES} PARENT_SCOPE)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57456.184386.patch
Type: text/x-patch
Size: 1745 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20190130/7478a616/attachment.bin>


More information about the libcxx-commits mailing list