[CMake] Executing a CMake Custom Target from CTest
Bill Hoffman
bill.hoffman at kitware.com
Tue Nov 3 14:41:10 EST 2009
Alexander Neundorf wrote:
> On Tuesday 03 November 2009, Bill Hoffman wrote:
>> Mathieu Malaterre wrote:
>>> Hi there,
>>>
>>> I'd like to know if this is possible to execute a cmake custom
>>> target from my nightly ctest script.
>>> Eg. In cmake
>>>
>>> ...
>>> ADD_CUSTOM_COMMAND(
>>> OUTPUT bla.txt
>>> COMMAND echo "bla" > bla.txt
>>> VERBATIM
>>> )
>>> ADD_CUSTOM_TARGET(BLA DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/bla.txt)
>>> ...
>>>
>>> For now I am copy/pasting this as an execute_process:
>>>
>>> ...
>>> CTEST_START(Nightly)
>>> CTEST_UPDATE(SOURCE "${CTEST_SOURCE_DIRECTORY}" RETURN_VALUE res)
>>> CTEST_CONFIGURE(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res)
>>> # duplicated code:
>>> EXECUTE_PROCESS(COMMAND echo "bla" > bla.txt
>>> OUTPUT_FILE bla.txt
>>> RESULT_VARIABLE RES)
>>> CTEST_SUBMIT(RETURN_VALUE res)
>>> ...
>> This should do what you want:
>> SET( CTEST_BUILD_TARGET BLA)
>> CTEST_BUILD (
>> BUILD "${CTEST_BINARY_DIRECTORY}"
>> APPEND
>> )
>
> It would be nice if there were TARGET, FLAGS and maybe CONFIGURATION and
> PROJECT_NAME keywords for CTEST_BUILD(), setting the variables
> CTEST_BUILD_TARGET, CTEST_BUILD_FLAGS, CTEST_BUILD_CONFIGURATION and
> CTEST_BUILD_PROJECT_NAME feels a bit old-style ;-)
>
Yup, should be/will be... But if you need it today this is how to do
it. :)
-Bill
More information about the CMake
mailing list