<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
 Hi Alex,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
There are two concepts: CMAKE_INSTALL_PREFIX and DESTDIR, that I think you need to apply now.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
As a refresher, here is my understanding. CMAKE_INSTALL_PREFIX must be set to the directory, where the artifacts should reside in the custom os. That is most probably "/usr". That should set the the RPATH correctly.<br>
</div>
<br>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
However, from packaging point of view, this causes a little trouble. Because when someone calls make install, the artifacts will be installed to CMAKE_INSTALL_PREFIX, merging the new files with the build OS files. And from that it is very hard to collect the
 artifacts properly.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
That is what DESTDIR is intended to resolve. Instead of calling make install, one needs to call make DESTDIR=<abs path to artifact directory> install. That will create the same structure that would have been created in CMAKE_INSTALL_PREFIX, just in $DESTDIR/$CMAKE_INSTALL_PREFIX.
 From that you can call targz or anything on the directory to collect the artifacts.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
For example: after</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
$ cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DENABLE_JAVA=no</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
$ make -j</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
$ <span>mkdir /tmp/result<br>
</span><span></span>$ make DESTDIR=/tmp/result install</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
created a /tmp/result/usr/sbin/syslog-ng etc files, but with RPATH:</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span><br>
</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span>$ objdump -x /tmp/result/usr/sbin/syslog-ng |grep RPATH<br>
</span>
<div>  RPATH                /usr/lib<br>
</div>
<span></span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
as expected.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
I am afraid I do not know how to translate these into ExternalProject_add though.<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Br,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
  Antal<br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> syslog-ng <syslog-ng-bounces@lists.balabit.hu> on behalf of Alexandre Santos <alexandre.rosas.santos@gmail.com><br>
<b>Sent:</b> Monday, November 4, 2019 19:40<br>
<b>To:</b> syslog-ng@lists.balabit.hu <syslog-ng@lists.balabit.hu><br>
<b>Subject:</b> [syslog-ng] Building syslog with cmake as external project</font>
<div> </div>
</div>
<div>
<div style="background-color:#FFEB9C; width:100%; border-style:solid; border-color:#9C6500; border-width:1pt; padding:2pt; font-size:10pt; line-height:12pt; font-family:'Calibri'; color:Black; text-align:left">
<span style="color:#9C6500; font-weight:bold">CAUTION:</span> This email originated from outside of the organization. Do not follow guidance, click links, or open attachments unless you recognize the sender and know the content is safe.</div>
<br>
<div>
<div dir="ltr">
<div><font size="2">Hi All,</font></div>
<div><font size="2"><br>
</font></div>
<div><font size="2">I am trying to build syslog-ng with cmake to add it to a custom Linux distribution.</font></div>
<div><font size="2"><br>
</font></div>
<div><font size="2">The problem is that when the syslog-ng is compiled it gets the RPATH of the location where it has been generated:
<br>
</font></div>
<div><font size="2"><br>
</font></div>
<div><b><font size="2"><span style="font-family:monospace">root@5526d87140af:/home/src/</span></font></b><b><font size="2"><span style="font-family:monospace">chassisx/build# ldd syslog-ng-install/sbin/syslog-</span></font></b><b><font size="2"><span style="font-family:monospace">ng<br>
        linux-vdso.so.1 (0x00007fff151ed000)<br>
        libsyslog-ng.so.3.24.1 =><span style="color:rgb(255,0,0)"> /home/src/target/build/</span></span></font></b><span style="color:rgb(255,0,0)"><b><font size="2"><span style="font-family:monospace">syslog-ng-install/lib/</span></font></b></span><b><font size="2"><span style="font-family:monospace"><span style="color:rgb(255,0,0)">libsyslog-ng.so.3.24.1
</span>(0x00007f81baf89000)<br>
        libeventlog.so => <span style="color:rgb(255,0,0)">/home/src/target/build/</span></span></font></b><span style="color:rgb(255,0,0)"><b><font size="2"><span style="font-family:monospace">syslog-ng-install/lib/</span></font></b></span><b><font size="2"><span style="font-family:monospace"><span style="color:rgb(255,0,0)">libeventlog.so</span>
 (0x00007f81bad84000)<br>
        libgmodule-2.0.so.0 => /usr/lib/x86_64-linux-gnu/</span></font></b><b><font size="2"><span style="font-family:monospace">libgmodule-2.0.so.0 (0x00007f81bab80000)<br>
        libgthread-2.0.so.0 => /usr/lib/x86_64-linux-gnu/</span></font></b><b><font size="2"><span style="font-family:monospace">libgthread-2.0.so.0 (0x00007f81ba97e000)<br>
        libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-</span></font></b><b><font size="2"><span style="font-family:monospace">2.0.so.0 (0x00007f81ba66a000)<br>
        libivykis.so.0 => <span style="color:rgb(255,0,0)">/home/src/target/build/</span></span></font></b><span style="color:rgb(255,0,0)"><b><font size="2"><span style="font-family:monospace">syslog-ng-install/lib/</span></font></b></span><b><font size="2"><span style="font-family:monospace"><span style="color:rgb(255,0,0)">libivykis.so.0</span>
 (0x00007f81ba45b000)<br>
        libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.</span></font></b><b><font size="2"><span style="font-family:monospace">so.3 (0x00007f81ba1e8000)<br>
        libresolv.so.2 => /lib/x86_64-linux-gnu/</span></font></b><b><font size="2"><span style="font-family:monospace">libresolv.so.2 (0x00007f81b9fd1000)<br>
        libssl.so.1.1 => /usr/lib/x86_64-linux-gnu/</span></font></b><b><font size="2"><span style="font-family:monospace">libssl.so.1.1 (0x00007f81b9d65000)<br>
        libcrypto.so.1.1 => /usr/lib/x86_64-linux-gnu/</span></font></b><b><font size="2"><span style="font-family:monospace">libcrypto.so.1.1 (0x00007f81b98cc000)<br>
        libsecret-storage.so => <span style="color:rgb(255,0,0)">/home/src/target/build/</span></span></font></b><span style="color:rgb(255,0,0)"><b><font size="2"><span style="font-family:monospace">syslog-ng-install/lib/</span></font></b></span><b><font size="2"><span style="font-family:monospace"><span style="color:rgb(255,0,0)">libsecret-storage.so
</span>(0x00007f81b96c8000)<br>
        libpthread.so.0 => /lib/x86_64-linux-gnu/</span></font></b><b><font size="2"><span style="font-family:monospace">libpthread.so.0 (0x00007f81b94ab000)<br>
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.</span></font></b><b><font size="2"><span style="font-family:monospace">6 (0x00007f81b910c000)<br>
        /lib64/ld-linux-x86-64.so.2 (0x00007f81bb48e000)<br>
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.</span></font></b><b><font size="2"><span style="font-family:monospace">so.2 (0x00007f81b8f08000)</span></font></b></div>
<div><span style="font-family:monospace"></span></div>
<br>
<div><span style="font-family:monospace"><font face="arial,sans-serif"><font size="2">I am using the cmake file in attachment.</font></font></span></div>
<div><span style="font-family:monospace"><font face="arial,sans-serif"><font size="2"></font></font></span></div>
<div><span style="font-family:monospace"><font face="arial,sans-serif"><font size="2"><br>
</font></font></span></div>
<div><span style="font-family:monospace"><font face="arial,sans-serif"><font size="2">Can you help me?</font></font></span></div>
<div><span style="font-family:monospace"><font face="arial,sans-serif"><font size="2">Thanks in advance,</font></font></span></div>
<div><span style="font-family:monospace"><font face="arial,sans-serif"><font size="2"><br>
</font></font></span></div>
<div><span style="font-family:monospace"><font face="arial,sans-serif"><font size="2">Alex<br>
</font></font></span></div>
<div><span style="font-family:monospace"><font face="arial,sans-serif"><font size="2"><br>
</font></font></span></div>
</div>
</div>
</div>
</body>
</html>