<div dir="ltr">Oh come now, we have cross-compilation ;-)<div><br></div><div>That said, I'd like to try this out locally before you submit, but it might be tomorrow.</div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Dec 5, 2017 at 2:19 PM Shoaib Meenai <<a href="mailto:smeenai@fb.com">smeenai@fb.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">







<div bgcolor="white" lang="EN-US" link="blue" vlink="purple">
<div class="m_-6321001699321046192WordSection1">
<p class="MsoNormal">I didn't, because I didn't have easy access to a Windows LLVM setup (I need to get that working again). I don't see a reason for many platform-specific differences here, but I am monitoring the bots closely to make sure nothing breaks.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:12.0pt;color:black">From: </span></b><span style="font-size:12.0pt;color:black">Zachary Turner <<a href="mailto:zturner@google.com" target="_blank">zturner@google.com</a>><br>
<b>Date: </b>Tuesday, December 5, 2017 at 2:07 PM<br>
<b>To: </b>Shoaib Meenai <<a href="mailto:smeenai@fb.com" target="_blank">smeenai@fb.com</a>><br>
<b>Cc: </b>"<a href="mailto:lldb-commits@lists.llvm.org" target="_blank">lldb-commits@lists.llvm.org</a>" <<a href="mailto:lldb-commits@lists.llvm.org" target="_blank">lldb-commits@lists.llvm.org</a>><br>
<b>Subject: </b>Re: [Lldb-commits] [lldb] r319840 - [CMake] Use PRIVATE in target_link_libraries for executables<u></u><u></u></span></p>
</div></div></div><div bgcolor="white" lang="EN-US" link="blue" vlink="purple"><div class="m_-6321001699321046192WordSection1">
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Can you / did you try this on Windows?  I don't see any reason why it wouldn't work, but I remember having difficulty with all this CMake some time ago.<u></u><u></u></p>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal">On Tue, Dec 5, 2017 at 1:50 PM Shoaib Meenai via lldb-commits <<a href="mailto:lldb-commits@lists.llvm.org" target="_blank">lldb-commits@lists.llvm.org</a>> wrote:<u></u><u></u></p>
</div>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal">Author: smeenai<br>
Date: Tue Dec  5 13:49:56 2017<br>
New Revision: 319840<br>
<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D319840-26view-3Drev&d=DwMFaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=CnV7n6Ko5mCcbjGWZ4ObFe8oScFwBWBh6b5DQozSnxE&s=jgpur1XN4mrubAWTFVwv6eiWiVm-VcjEBApZCdrjLNs&e=" target="_blank">
http://llvm.org/viewvc/llvm-project?rev=319840&view=rev</a><br>
Log:<br>
[CMake] Use PRIVATE in target_link_libraries for executables<br>
<br>
We currently use target_link_libraries without an explicit scope<br>
specifier (INTERFACE, PRIVATE or PUBLIC) when linking executables.<br>
Dependencies added in this way apply to both the target and its<br>
dependencies, i.e. they become part of the executable's link interface<br>
and are transitive.<br>
<br>
Transitive dependencies generally don't make sense for executables,<br>
since you wouldn't normally be linking against an executable. This also<br>
causes issues for generating install export files when using<br>
LLVM_DISTRIBUTION_COMPONENTS. For example, clang has a lot of LLVM<br>
library dependencies, which are currently added as interface<br>
dependencies. If clang is in the distribution components but the LLVM<br>
libraries it depends on aren't (which is a perfectly legitimate use case<br>
if the LLVM libraries are being built static and there are therefore no<br>
run-time dependencies on them), CMake will complain about the LLVM<br>
libraries not being in export set when attempting to generate the<br>
install export file for clang. This is reasonable behavior on CMake's<br>
part, and the right thing is for LLVM's build system to explicitly use<br>
PRIVATE dependencies for executables.<br>
<br>
Unfortunately, CMake doesn't allow you to mix and match the keyword and<br>
non-keyword target_link_libraries signatures for a single target; i.e.,<br>
if a single call to target_link_libraries for a particular target uses<br>
one of the INTERFACE, PRIVATE, or PUBLIC keywords, all other calls must<br>
also be updated to use those keywords. This means we must do this change<br>
in a single shot. I also fully expect to have missed some instances; I<br>
tested by enabling all the projects in the monorepo (except dragonegg),<br>
and configuring both with and without shared libraries, on both Darwin<br>
and Linux, but I'm planning to rely on the buildbots for other<br>
configurations (since it should be pretty easy to fix those).<br>
<br>
Even after this change, we still have a lot of target_link_libraries<br>
calls that don't specify a scope keyword, mostly for shared libraries.<br>
I'm thinking about addressing those in a follow-up, but that's a<br>
separate change IMO.<br>
<br>
Differential Revision: <a href="https://urldefense.proofpoint.com/v2/url?u=https-3A__reviews.llvm.org_D40823&d=DwMFaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=CnV7n6Ko5mCcbjGWZ4ObFe8oScFwBWBh6b5DQozSnxE&s=F1t4w68fsg6CjlgcP1s0P93A8ScHtutPHn3pgJt9jJo&e=" target="_blank">
https://reviews.llvm.org/D40823</a><br>
<br>
<br>
Modified:<br>
    lldb/trunk/cmake/modules/AddLLDB.cmake<br>
    lldb/trunk/unittests/CMakeLists.txt<br>
    lldb/trunk/unittests/Interpreter/CMakeLists.txt<br>
<br>
Modified: lldb/trunk/cmake/modules/AddLLDB.cmake<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_lldb_trunk_cmake_modules_AddLLDB.cmake-3Frev-3D319840-26r1-3D319839-26r2-3D319840-26view-3Ddiff&d=DwMFaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=CnV7n6Ko5mCcbjGWZ4ObFe8oScFwBWBh6b5DQozSnxE&s=VabZwbj9vO8KCXgjqdmhFSGEMTkOFstdqG6pzEV5WpM&e=" target="_blank">
http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/AddLLDB.cmake?rev=319840&r1=319839&r2=319840&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/cmake/modules/AddLLDB.cmake (original)<br>
+++ lldb/trunk/cmake/modules/AddLLDB.cmake Tue Dec  5 13:49:56 2017<br>
@@ -92,7 +92,7 @@ function(add_lldb_executable name)<br>
   list(APPEND LLVM_LINK_COMPONENTS ${ARG_LINK_COMPONENTS})<br>
   add_llvm_executable(${name} ${ARG_UNPARSED_ARGUMENTS})<br>
<br>
-  target_link_libraries(${name} ${ARG_LINK_LIBS})<br>
+  target_link_libraries(${name} PRIVATE ${ARG_LINK_LIBS})<br>
   set_target_properties(${name} PROPERTIES<br>
     FOLDER "lldb executables")<br>
<br>
<br>
Modified: lldb/trunk/unittests/CMakeLists.txt<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_lldb_trunk_unittests_CMakeLists.txt-3Frev-3D319840-26r1-3D319839-26r2-3D319840-26view-3Ddiff&d=DwMFaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=CnV7n6Ko5mCcbjGWZ4ObFe8oScFwBWBh6b5DQozSnxE&s=QVL5tF9VvVyPWpxaRvlsnKRNuc_JmyIraylLQViPPTs&e=" target="_blank">
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/CMakeLists.txt?rev=319840&r1=319839&r2=319840&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/unittests/CMakeLists.txt (original)<br>
+++ lldb/trunk/unittests/CMakeLists.txt Tue Dec  5 13:49:56 2017<br>
@@ -44,7 +44,7 @@ function(add_lldb_unittest test_name)<br>
     POST_BUILD<br>
     COMMAND "${CMAKE_COMMAND}" -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/Inputs)<br>
<br>
-  target_link_libraries(${test_name} ${ARG_LINK_LIBS})<br>
+  target_link_libraries(${test_name} PRIVATE ${ARG_LINK_LIBS})<br>
 endfunction()<br>
<br>
 function(add_unittest_inputs test_name inputs)<br>
<br>
Modified: lldb/trunk/unittests/Interpreter/CMakeLists.txt<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_lldb_trunk_unittests_Interpreter_CMakeLists.txt-3Frev-3D319840-26r1-3D319839-26r2-3D319840-26view-3Ddiff&d=DwMFaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=CnV7n6Ko5mCcbjGWZ4ObFe8oScFwBWBh6b5DQozSnxE&s=mKTxMMXxgDo1bn5EEsAyKTP_piQ03SMItebwHr0t4Kk&e=" target="_blank">
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Interpreter/CMakeLists.txt?rev=319840&r1=319839&r2=319840&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/unittests/Interpreter/CMakeLists.txt (original)<br>
+++ lldb/trunk/unittests/Interpreter/CMakeLists.txt Tue Dec  5 13:49:56 2017<br>
@@ -8,5 +8,6 @@ add_lldb_unittest(InterpreterTests<br>
   )<br>
<br>
 target_link_libraries(InterpreterTests<br>
+  PRIVATE<br>
   ${PYTHON_LIBRARY}<br>
   )<br>
<br>
<br>
_______________________________________________<br>
lldb-commits mailing list<br>
<a href="mailto:lldb-commits@lists.llvm.org" target="_blank">lldb-commits@lists.llvm.org</a><br>
<a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_lldb-2Dcommits&d=DwMFaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=CnV7n6Ko5mCcbjGWZ4ObFe8oScFwBWBh6b5DQozSnxE&s=gDB7hBPs481QNdvPe15aBj56UoMVTKLPURlbXP2pjgQ&e=" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits</a><u></u><u></u></p>
</blockquote>
</div>
</div></div></blockquote></div>