[CMake] Newbie: Building multiple configurations (x86/x64, MSVC/MinGW-W64, etc.)

Alok Govil alokgovil at hotmail.com
Fri May 7 11:53:44 EDT 2010


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,

Alok 		 	   		  
_________________________________________________________________
The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with Hotmail. 
http://www.windowslive.com/campaign/thenewbusy?tile=multicalendar&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_5
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100507/affa4060/attachment.htm>


More information about the CMake mailing list