[CMake] ExternalProject_Add ALWAYS

Kevin Funk krf at gmx.de
Sun Dec 1 06:37:32 EST 2013


Am Sonntag, 1. Dezember 2013, 10:53:08 schrieb James Turner:
> Hi,
> 
> I am trying to force the BUILD step of an ExternalProject_Add target to be
> run - always. I have found several wiki articles, and references in the
> archives of this list, to setting an ALWAYS option for the stage I want to
> force to run each time. The problem is I can’t find any documentation on
> the exact syntax to use - can someone please enlighten me? (This is for a
> project where the files are on the local disk when the build is run, but
> may change due to external sync mechanisms - right now the build system
> never notices this)
> 
> I’m guessing it must be something like:
> 
> ExternalProject_Add(Foo
>    PREFIX ${CMAKE_BINARY_DIR}
>    DOWNLOAD_COMMAND ""    # no need to download
>    BUILD_ALWAYS # <<< but is this correct?
>    SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/path/to/foo
>   …...
> )
> 
> Kind regards,
> James Turner

Heya,

Looks like you need to call ExternalProject_Add_Step() to create a custom step 
for this. This function accepts 'ALWAYS'.

Signature:
ExternalProject_Add_Step(<name> <step>
 [COMMAND cmd...]
 [COMMENT “text...”]
 [DEPENDEES steps...]
 [DEPENDERS steps...]
 [DEPENDS files...]
 [ALWAYS 1]
 [WORKING_DIRECTORY dir]
)

See section 'Adding Custom Steps' in:
http://www.kitware.com/media/html/BuildingExternalProjectsWithCMake2.8.html

And then just set the 'DEPENDEES' parameter to build, in order to have it run 
during the build phase.

Greets

-- 
Kevin Funk


More information about the CMake mailing list