[CMake] How to execute an external project target as part of a standard target.

Bill Somerville bill at classdesign.com
Tue Mar 24 14:21:18 EDT 2015


On 13/03/2015 14:06, Bill Somerville wrote:
> Hi All,
>
> I have a superbuild style project consisting of a few external 
> projects. I wish to build the install target of one of them as part of 
> the install target of the parent project. I had it working by adding a 
> step target called install and adding a custom target to the parent 
> project that depends on the child step target. E.g.
>
> ExternalProject_Add (xxx
>   SVN_REPOSITORY ${xxx_repo}
>   CMAKE_ARGS
>     -D CMAKE_INSTALL_PATH=<INSTALL_DIR>
>   INSTALL_DIR ${CMAKE_INSTALL_PREFIX}
>   STEP_TARGETS install)
>
> add_custom_target (install DEPENDS xxx-install)
>
> This arrangement allowed me to 'cmake --build . --target install' and 
> have the child project install target run.
>
> Now CMake complains about policy CMP0037, because I cannot define a 
> reserved target name, so it seems I cannot abuse the 'install' target 
> by adding extra dependencies any more.
>
> Is there a better way to link child and parent targets that doesn't 
> invoke this error?
No replies on this one. Am I asking something that can't be done or am I 
missing something obvious?
>
> Regards
> Bill Somerville.



More information about the CMake mailing list