[CMake] Confikgurations and Platforms in Visual Studio 8

Sylvain Benner benner at virtools.com
Fri Sep 28 11:08:40 EDT 2007


> How are you arranging this, would you be able to let me see some of your
> CMakeList.txt files?  It looks to me that I'm hitting a lot of edge
> cases in cmake, and It's not clear from the documentation, what the
> right way of doing this is.
>
> Can you help me avoid banging my head against the wall? :)
> Many thanks,
> Joe
>   
Our framework let us choose a platform, say WIN32_Dynamic or WIN32_Static.
An included little cmake script choose the target type based on the 
platform name like this :

------------------------------------------------------------------------------------
# Regular
IF(PLATFORM MATCHES ".*Dynamic$")
    PROJECT_BUILD_TYPE(Shared)
ENDIF(PLATFORM MATCHES ".*Dynamic$")

IF(PLATFORM MATCHES ".*Static$")
    PROJECT_BUILD_TYPE(Static)
ENDIF(PLATFORM MATCHES ".*Static$")

# XBox360
IF(PLATFORM MATCHES "XBox360")
    PROJECT_BUILD_TYPE(Static)
ENDIF(PLATFORM MATCHES "XBox360")
------------------------------------------------------------------------------------

PROJECT_BUILD_TYPE is a macro which call the ADD_TARGET command with the 
specified type.
As you see we have only one target per project, it's our choice to make 
things easier.
Some projects are always static libraries or always executables so in 
these projects we don't include the above script, but we directly call 
PROJECT_BUILD_TYPE(Executable) so these projects will be executables on 
all platforms (both WIN32_Dynamic ans WIN32_Static).

For the folder tree, here is our structure :
- for vcproj:  ${CMAKE_BINARY_DIR}/<platform>/<generator>/Projects
- for sln:  ${CMAKE_BINARY_DIR}/<platform>/<generator>/Solutions  

--Sylvain

 


More information about the CMake mailing list