<br><br>
<div class="gmail_quote">On Wed, Aug 10, 2011 at 9:51 PM, Michael Hertling <span dir="ltr"><<a href="mailto:mhertling@online.de">mhertling@online.de</a>></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>> I am having a problem setting up CMake to find the Boost unit test framework<br>> library when building a test program. In the top level CMakeLists.txt file I<br>
> have:<br>><br>> ENABLE_TESTING()<br>><br>> add_subdirectory ( path/to/test )<br>><br>> In the test directory CMakeLists.txt file I have:<br>><br>> LINK_DIRECTORIES ( ${Boost_LIBRARY_DIRS} )<br>
> ADD_EXECUTABLE ( test test.cpp )<br>> ADD_TEST ( test ${CMAKE_CURRENT_BINARY_DIR}/test )<br>><br>> I added the LINK_DIRECTORIES because I though that the linker was not<br>> getting the path to the Boost library. That is wrong since the full path to<br>
> the library is in the properties for this project. So I figured since it had<br>> the full name it should be able to find it. Not quite.<br>><br>> The error message I get says:<br>><br>> LNK1104: cannot open file 'boost_unit_test_framework-vc90-mt-gd-1_45.lib'<br>
><br>> I have boost installed in C:\boost. The FIND_BOOST macro able to find the<br>> installation headers and libraries I require. The only thing that is<br>> different is that the directory has the Boost unit test framework named as:<br>
><br>> C:\boost\lib\libboost_unit_test_framework-vc90-mt-gd-1_45.lib<br>><br>> That name, libboost_unit_test...., is different from the expected name of<br>> boost_unit_test...<br>><br>> I am at a loss as to why this is the case.<br>
><br>> CMake version: 2.8.4<br>> Boost version: 1.45<br>><br>> 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 "c:\Documents and Settings\Stephen.Torri\My Documents\Visual Studio 2008\Projects\problem_boost_test\vs2008\mycode\Testing\test.dir\Debug\RSP00001A37404960.rsp" 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 "C:\boost" /I "C:\Documents and Settings\Stephen.Torri\My Documents\Visual Studio 2008\Projects\problem_boost_test" /D "WIN32" /D "_WINDOWS" /D "_DEBUG" /D "CMAKE_INTDIR=\"Debug\"" /D "_MBCS" /FD /EHsc /RTC1 /MDd /Fo"test.dir\Debug\\" /Fd"C:\Documents and Settings\Stephen.Torri\My Documents\Visual Studio 2008\Projects\problem_boost_test\vs2008\mycode\Testing\Debug/test.pdb" /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">"..\..\..\mycode\Testing\test.cpp"</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 "cl.exe @"c:\Documents and Settings\Stephen.Torri\My Documents\Visual Studio 2008\Projects\problem_boost_test\vs2008\mycode\Testing\test.dir\Debug\RSP00001A37404960.rsp" /nologo /errorReport:prompt"</font></p>
<p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font face="Consolas" size="3">Creating temporary file "c:\Documents and Settings\Stephen.Torri\My Documents\Visual Studio 2008\Projects\problem_boost_test\vs2008\mycode\Testing\test.dir\Debug\RSP00001C37404960.rsp" 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:"C:\Documents and Settings\Stephen.Torri\My Documents\Visual Studio 2008\Projects\problem_boost_test\vs2008\mycode\Testing\Debug\test.exe" /VERSION:0.0 /INCREMENTAL /MANIFEST /MANIFESTFILE:"test.dir\Debug\test.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"C:\Documents and Settings\Stephen.Torri\My Documents\Visual Studio 2008\Projects\problem_boost_test\vs2008\mycode\Testing\Debug/test.pdb" /SUBSYSTEM:CONSOLE /DYNAMICBASE /NXCOMPAT /IMPLIB:"C:\Documents and Settings\Stephen.Torri\My Documents\Visual Studio 2008\Projects\problem_boost_test\vs2008\mycode\Testing\Debug\test.lib"<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">".\test.dir\Debug\test.obj"</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">".\test.dir\Debug\test.exe.embed.manifest.res"</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 "link.exe @"c:\Documents and Settings\Stephen.Torri\My Documents\Visual Studio 2008\Projects\problem_boost_test\vs2008\mycode\Testing\test.dir\Debug\RSP00001C37404960.rsp" /NOLOGO /ERRORREPORT:PROMPT"</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>------ Skipped Build: Project: RUN_TESTS, Configuration: Debug Win32 ------</font></p>
<p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font face="Consolas" size="3">1>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>------ Build started: Project: mycode, Configuration: Debug Win32 ------</font></p>
<p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font face="Consolas" size="3">3>------ Build started: Project: test, Configuration: Debug Win32 ------</font></p>
<p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font face="Consolas" size="3">2>Compiling...</font></p>
<p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font face="Consolas" size="3">3>Compiling...</font></p>
<p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font face="Consolas" size="3">2>mycode.cpp</font></p>
<p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font face="Consolas" size="3">3>test.cpp</font></p>
<p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font face="Consolas" size="3">2>Creating library...</font></p>
<p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font face="Consolas" size="3">2>Build log was saved at "</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">"</font></p>
<p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font face="Consolas" size="3">2>mycode - 0 error(s), 0 warning(s)</font></p>
<p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font face="Consolas" size="3">3>Linking...</font></p>
<p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font face="Consolas" size="3">3>LINK : fatal error LNK1104: cannot open file 'boost_unit_test_framework-vc90-mt-gd-1_45.lib'</font></p>
<p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font face="Consolas" size="3">3>Build log was saved at "</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">"</font></p>
<p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font face="Consolas" size="3">3>test - 1 error(s), 0 warning(s)</font></p>
<p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font face="Consolas" size="3">4>------ Skipped Build: Project: ALL_BUILD, Configuration: Debug Win32 ------</font></p>
<p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font face="Consolas" size="3">4>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>