[CMake] How to use verbose and debug output for CPack under VS

David Cole david.cole at kitware.com
Mon May 21 11:41:50 EDT 2012


On Mon, May 21, 2012 at 3:30 AM, Eric Noulard <eric.noulard at gmail.com>wrote:

> 2012/5/21  <norulez at me.com>:
> > Is there an environment variable or a CMake/CPack variable which is must
> set?
>
> Currently AFAIK there aren't any.
> But it would be easy to add, you may propose a patch.
>
> > how can I configure a project for Visual Studio to use the "--verbose"
> and the "--debug"
> > options/command line parameters?
>
> As a workaround I would suggest to craft a custom target that will do the
> job:
>
> add_custom_target(PACKAGE_DEBUG
>              COMMAND ${CMAKE_CPACK_COMMAND} --debug --verbose
> --config CPackConfig.cmake
>              COMMENTS "Build package with debug and verbose output")
> --
> Erk
> Le gouvernement représentatif n'est pas la démocratie --
> http://www.le-message.org
> --
>
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>


I don't think this needs to be done very often, and is not worth making a
change in CMake for... (So I don't want a patch for it... thanks, anyway)
You can easily edit the custom command that CMake already generates for
running CPack directly in the Visual Studio gui if you need to add command
line arguments for debugging purposes.

Simply right click the "PACKAGE" project, and choose "Properties" -- when
the property pages come up, look for "Build Events" and "Post-Build Event"
and edit the command line for the post build event.

You can see there's one line in there that calls cpack with something like:

  "C:\Program Files (x86)\CMake 2.8\bin\cpack.exe" -C $(Configuration)
--config ./CPackConfig.cmake

Just add your --verbose and --debug there, and then right click the
"PACKAGE" project again, and choose "Project Only > Build Only PACKAGE" to
execute the post build command that you just edited...


Alternatively, besides some environment differences (which may but don't
typically cause final package differences), there should be no reason you
can't just run cpack directly from a command prompt in your build tree and
get the exact same package.


HTH,
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120521/2f083000/attachment.htm>


More information about the CMake mailing list