[CMake] custom target (kernel modules)
Alexandru Ciobanu
aciobanu at matrox.com
Thu Jun 28 17:06:11 EDT 2007
Hi, Peter!
Sure, I can show you how I've used it exactly. Here it is:
set ( kofile ${CMAKE_CURRENT_SOURCE_DIR}/manager.ko )
add_custom_command ( OUTPUT ${kofile}
COMMAND ${kbuild_cmd}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS ${src} Kbuild )
add_custom_target ( cool_driver ALL DEPENDS ${kofile} )
Alex Ciobanu
Peter Visser wrote:
> Hi,
>
> could you post the working example? I'm doing something similar but
> I'm doing it wrong, the add_custom_command is always being build in my
> case.
>
> Thanks in advance,
>
> Peter.
>
> On 6/28/07, *Alexandru Ciobanu* <aciobanu at matrox.com
> <mailto:aciobanu at matrox.com>> wrote:
>
> Thanks Alan, it works.
> =)
>
> Alan W. Irwin wrote:
> > On 2007-06-28 10:08-0400 Alexandru Ciobanu wrote:
> >
> >> Hi!
> >>
> >> I am trying to build kernel modules with CMake. To do that I
> >> use the command below:
> >>
> >> add_custom_target ( manager.ko ${kbuild_cmd}
> >> WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/linux
> >> DEPENDS ${src} linux/Kbuild
> >> )
> >>
> >> The problem is that nobody depends on this custom target and so
> it is
> >> never build when running make.
> >>
> >> If I use the ALL parameter in add_custom_target() it will always
> >> rebuild it,
> >> even if none of source files has changes.
> >>
> >> So how do I make this work so that it builds when I run make
> but also
> >> builds only when necessary, like any other target add_library(),
> >> add_executable(), etc. ?
> >
> > Use ADD_CUSTOM_COMMAND instead with an empty (COMMANDless)
> > ADD_CUSTOM_TARGET
> > with the ALL parameter that-file depends on the custom command.
> >
> > Alan
> > __________________________
> > Alan W. Irwin
> >
> > Astronomical research affiliation with Department of Physics and
> > Astronomy,
> > University of Victoria ( astrowww.phys.uvic.ca
> <http://astrowww.phys.uvic.ca>).
> >
> > Programming affiliations with the FreeEOS equation-of-state
> > implementation
> > for stellar interiors (freeeos.sf.net <http://freeeos.sf.net>);
> PLplot scientific plotting
> > software
> > package (plplot.org <http://plplot.org>); the libLASi project
> (unifont.org/lasi <http://unifont.org/lasi>); the
> > Loads of
> > Linux Links project ( loll.sf.net <http://loll.sf.net>); and the
> Linux Brochure Project
> > (lbproject.sf.net <http://lbproject.sf.net>).
> > __________________________
> >
> > Linux-powered Science
> > __________________________
> >
> >
>
> _______________________________________________
> CMake mailing list
> CMake at cmake.org <mailto:CMake at cmake.org>
> http://www.cmake.org/mailman/listinfo/cmake
> <http://www.cmake.org/mailman/listinfo/cmake>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
More information about the CMake
mailing list