| # Packaging Debug and Release # |
| |
| By default CMake is model is that a build directory only contains a single |
| configuration, be it Debug, Release, MinSizeRel, or RelWithDebInfo. |
| |
| But it is possible to setup CPack to bundle multiple build directories at the same |
| time to build a package that contains multiple configurations of the same project. |
| |
| First we need to ahead and construct a directory called 'multi_config' this |
| will contain all the builds that we want to package together. |
| |
| Second create a 'debug' and 'release' directory underneath 'multi_config'. At |
| the end you should have a layout that looks like: |
| |
| ─ multi_config |
| ├── debug |
| └── release |
| |
| Now we need to setup debug and release builds, which would roughly entail |
| the following: |
| |
| cd debug |
| cmake -DCMAKE_BUILD_TYPE=Debug ../../MultiPackage/ |
| cmake --build . |
| cd ../release |
| cmake -DCMAKE_BUILD_TYPE=Release ../../MultiPackage/ |
| cmake --build . |
| cd .. |
| |
| |
| Now that both the debug and release builds are complete we can now use |
| the custom MultiCPackConfig to package both builds into a single release. |
| |
| cpack --config ../../MultiPackage/MultiCPackConfig.cmake |