<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Title" content="">
<meta name="Keywords" content="">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
span.msoIns
        {mso-style-type:export-only;
        mso-style-name:"";
        text-decoration:underline;
        color:teal;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style>
</head>
<body bgcolor="white" lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<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.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></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 <zturner@google.com><br>
<b>Date: </b>Tuesday, December 5, 2017 at 2:07 PM<br>
<b>To: </b>Shoaib Meenai <smeenai@fb.com><br>
<b>Cc: </b>"lldb-commits@lists.llvm.org" <lldb-commits@lists.llvm.org><br>
<b>Subject: </b>Re: [Lldb-commits] [lldb] r319840 - [CMake] Use PRIVATE in target_link_libraries for executables<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></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.<o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></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">lldb-commits@lists.llvm.org</a>> wrote:<o:p></o:p></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><o:p></o:p></p>
</blockquote>
</div>
</div>
</body>
</html>