[CMake] custom target (kernel modules)

Alexandru Ciobanu aciobanu at matrox.com
Thu Jun 28 11:17:15 EDT 2007


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).
>
> Programming affiliations with the FreeEOS equation-of-state 
> implementation
> for stellar interiors (freeeos.sf.net); PLplot scientific plotting 
> software
> package (plplot.org); the libLASi project (unifont.org/lasi); the 
> Loads of
> Linux Links project (loll.sf.net); and the Linux Brochure Project
> (lbproject.sf.net).
> __________________________
>
> Linux-powered Science
> __________________________
>
>



More information about the CMake mailing list