[CMake] CPack: Packaging debug and release configurations in a single zip
clinton at elemtech.com
clinton at elemtech.com
Fri Feb 15 09:48:22 EST 2013
Does that result in building the code 3 times?
And why would you need to repeat the install directives?
I've attached a CMakeLists.txt file for an example project that works for me without repeating install directives.
Clint
----- Original Message -----
> Here's a follow-up.
> I was unable to get Jean-Christophes modification of Ansis' solution working.
> (I definitely did not want to repeat the install directives in this rather
> large project.) The " -DCMAKE_BUILD_TYPE" lines don't really accomplish
> anything when building with Visual Studio. I was making progress but
> ultimately gave up. Here is where I stopped.
> #####
> include(ExternalProject)
> ExternalProject_Add(MyProjectDebug
> PREFIX Debug
> SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}
> CMAKE_ARGS -G ${CMAKE_GENERATOR} -D CMAKE_BUILD_TYPE=Debug -D
> CPACK_BUILD_CONFIG=Debug
> BUILD_COMMAND "${CMAKE_COMMAND}" --build
> ${CMAKE_BINARY_DIR}/Debug/src/MyProjectDebug-build --config Debug
> )
> ExternalProject_Add(MyProjectRelease
> PREFIX Release
> SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}
> CMAKE_ARGS -G ${CMAKE_GENERATOR} -D CMAKE_BUILD_TYPE=Release -D
> CPACK_BUILD_CONFIG=Release
> BUILD_COMMAND "${CMAKE_COMMAND}" --build
> ${CMAKE_BINARY_DIR}/Release/src/MyProjectRelease-build --config Release
> )
> set(CPACK_INSTALL_CMAKE_PROJECTS
> "${CMAKE_BINARY_DIR}/Debug/src/MyProjectDebug-build;MyProject;ALL;/"
> "${CMAKE_BINARY_DIR}/Release/src/MyProjectRelease-build;MyProject;ALL;/"
> )
> include(CPack)
> #####
> At this point, the debug build would build in the debug tree and the release
> build in the release tree. All is well to that point. However, when I would
> attempt to use CPack with no -C option it would attempt to package Debug
> from the Release tree. When I would attempt to use CPack with a -C option,
> it would fail on one or the other (whichever one I did not specify).
> I tried a slight fork of the above using the NMake generator instead of the
> Visual Studio 10 generator but still ran into some issues local to our CMake
> files. I may try to resolve that next, but if anybody has any hints of where
> go from here that would be appreciated.
> Frankly it seems to me that we should be able to package multiple configs
> without any of this extra work.
> On Fri, Feb 8, 2013 at 2:50 AM, Yngve Inntjore Levinsen <
> yngve.levinsen at gmail.com > wrote:
> > On 7/2/13 7:54 PM, Patrick Johnmeyer wrote:
>
> > > On Thu, Feb 7, 2013 at 12:41 PM, Yngve Inntjore Levinsen <
> > > yngve.levinsen at gmail.com > wrote:
> >
>
> > > > I think you are fighting the tool in any case, because you are asking
> > > > to
> > > > build multiple configurations in one build folder (?). Normally you
> > > > would
> > > > create one build folder per configuration.. Which I guess is what you
> > > > are
> > > > doing today.
> > >
> >
>
> > > No, the Visual Studio generator is not a " single-configuration
> > > generator"
> > > .
> > > all configurations are bundled into the single generated solution file.
> > > This
> > > is the standard behavior of CMake under "basic" usage.
> >
>
> > > Your solution using ExternalProject looks promising, though, I will try
> > > this
> > > out. Thanks!
> >
>
> > Aha, I have mostly used the Makefile generator, and never VS, so I didn't
> > know that. I agree, the externalproject trick proposed by Ansis sounds
> > better. Good luck!
>
> > Cheers,
>
> > Yngve
>
> --
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20130215/b36599d2/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CMakeLists.txt
Type: text/x-cmake
Size: 2474 bytes
Desc: not available
URL: <http://www.cmake.org/pipermail/cmake/attachments/20130215/b36599d2/attachment-0001.bin>
More information about the CMake
mailing list