On Fri, May 7, 2010 at 11:53 AM, Alok Govil <alokgo...@hotmail.com> wrote: > Hi all, > > I am trying to use CMake to build my code under multiple configurations: > > 1. x86 and x64 > 2. MSVC various versions and MinGW-W64 mainly > 3. Debug and release (optional) > > In each case I would like to link the code with a corresponding pre-compiled > version of UnitTest++. > (There is always an option to include UnitTest++ as a target into the > project, but I do not see the > point in building UnitTest++ on each run and for each project where > UnitTest++ is used. Please let > me know if the direction I am taking here is not correct.) > > The case for MinGW-W64 seems to be more involved since they have two > separate toolchains for > x86 and x64. How would I even write CMakeLists.txt for these two such that > correct paths to x86 > and x64 bin folders is recognized? > > Another thing I would like to do is to specify folders where the output > binaries are created using > EXECUTABLE_OUTPUT_PATH and LIBRARY_OUTPUT_PATH. This would again be based > on the > configuration used (MinGW-64 vs. MSVC, and x86 vs. x64) > > I have looked into the following, but have not been able to figure it all > out as yet: > > From: http://www.elpauer.org/stuff/learning_cmake.pdf > > TARGET_LINK_LIBRARIES(wakeup RELEASE ${wakeup_SRCS}) > TARGET_LINK_LIBRARIES(wakeupd DEBUG ${wakeup_SRCS}) > > Notes: > - This allows specifying different libraries for debug and release, but > there does not seem to > be an option to use the same method to specify different libraries for > x86 vs. x64. > > From: http://www.cmake.org/pipermail/cmake/2009-June/030072.html > > # check 64 bit > if( CMAKE_SIZEOF_VOID_P EQUALS 4 ) > set( HAVE_64_BIT 0 ) > else() > set( HAVE_64_BIT 1 ) > endif() > > Thanks, >
You really should not be using the same binary folder for all these different configurations. Use 1 binary folder tree for each build. Or in the case of a multi-configuration generator like visual studio you use 1 binary folder per architecture. Also separate compiler versions in separate build trees since they build incompatible binaries. John _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake