I am using CMake 2.8 under Windows XP and want to generate a Visual Studio 2008 solution file which contains Release and Debug configurations for both Win32 and x64.
Can this be done by setting a CMake configuration variable in the CMakeLists.txt
file?
The CMakeLists is not where you specify the generator ( makefile, XCode, Visual Studio ) for a project. The generator is specified when a user runs CMake on your source.
You should produce a solution file under a console with CMake.exe.
CMake -G "Visual Studio 9 2008" (The directory which contains your CMakeLists.txt file)// This is for X86.
CMake -G "Visual Studio 9 2008 Win64" (The directory which contains your CMakeLists.txt file)// This is for X64.
You should definitely use batch scripts to automate these kind of processes. I share simplified version of my own builder script with you. My own environment is much more complicated hence I wrote this script for you for using easily.
Its usage is pretty basic.
Means source code is in the current directory and compilation configuration is 64bit Debug version.
You only need to change global configuration variables in the script which point visual studio directory and cmake directory.
SET VISUAL_STUDIO_9_HOME=
SET CMAKE_HOME=