Michael Wild skrev 2011-08-23 11:29:
The easiest way around this I can see is to wrap the command in a
CMake-script like this:
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/someFile.txt
COMMAND ${CMAKE_COMMAND}
-DCONFIG=$<CONFIGURATION>
-DOUTPUT=${CMAKE_CURRENT_BINARY_DIR}/someFile.txt
-P ${CMAKE_SOURCE_DIR}/generateSomeFile.cmake
DEPENDS ${CMAKE_SOURCE_DIR}/generateSomeFile.cmake
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating someFile.txt"
VERBATIM)
And then, inside the generateSomeFile.cmake wrapper file you do:
if(CONFIG STREQUAL Release)
execute_process(COMMAND ...)
endif()
HTH
Ooh... I'll try it, but I don't understand it, yet :)
Feature request: A CONFIGURATION option to add_custom_command:
ADD_CUSTOM_COMMAND(
...
CONFIGURATION Release
...
)
would make life so much easier.
Regards,
/Rob
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake