How do you run cpack from visual studio?

前端 未结 1 380
青春惊慌失措
青春惊慌失措 2021-01-25 01:33

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 cm

1条回答
  •  后悔当初
    2021-01-25 01:52

    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:

    SET( CPACK_OUTPUT_CONFIG_FILE "${CMAKE_BINARY_DIR}/BundleConfig.cmake" )
    ADD_CUSTOM_TARGET( bundle
             COMMAND "${CMAKE_CPACK_COMMAND}"
                     "-C" "$"
                "--config" "${CMAKE_BINARY_DIR}/BundleConfig.cmake"
                COMMENT "Running CPack. Please wait..."
                DEPENDS ${PROJECT_NAME} doxygen)
    

    Doxygen documentation to be included in the install package is an extra dependency in my case.

    0 讨论(0)
提交回复
热议问题