[CMake] Configuration defining add_custom_command behavior

---- ---- ----
Wed Jan 30 19:03:42 EST 2013


Hey there

I was hoping I'd find the answer online but there seems to be no way to do what I want with the version of CMAKE I'm stuck with.

I'm currently using CMAKE 2.8.7 to generate a VS2010 solution and project. I'd like to add a PRE_BUILD step that runs one set of commands for a debug build and another for release. Here's a made up example of what I'd like to do

If we're in debug

ADD_CUSTOM_COMMAND (TARGET ${MY_PROJECT}
                PRE_BUILD
                COMMAND jam
                ARGS -j8 -sDEBUG=1 ${MY_JAM_TARGET}
                COMMENT "Running JAM target: ${ MY_JAM_TARGET }"
                WORKING_DIRECTORY ${MY_BUILD_DIR}
                VERBATIM)

And if we're in release

ADD_CUSTOM_COMMAND (TARGET ${MY_PROJECT}
                PRE_BUILD
                COMMAND jam
                ARGS -j8 ${MY_JAM_TARGET}
                COMMENT "Running JAM target: ${ MY_JAM_TARGET }"
                WORKING_DIRECTORY ${MY_BUILD_DIR}
                VERBATIM)

Note in release, we are not passing the argument "-sDEBUG=1"

Is there a way to do this in 2.8.7? I can't use 2.8.10 because it generates vcxproj files that will not load in VS2010

Thanks in advance

BA
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20130131/11956028/attachment.htm>


More information about the CMake mailing list