[CMake] Converting a VS Build to CMake/Problems with Post-Build steps, questions

Anteru Anteru at shelter13.net
Fri Feb 29 05:53:09 EST 2008


Hello,

I'm currently converting a fairly large project over to CMake. This is 
my first contact with CMake, so I might be trying to do things totally 
wrong, anyway, I've encountered some problems which I could not solve.

Searching the Web or reading the FAQ didn't help; is there any way to 
search the mail archives easily?

Setup:
   Visual Studio 2008 / Vista, I'm porting the x64 part only at the 
moment. Using CMake 2.4.8.

Problems:
   * I want to name my debug libraries with a trailing 'd'. I use 
SET_TARGET_PROPERTIES(MyTarget PROPERTIES DEBUG_POSTFIX "d") to do this. 
However, MyTarget is a unit-test runner and I want to execute it using
ADD_COMMAND as described here 
http://www.cmake.org/Wiki/CMake_FAQ#How_do_I_generate_an_executable.2C_then_use_the_executable_to_generate_a_file.3F 
albeit without the output:

GET_TARGET_PROPERTY(PRJ_UT_TARGET MyTarget OUTPUT_NAME)
ADD_CUSTOM_COMMAND(
	TARGET MyTarget
	POST_BUILD
	COMMAND "${PRJ_UT_TARGET}" VERBATIM
  )

This works fine for release, but not for debug, as it always returns the 
name without the prefix. How is this supposed to work?

   * Is there a way to force both Debug and Release to end up in the 
same folder? The VC++ project builder seems to put Debug into 
EXECUTABLE_OUTPUT_PATH/Debug always, and I found no way to force it to 
put both into the same. Rationale behind this is that my project needs 
some more files in order to run, and I'd like to put the binaries right 
into this data folder (instead of copying the data around during 
pre/post-build ...).

   * Is it possible to have x86 & x64 configurations inside a single VC 
solution? During configure, I have to choose either x64 or x86. This is 
nothing serious, I'm just wondering.

   * What is the recommended way to check for x64 Windows? I'm using a 
custom option, but I'd like to have that fully automatic if possible. I 
only found this list here 
http://www.cmake.org/Wiki/CMake_Useful_Variables#System_.26_Compiler_Information 
  -- is there some more up-to-date place?

Cheers,
   Anteru


More information about the CMake mailing list