<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0); font-size: 14px; font-family: Calibri, sans-serif;">
<div>
<div>
<div>I resolved this using the option OUTPUT_STRIP_TRAILING_WHITESPACE in execute_process(). <a href="https://cmake.org/cmake/help/v3.0/command/execute_process.html">https://cmake.org/cmake/help/v3.0/command/execute_process.html</a> I had not seen it.</div>
</div>
</div>
<div><br>
</div>
<span id="OLK_SRC_BODY_SECTION">
<div style="font-family:Calibri; font-size:11pt; text-align:left; color:black; BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: #b5c4df 1pt solid; BORDER-RIGHT: medium none; PADDING-TOP: 3pt">
<span style="font-weight:bold">From: </span>Miguel Salazar <<a href="mailto:salazardetro1@llnl.gov">salazardetro1@llnl.gov</a>><br>
<span style="font-weight:bold">Date: </span>Tuesday, April 5, 2016 at 2:31 PM<br>
<span style="font-weight:bold">To: </span>Miguel Salazar <<a href="mailto:salazardetro1@llnl.gov">salazardetro1@llnl.gov</a>>, "<a href="mailto:cmake@cmake.org">cmake@cmake.org</a>" <<a href="mailto:cmake@cmake.org">cmake@cmake.org</a>><br>
<span style="font-weight:bold">Subject: </span>Re: [CMake] Finding all the libraries except for one located in the last path dir<br>
</div>
<div><br>
</div>
<div>
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
<div style="font-family: Calibri, sans-serif; font-size: 14px; color: rgb(0, 0, 0);">
<div>
<div>Sorry for the spam, but I found out that there is a line break added by CMake</div>
</div>
</div>
<div style="font-family: Calibri, sans-serif; font-size: 14px; color: rgb(0, 0, 0);">
<br>
</div>
<div>
<p style="font-size: 14px; margin: 0px;">execute_process(COMMAND bash "../grab_libraries.sh" "lib_dirs" "${METHOD}" OUTPUT_VARIABLE lib_dirs)</p>
<p style="font-size: 14px; margin: 0px;"><br>
</p>
<p style="font-size: 14px; margin: 0px;">grab_libraries.sh is located in the same folder than CMakeLists.txt and I call cmake .. from a build folder inside the same folder than CMakeLists.txt . The output for the script ./grab_libraries.sh is:</p>
<p style="font-family: Consolas; font-size: 14px; margin: 0px;"><br>
</p>
<p style="font-family: Consolas; font-size: 14px; margin: 0px;"><span style="font-family: Calibri, sans-serif;">/usr/lib;/lib;/usr/lib64;/usr/local/tools/vtk-6.1.0/lib;/g/g92/miguel/petsc-3.6.2/miguel-opt/lib;/usr/local/tools/openmpi-intel-1.8.4/lib;/usr/local/tools/ic-14.0.174/composer_xe_2013_sp1.3.174/compiler/lib/intel64;/usr/lib/gcc/x86_64-redhat-linux/4.4.7;/g/g92/miguel/code/libmesh_2D/lib;</span></p>
<p style="font-family: Consolas; font-size: 14px; margin: 0px;"><span style="font-family: Calibri, sans-serif;"><br>
</span></p>
<p style="font-family: Consolas; font-size: 14px; margin: 0px;"><span style="font-family: Calibri, sans-serif;">with no line break, whereas the output variable lib_dirs:</span></p>
<p style="margin: 0px;"><font face="Calibri,sans-serif">message(${lib_dirs})</font></p>
<p style="margin: 0px;"><font face="Calibri,sans-serif"><br>
</font></p>
<p style="margin: 0px;"><span style="font-family: Calibri, sans-serif; font-size: 14px;">/usr/lib/lib/usr/lib64/usr/local/tools/vtk-6.1.0/lib/g/g92/miguel/petsc-3.6.2/miguel-opt/lib/usr/local/tools/openmpi-intel-1.8.4/lib/usr/local/tools/ic-14.0.174/composer_xe_2013_sp1.3.174/compiler/lib/intel64/usr/lib/gcc/x86_64-redhat-linux/4.4.7/g/g92/miguel/code/libmesh_2D/lib</span></p>
<p style="margin: 0px;"><span style="font-family: Calibri, sans-serif; font-size: 14px;"><br>
</span></p>
<p style="margin: 0px;"><font face="Calibri,sans-serif">does have a line break and also the semicolons are removed. What’s happening here and how can I get rid of that?</font></p>
<p style="margin: 0px;"><font face="Calibri,sans-serif"><br>
</font></p>
<p style="margin: 0px;"><font face="Calibri,sans-serif">Thanks</font></p>
<p style="margin: 0px;"><font face="Calibri,sans-serif">Miguel</font></p>
<p style="margin: 0px;"><font face="Calibri,sans-serif"><br>
</font></p>
</div>
<span id="OLK_SRC_BODY_SECTION" style="font-family: Calibri, sans-serif; font-size: 14px; color: rgb(0, 0, 0);">
<div style="font-family:Calibri; font-size:11pt; text-align:left; color:black; BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: #b5c4df 1pt solid; BORDER-RIGHT: medium none; PADDING-TOP: 3pt">
<span style="font-weight:bold">From: </span>Miguel Salazar <<a href="mailto:salazardetro1@llnl.gov">salazardetro1@llnl.gov</a>><br>
<span style="font-weight:bold">Date: </span>Tuesday, April 5, 2016 at 1:57 PM<br>
<span style="font-weight:bold">To: </span>Miguel Salazar <<a href="mailto:salazardetro1@llnl.gov">salazardetro1@llnl.gov</a>>, "<a href="mailto:cmake@cmake.org">cmake@cmake.org</a>" <<a href="mailto:cmake@cmake.org">cmake@cmake.org</a>><br>
<span style="font-weight:bold">Subject: </span>Re: [CMake] Finding all the libraries except for one located in the last path dir<br>
</div>
<div><br>
</div>
<div>
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0); font-size: 14px; font-family: Calibri, sans-serif;">
<div>
<div>
<div>My apologies, the previous error was because of a trailing whitespace. Although I would still like to know why the terminal variable </div>
</div>
</div>
<div><br>
</div>
<div>/usr/lib;/lib;/usr/lib64;/usr/local/tools/vtk-6.1.0/lib;/g/g92/miguel/petsc-3.6.2/miguel-opt/lib;/usr/local/tools/openmpi-intel-1.8.4/lib;/usr/local/tools/ic-14.0.174/composer_xe_2013_sp1.3.174/compiler/lib/intel64;/usr/lib/gcc/x86_64-redhat-linux/4.4.7;/g/g92/miguel/code/libmesh_2D/lib;</div>
<div><br>
</div>
<div>is transformed into </div>
<div><br>
</div>
<div>/usr/lib/lib/usr/lib64/usr/local/tools/vtk-6.1.0/lib/g/g92/miguel/petsc-3.6.2/miguel-opt/lib/usr/local/tools/openmpi-intel-1.8.4/lib/usr/local/tools/ic-14.0.174/composer_xe_2013_sp1.3.174/compiler/lib/intel64/usr/lib/gcc/x86_64-redhat-linux/4.4.7/g/g92/miguel/code/libmesh_2D/lib</div>
<div><br>
</div>
<div>Miguel</div>
<span id="OLK_SRC_BODY_SECTION">
<div style="font-family:Calibri; font-size:11pt; text-align:left; color:black; BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: #b5c4df 1pt solid; BORDER-RIGHT: medium none; PADDING-TOP: 3pt">
<span style="font-weight:bold">From: </span>CMake <<a href="mailto:cmake-bounces@cmake.org">cmake-bounces@cmake.org</a>> on behalf of Miguel Salazar <<a href="mailto:salazardetro1@llnl.gov">salazardetro1@llnl.gov</a>><br>
<span style="font-weight:bold">Date: </span>Tuesday, April 5, 2016 at 12:55 PM<br>
<span style="font-weight:bold">To: </span>"<a href="mailto:cmake@cmake.org">cmake@cmake.org</a>" <<a href="mailto:cmake@cmake.org">cmake@cmake.org</a>><br>
<span style="font-weight:bold">Subject: </span>[CMake] Finding all the libraries except for one located in the last path dir<br>
</div>
<div><br>
</div>
<div>
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; font-size: 14px;">
<div style="color: rgb(0, 0, 0);">Hello</div>
<div style="color: rgb(0, 0, 0);"><br>
</div>
<div style="color: rgb(0, 0, 0);">I am calling find_library in a loop, using the same variable for HINTS. This variable (lib_dirs) is set using a script, and when I simply print it using message(), I obtain this output:</div>
<div style="color: rgb(0, 0, 0);"><br>
</div>
<div style="color: rgb(0, 0, 0);">message(${lib_dirs})</div>
<div style="color: rgb(0, 0, 0);"><br>
</div>
<div>
<p style="margin: 0px;">/usr/lib/lib/usr/lib64/usr/local/tools/vtk-6.1.0/lib/g/g92/miguel/petsc-3.6.2/miguel-opt/lib/usr/local/tools/openmpi-intel-1.8.4/lib/usr/local/tools/ic-14.0.174/composer_xe_2013_sp1.3.174/compiler/lib/intel64/usr/lib/gcc/x86_64-redhat-linux/4.4.7/g/g92/miguel/code/libmesh_2D/lib</p>
<p style="margin: 0px;"><br>
</p>
<p style="margin: 0px;">The variable lib_dirs is the output variable of a script that I call using execute_process(). The actual script output (in the terminal) is </p>
<p style="margin: 0px;"><br>
</p>
<p style="margin: 0px;">/usr/lib;/lib;/usr/lib64;/usr/local/tools/vtk-6.1.0/lib;/g/g92/miguel/petsc-3.6.2/miguel-opt/lib;/usr/local/tools/openmpi-intel-1.8.4/lib;/usr/local/tools/ic-14.0.174/composer_xe_2013_sp1.3.174/compiler/lib/intel64;/usr/lib/gcc/x86_64-redhat-linux/4.4.7;/g/g92/miguel/code/libmesh_2D/lib;</p>
<p style="margin: 0px;"><br>
</p>
<p style="margin: 0px;">but cmakes removes all the semicolons and puts them all together, why?</p>
<p style="margin: 0px;"><br>
</p>
<p style="margin: 0px;">Now when I call find_library() for several libraries, I can find them all except the one located in /g/g92/miguel/code/libmesh_2D/lib, why?</p>
<p style="margin: 0px;"><br>
</p>
<p style="margin: 0px;">Thanks</p>
<p style="margin: 0px;">Miguel</p>
<p style="margin: 0px;"><br>
</p>
<p style="margin: 0px; font-family: Consolas;"><br>
</p>
</div>
<br>
</div>
</div>
</span></div>
</div>
</span></div>
</div>
</span>
</body>
</html>