[CMake] custom target (kernel modules)

Alexandru Ciobanu aciobanu at matrox.com
Thu Jun 28 10:08:57 EDT 2007


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. ?

Alex Ciobanu



More information about the CMake mailing list