> From: Anteru <[EMAIL PROTECTED]> > > I'm currently converting a fairly large project over to CMake.
This is how I got into CMake, albeit without the x86/x64 wrinkle. It took some effort to switch the project over, but I am very glad we did. Caveat: The following is based on a much older version of CMake which I've been using for the same project for about five years. > * 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_t he > n_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? We've always done it like this on the biggest project I have under CMake: ADD_CUSTOM_COMMAND( TARGET my_target COMMAND "${my_project_BINARY_DIR}/my_path/my_unit_test" ) In cases where we needed the debug file name to be different from the release file name, we defined a variable for that file name, with an IF command to determine whether the variable is defined as the release file name or the debug file name. Then we would just write "${MY_UNIT_TEST}" instead of "my_unit_test". But we also invoke CMake from a script that sets the variable BUILD_RELEASE when we want to build in "release" mode, so we have an obvious IF condition. I suspect there's a way to test for debug or release if you don't do this, but I've never bothered to find out. > * 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 ...). We do this: SET(CMAKE_LINKER_OUTPUT_FILE "${my_project_BINARY_DIR}/my_path/my_executable") Actually, we use a CMake MACRO definition to invoke this and a bunch of other commands on each library and executable we build, so we have, for example, "${exe_file_name}.exe" instead of "my_executable" for an executable output, where "exe_file_name" is a parameter of the MACRO. But that's because we build many libraries and executables, and it would have been quite tedious to have to maintain all the commands for each one independently. There's probably a way to do these things that uses CMake to do more of the details, but I've taken the approach to rely on CMake to get the basics right (which it does very well, for things that would be very hard for me to do without it), and to do the fancy stuff myself on top of that. That's why I have about four or five different scripts to invoke CMake with different sets of variables defined depending on what kind of build I want to make. David Karr _______________________________________________ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake