[CMake] redefining CMake package target when using CPack

Bruce Cartland bruce.cartland at pobox.com
Mon Aug 27 23:30:07 EDT 2012


I'm currently generating multiple distinct debian packages (runtime and 
dev).

I have a typical cmake file with cpack commands in it ending with 
"inlude(CPack)" . This generates the targets "package" and 
"package-source". On debian platforms, I want "package_source" but I'd 
like to redefine/override the "package" target with a custom command.

At the moment I define my own target "pkg" which mimics "package":
     "add_custom_target(pkg DEPENDS deb_runtime deb_dev)" - on debian 
platforms - deb_runtime and deb_dev being custom targets
     "add_custom_target(pkg COMMAND ........)" - mimic "package" on 
non-debian platforms

It would be nicer to just override "package" (on debian platforms) - e.g.
     "add_custom_target(package DEPENDS deb_runtime deb_dev)"
(but this gets ignored.)

Is something like this possible or is the pkg mechanism above the 
simplest way?

thanks



More information about the CMake mailing list