<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
--></style>
</head>
<body class='hmmessage'>
Hi all,<br><br>John wrote:<br>&gt; You really should not be using the same binary folder for all these<br>&gt;
 different configurations. Use 1 binary folder tree for each build. Or<br>&gt;
 in the case of a multi-configuration generator like visual studio you<br>&gt;
 use 1 binary folder per architecture. Also separate compiler versions<br>&gt;
 in separate build trees since they build incompatible binaries.<br><br>That's exactly what I want to do!&nbsp; Sorry that this was not clear from my original message.<br><br>Given that I am a newbie, I may be missing on some things that are obvious to other people.&nbsp; I promise I have made enough attempts to read through the all documentation available and have performed enough Google searches.<br><br>Assuming that the procedure for running cmake would be something like:<br><br>0.&nbsp; Say I begin in the project root folder that has the top-level CMakeLists.txt file.<br>1.&nbsp; cd ./make/msvc9/x64/release/&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # switch to config specific folder<br>2.&nbsp; cmake -G "generator-for-a-given-config" ../../../../<br><br>Now I would like the top-level CMakeLists.txt file to figure out the following:<br><br>1.&nbsp; Link to the correct pre-compiled version of UnitTest++ based on the configuration.<br>2.&nbsp; Find the correct compilers and build tools (MSVC is easily handled but MinGW-W64 is not since it has separate tool-chains for x86 and x64 while CMake has only one generator for MinGW (not counting Code::Blocks and Eclipse ones))<br>3.&nbsp; Place the output files in one-per-configuration folder, which are separate from the tree where cmake cache and the makefiles reside.&nbsp; For example, something like, ./bin/msvc9/x64/release/ instead of ./make/msvc9/x64/release/<br><br>Thanks,<br><br>Alok<br><br>&gt; Date: Fri, 7 May 2010 12:32:18 -0400<br>&gt; Subject: Re: [CMake] Newbie: Building multiple configurations (x86/x64,         MSVC/MinGW-W64, etc.)<br>&gt; From: drescherjm@gmail.com<br>&gt; To: alokgovil@hotmail.com<br>&gt; CC: cmake@cmake.org<br>&gt; <br>&gt; On Fri, May 7, 2010 at 11:53 AM, Alok Govil &lt;alokgovil@hotmail.com&gt; wrote:<br>&gt; &gt; Hi all,<br>&gt; &gt;<br>&gt; &gt; I am trying to use CMake to build my code under multiple configurations:<br>&gt; &gt;<br>&gt; &gt; 1.&nbsp; x86 and x64<br>&gt; &gt; 2.&nbsp; MSVC various versions and MinGW-W64 mainly<br>&gt; &gt; 3.&nbsp; Debug and release (optional)<br>&gt; &gt;<br>&gt; &gt; In each case I would like to link the code with a corresponding pre-compiled<br>&gt; &gt; version of UnitTest++.<br>&gt; &gt; (There is always an option to include UnitTest++ as a target into the<br>&gt; &gt; project, but I do not see the<br>&gt; &gt; point in building UnitTest++ on each run and for each project where<br>&gt; &gt; UnitTest++ is used.&nbsp; Please let<br>&gt; &gt; me know if the direction I am taking here is not correct.)<br>&gt; &gt;<br>&gt; &gt; The case for MinGW-W64 seems to be more involved since they have two<br>&gt; &gt; separate toolchains for<br>&gt; &gt; x86 and x64.&nbsp; How would I even write CMakeLists.txt for these two such that<br>&gt; &gt; correct paths to x86<br>&gt; &gt; and x64 bin folders is recognized?<br>&gt; &gt;<br>&gt; &gt; Another thing I would like to do is to specify folders where the output<br>&gt; &gt; binaries are created using<br>&gt; &gt; EXECUTABLE_OUTPUT_PATH and LIBRARY_OUTPUT_PATH.&nbsp; This would again be based<br>&gt; &gt; on the<br>&gt; &gt; configuration used (MinGW-64 vs. MSVC, and x86 vs. x64)<br>&gt; &gt;<br>&gt; &gt; I have looked into the following, but have not been able to figure it all<br>&gt; &gt; out as yet:<br>&gt; &gt;<br>&gt; &gt; &nbsp;&nbsp; &nbsp;From:&nbsp; http://www.elpauer.org/stuff/learning_cmake.pdf<br>&gt; &gt;<br>&gt; &gt; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;TARGET_LINK_LIBRARIES(wakeup RELEASE ${wakeup_SRCS})<br>&gt; &gt; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;TARGET_LINK_LIBRARIES(wakeupd DEBUG ${wakeup_SRCS})<br>&gt; &gt;<br>&gt; &gt; &nbsp;&nbsp; &nbsp;Notes:<br>&gt; &gt; &nbsp;&nbsp; &nbsp;- This allows specifying different libraries for debug and release, but<br>&gt; &gt; there does not seem to<br>&gt; &gt; &nbsp;&nbsp; &nbsp;&nbsp; be an option to use the same method to specify different libraries for<br>&gt; &gt; x86 vs. x64.<br>&gt; &gt;<br>&gt; &gt; &nbsp;&nbsp; &nbsp;From:&nbsp; http://www.cmake.org/pipermail/cmake/2009-June/030072.html<br>&gt; &gt;<br>&gt; &gt; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;# check 64 bit<br>&gt; &gt; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;if( CMAKE_SIZEOF_VOID_P EQUALS 4 )<br>&gt; &gt; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;set( HAVE_64_BIT 0 )<br>&gt; &gt; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;else()<br>&gt; &gt; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;set( HAVE_64_BIT 1 )<br>&gt; &gt; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;endif()<br>&gt; &gt;<br>&gt; &gt; Thanks,<br>&gt; &gt;<br>&gt; <br>&gt; You really should not be using the same binary folder for all these<br>&gt; different configurations. Use 1 binary folder tree for each build. Or<br>&gt; in the case of a multi-configuration generator like visual studio you<br>&gt; use 1 binary folder per architecture. Also separate compiler versions<br>&gt; in separate build trees since they build incompatible binaries.<br>&gt; <br>&gt; John<br>                                               <br /><hr />Hotmail has tools for the New Busy. Search, chat and e-mail from your inbox. <a href='http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_1' target='_new'>Learn more.</a></body>
</html>