[cmake-developers] Function overrides

Brad King brad.king at kitware.com
Mon Jun 3 09:11:07 EDT 2013


On 05/30/2013 04:16 PM, Wojciech Knapik wrote:
> A few months pass, a few more modules get written and it all turns out
> to work quite nicely, so I decide to publish them as open source, for
> everyone's benefit. How do I distribute these modules and allow people
> to use any combination of them ? Do I create a separate wrapper for
> every combination ?

We've done this with many projects.  We just create a project-specific
wrapper in the projects's own CMakeLists.txt files and then teach it
to invoke all the third-party helpers we want.

include(FancyMod1)
include(FancyMod2)
function(myproj_add_executable)
  add_executable(${ARGN})
  fm1_help_exe(${ARGN})
  fm2_help_exe(${ARGN})
endfunction()

-Brad



More information about the cmake-developers mailing list