[CMake] Adding install dependency to test-target?
Alexander Neundorf
a.neundorf-work at gmx.net
Thu Jan 29 15:37:06 EST 2009
On Thursday 29 January 2009, Aaron Turner wrote:
> On Thu, Jan 29, 2009 at 7:43 AM, Hugo Heden <hugoheden at gmail.com> wrote:
> > 2008/11/20 Eric Noulard <eric.noulard at gmail.com>:
> >> 2008/11/20 Hugo Heden <heden at foi.se>:
> >>> Good day all,
> >>>
> >>>
> >>> Is there any way that I can add 'install' dependency to the
> >>> 'test'-target?
> >>>
> >>> Doing
> >>>
> >>> add_dependencies( test install )
> >>>
> >>> does not seem to work:
> >>> CMake Error at ... (ADD_DEPENDENCIES):
> >>> add_dependencies Adding dependency to non-existent target: test
> >>
> >> I don't think it's possible to add dependencies to "built-in" CMake
> >> target (which deserve a feature request :-)
> >>
> >>> Apparently neither 'test' nor 'install' counts as "top-level-targets"?
> >>
> >> Precisely :=)
> >
> > Feature request added: http://public.kitware.com/Bug/view.php?id=8438
>
> Sorry to hijack the thread, but I believe I'm having the same issue
> with the target "clean":
>
> ADD_CUSTOM_TARGET(clean_libopts
> COMMAND ${MAKE} clean
> WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/libopts)
>
> ADD_DEPENDENCIES(clean clean_libopts)
>
> results in:
> CMake Error at CMakeLists.txt:245 (ADD_DEPENDENCIES):
> add_dependencies Adding dependency to non-existent target: clean
Yes, that doesn't work. "clean", "all", "install" are a special kind of target
in cmake, i.e. they are not really targets, they are only created when the
project files/makefiles are written.
> I'm doing the above because libopts is not built via cmake, but via
> autotools.
You could add a second COMMAND to the clean_libopts target, which does a "make
clean" for the current cmake project (yes, that's more a workaround).
Alex
More information about the CMake
mailing list