<br><br>
<div class="gmail_quote">On Wed, Aug 10, 2011 at 9:51 PM, Michael Hertling <span dir="ltr">&lt;<a href="mailto:mhertling@online.de">mhertling@online.de</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div>
<div></div>
<div class="h5">On 08/10/2011 04:27 PM, Stephen Torri wrote:<br>&gt; I am having a problem setting up CMake to find the Boost unit test framework<br>&gt; library when building a test program. In the top level CMakeLists.txt file I<br>
&gt; have:<br>&gt;<br>&gt; ENABLE_TESTING()<br>&gt;<br>&gt; add_subdirectory ( path/to/test )<br>&gt;<br>&gt; In the test directory CMakeLists.txt file I have:<br>&gt;<br>&gt; LINK_DIRECTORIES ( ${Boost_LIBRARY_DIRS} )<br>
&gt; ADD_EXECUTABLE ( test test.cpp )<br>&gt; ADD_TEST ( test ${CMAKE_CURRENT_BINARY_DIR}/test )<br>&gt;<br>&gt; I added the LINK_DIRECTORIES because I though that the linker was not<br>&gt; getting the path to the Boost library. That is wrong since the full path to<br>
&gt; the library is in the properties for this project. So I figured since it had<br>&gt; the full name it should be able to find it. Not quite.<br>&gt;<br>&gt; The error message I get says:<br>&gt;<br>&gt; LNK1104: cannot open file &#39;boost_unit_test_framework-vc90-mt-gd-1_45.lib&#39;<br>
&gt;<br>&gt; I have boost installed in C:\boost. The FIND_BOOST macro able to find the<br>&gt; installation headers and libraries I require. The only thing that is<br>&gt; different is that the directory has the Boost unit test framework named as:<br>
&gt;<br>&gt; C:\boost\lib\libboost_unit_test_framework-vc90-mt-gd-1_45.lib<br>&gt;<br>&gt; That name, libboost_unit_test...., is different from the expected name of<br>&gt; boost_unit_test...<br>&gt;<br>&gt; I am at a loss as to why this is the case.<br>
&gt;<br>&gt; CMake version: 2.8.4<br>&gt; Boost version: 1.45<br>&gt;<br>&gt; Stephen<br><br></div></div>Could you provide a minimal but complete example that demonstrates<br>the issue, perhaps along with the output from the build phase?<br>
<br>Regards,<br><br>Michael<br></blockquote>
<div>Attached is a minimal example that shows the problem. Below is the output from the build log:</div>
<div> </div>
<div><font face="Consolas">--------------------</font></div>
<div><font face="Consolas">build.log</font></div>
<div><font face="Consolas">--------------------</font></div>
<div><font face="Consolas"></font> </div>
<div>
<p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font face="Consolas" size="3">Creating temporary file &quot;c:\Documents and Settings\Stephen.Torri\My Documents\Visual Studio 2008\Projects\problem_boost_test\vs2008\mycode\Testing\test.dir\Debug\RSP00001A37404960.rsp&quot; with contents</font></p>

<p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font face="Consolas" size="3">[</font></p>
<p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font face="Consolas" size="3">/Od /I &quot;C:\boost&quot; /I &quot;C:\Documents and Settings\Stephen.Torri\My Documents\Visual Studio 2008\Projects\problem_boost_test&quot; /D &quot;WIN32&quot; /D &quot;_WINDOWS&quot; /D &quot;_DEBUG&quot; /D &quot;CMAKE_INTDIR=\&quot;Debug\&quot;&quot; /D &quot;_MBCS&quot; /FD /EHsc /RTC1 /MDd /Fo&quot;test.dir\Debug\\&quot; /Fd&quot;C:\Documents and Settings\Stephen.Torri\My Documents\Visual Studio 2008\Projects\problem_boost_test\vs2008\mycode\Testing\Debug/test.pdb&quot; /W3 /c /Zi /TP<span style="mso-spacerun: yes">   </span>/Zm1000</font></p>

<p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font face="Consolas" size="3"> </font></p>
<p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font face="Consolas" size="3">&quot;..\..\..\mycode\Testing\test.cpp&quot;</font></p>
<p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font face="Consolas" size="3">]</font></p>
<p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font face="Consolas" size="3">Creating command line &quot;cl.exe @&quot;c:\Documents and Settings\Stephen.Torri\My Documents\Visual Studio 2008\Projects\problem_boost_test\vs2008\mycode\Testing\test.dir\Debug\RSP00001A37404960.rsp&quot; /nologo /errorReport:prompt&quot;</font></p>

<p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font face="Consolas" size="3">Creating temporary file &quot;c:\Documents and Settings\Stephen.Torri\My Documents\Visual Studio 2008\Projects\problem_boost_test\vs2008\mycode\Testing\test.dir\Debug\RSP00001C37404960.rsp&quot; with contents</font></p>

<p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font face="Consolas" size="3">[</font></p>
<p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font face="Consolas" size="3">/OUT:&quot;C:\Documents and Settings\Stephen.Torri\My Documents\Visual Studio 2008\Projects\problem_boost_test\vs2008\mycode\Testing\Debug\test.exe&quot; /VERSION:0.0 /INCREMENTAL /MANIFEST /MANIFESTFILE:&quot;test.dir\Debug\test.exe.intermediate.manifest&quot; /MANIFESTUAC:&quot;level=&#39;asInvoker&#39; uiAccess=&#39;false&#39;&quot; /DEBUG /PDB:&quot;C:\Documents and Settings\Stephen.Torri\My Documents\Visual Studio 2008\Projects\problem_boost_test\vs2008\mycode\Testing\Debug/test.pdb&quot; /SUBSYSTEM:CONSOLE /DYNAMICBASE /NXCOMPAT /IMPLIB:&quot;C:\Documents and Settings\Stephen.Torri\My Documents\Visual Studio 2008\Projects\problem_boost_test\vs2008\mycode\Testing\Debug\test.lib&quot;<span style="mso-spacerun: yes">  </span>/STACK:10000000 /machine:X86 /debug kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib</font></p>

<p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font face="Consolas" size="3"> </font></p>
<p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font face="Consolas" size="3">&quot;.\test.dir\Debug\test.obj&quot;</font></p>
<p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font face="Consolas" size="3"> </font></p>
<p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font face="Consolas" size="3">&quot;.\test.dir\Debug\test.exe.embed.manifest.res&quot;</font></p>
<p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font face="Consolas" size="3">]</font></p>
<p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font face="Consolas" size="3">Creating command line &quot;link.exe @&quot;c:\Documents and Settings\Stephen.Torri\My Documents\Visual Studio 2008\Projects\problem_boost_test\vs2008\mycode\Testing\test.dir\Debug\RSP00001C37404960.rsp&quot; /NOLOGO /ERRORREPORT:PROMPT&quot;</font></p>

<p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font face="Consolas" size="3"></font> </p>
<p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font face="Consolas" size="3">--------------------</font></p>
<p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font face="Consolas" size="3">Build output</font></p>
<p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font face="Consolas" size="3">--------------------</font></p>
<p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"> </p>
<p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font face="Consolas" size="3">1&gt;------ Skipped Build: Project: RUN_TESTS, Configuration: Debug Win32 ------</font></p>
<p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font face="Consolas" size="3">1&gt;Project not selected to build for this solution configuration </font></p>
<p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font face="Consolas" size="3">2&gt;------ Build started: Project: mycode, Configuration: Debug Win32 ------</font></p>
<p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font face="Consolas" size="3">3&gt;------ Build started: Project: test, Configuration: Debug Win32 ------</font></p>
<p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font face="Consolas" size="3">2&gt;Compiling...</font></p>
<p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font face="Consolas" size="3">3&gt;Compiling...</font></p>
<p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font face="Consolas" size="3">2&gt;mycode.cpp</font></p>
<p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font face="Consolas" size="3">3&gt;test.cpp</font></p>
<p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font face="Consolas" size="3">2&gt;Creating library...</font></p>
<p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font face="Consolas" size="3">2&gt;Build log was saved at &quot;</font><a href="file:///c:/Documents%20and%20Settings/Stephen.Torri/My%20Documents/Visual%20Studio%202008/Projects/problem_boost_test/vs2008/mycode/mycode.dir/Debug/BuildLog.htm"><font face="Consolas" size="3">file://c:\Documents and Settings\Stephen.Torri\My Documents\Visual Studio 2008\Projects\problem_boost_test\vs2008\mycode\mycode.dir\Debug\BuildLog.htm</font></a><font face="Consolas" size="3">&quot;</font></p>

<p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font face="Consolas" size="3">2&gt;mycode - 0 error(s), 0 warning(s)</font></p>
<p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font face="Consolas" size="3">3&gt;Linking...</font></p>
<p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font face="Consolas" size="3">3&gt;LINK : fatal error LNK1104: cannot open file &#39;boost_unit_test_framework-vc90-mt-gd-1_45.lib&#39;</font></p>
<p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font face="Consolas" size="3">3&gt;Build log was saved at &quot;</font><a href="file:///c:/Documents%20and%20Settings/Stephen.Torri/My%20Documents/Visual%20Studio%202008/Projects/problem_boost_test/vs2008/mycode/Testing/test.dir/Debug/BuildLog.htm"><font face="Consolas" size="3">file://c:\Documents and Settings\Stephen.Torri\My Documents\Visual Studio 2008\Projects\problem_boost_test\vs2008\mycode\Testing\test.dir\Debug\BuildLog.htm</font></a><font face="Consolas" size="3">&quot;</font></p>

<p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font face="Consolas" size="3">3&gt;test - 1 error(s), 0 warning(s)</font></p>
<p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font face="Consolas" size="3">4&gt;------ Skipped Build: Project: ALL_BUILD, Configuration: Debug Win32 ------</font></p>
<p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font face="Consolas" size="3">4&gt;Project not selected to build for this solution configuration </font></p>
<p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font face="Consolas" size="3">========== Build: 1 succeeded, 1 failed, 1 up-to-date, 2 skipped ==========</font></p>
<p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font face="Consolas" size="3"> </font></p>
<p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font face="Consolas" size="3"> </font></p>
<p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"> </p></div></div>