I am porting some packages from Linux to windows and I've found that visual studio has quite good integration with cmake. I am able to configure and build the project using cmake but I cannot figure out how to run cpack to create the installation package.
This question - How to create an installer with CMake + CPack + NSIS on Windows? - suggests that a PACKAGE.vcxproj file should be created by the build. It is but there doesn't appear to be anyway to build/run it from inside visual studio
It seems a strange oversight as:
- cmake integration is very good
- ctest tests can be run via the tests menu
- the install target can be run via the build menu but there is no menu option to create packages with cpack.
Note I am trying to create ZIP or TGZ package and don't need the extra complication of NSIS at this time. I am using VS2019
The best solution I've come up with is you can't - at least not directly. Someone more enlightened may know better because it does indeed seem a strange oversight.
If you open a commmand prompt from tools/developer command prompt you can run cpack manually from there.
Another important point is that CPACK_PACKAGING_INSTALL_PREFIX should not be set on Windows. See https://gitlab.kitware.com/cmake/cmake/issues/17534
You can improve on this by adding a custom target (or targets) to your CMakeLists.txt which will be visible in the targets view. For example (base on https://cmake.org/pipermail/cmake/2017-January/064830.html) add:
Doxygen documentation to be included in the install package is an extra dependency in my case.