[CMake] Running CPack and ignore exit codes

NoRulez norulez at me.com
Wed Feb 6 14:39:00 EST 2013


You're right. Normally I do not ignore errors, but in some situations if unit tests and/or parts of new libraries are under development, on some platforms they won't compile/link, but the main application is still stable and could be packaged. I think you know what I mean. It is not my decision.

How could I overwrite it?


Am 06.02.2013 um 20:23 schrieb David Cole <dlrdave at aol.com>:

> My advice to you would be not to ignore the errors.
> 
> If you want to ignore them anyway, you're on your own. Or maybe somebody else who is also ignoring errors like these will step up with some alternate advice. ;-)
> 
> You can override what CPack calls for "make install" -- you can tell it to run something else that won't do a "make all" first. But it would probably be easier to just fix the errors.
> 
> 
> D
> 
> 
> -----Original Message-----
> From: NoRulez <norulez at me.com>
> To: David Cole <dlrdave at aol.com>
> Cc: eric.noulard <eric.noulard at gmail.com>; cmake <cmake at cmake.org>
> Sent: Wed, Feb 6, 2013 2:19 pm
> Subject: Re: [CMake] Running CPack and ignore exit codes
> 
> Ok, when I have the following situation:
> 
> prj1 (install target)
> prj2 (not install target but produce compile error, so this could be ignored)
> prj3 (install target)
> prj4 (install target)
> 
> At the moment I call "cpack -G ZIP" (normally I call cpack from within a CTestScript) and it stops by prj2 without building the zip archive.
> If the prj2 doesn't have errors it runs smoothly.
> 
> Did this mean that I must know (at CTestScript time) which projects should be build?
> e.g.: cpack -G ZIP prj1 prj2 prj3?
> 
> Best Regards
> 
> Am 06.02.2013 um 19:58 schrieb David Cole <dlrdave at aol.com>:
> 
>> CPack does call "make install" -- and make install first does a make all to get everything up to date.....
>> 
>> So even calling just cpack by itself in this situation is no good.
>> 
>> 
>> 
>> -----Original Message-----
>> From: Eric Noulard <eric.noulard at gmail.com>
>> To: NoRulez <norulez at me.com>
>> Cc: CMake ML <cmake at cmake.org>
>> Sent: Wed, Feb 6, 2013 1:57 pm
>> Subject: Re: [CMake] Running CPack and ignore exit codes
>> 
>> 2013/2/6 NoRulez <norulez at me.com>:
>> > Because CPack runs the default (all) target.
>> 
>> Ok now I think I get it.
>> 
>> AIFAIK, CPack does NOT run "all" target.
>> 
>> "make package" does.
>> 
>> You should be able to call CPack explicitely without problem, try:
>> 
>> cpack
>> 
>> in your build dir. However this won't try to build anything.
>> 
>> > It could be that a target doesn't build because of compile or link errors and 
>> are not an install target (unit tests for example or other sub projects which 
>> are not required).
>> 
>> You'll build a package with a failing unit test !! :-]
>> 
>> > CPack should build as much as possible and only break if an install target has 
>> errors.
>> 
>> Like I said, CPack does not build anything per se, the "package"
>> target depends on "all"
>> so that the build tool (make,  Visual Studio, XCode etc...) does build all.
>> 
>> > Currently it is not possible to run cpack and create packages for such 
>> situation.
>> 
>> True but I'm not sure I would personnally want to build a package out
>> of a partially buildable project.
>> Other may have other opinion though.
>> 
>> From my point of view, if you really want to accept the building of a
>> package even if
>> some target may fail then you could simply make the building of those
>> targets optional
>> using
>> 
>> option(BUILD_OPTIONAL_TARGET "Build Optional Target" OFF)
>> 
>> then
>> if(BUILD_OPTIONAL_TARGET)
>>   add_executable(...)
>> endif()
>> 
>> Then set BUILD_OPTIONAL_TARGET to OFF if you don't care of those when
>> building a package.
>> 
>> Currently CMake (and not CPack) is not  tracking down target that
>> "are built but not installed"
>> it may be doable but this would be a new feature.
>> I don't really know the portion of CMake code handling manifest files
>> but AFAIRemember this was handled **at install time** so that the
>> list of "to be installed files/target" is unknown at CMake time.
>> 
>> What "may be possible" is to add a new "package/fast" target
>> which would depend on "preinstall/fast and install/fast" instead of
>> "preinstall" so that
>> you will avoid the build of "all"
>> 
>> The trouble is, the fast target does not build **anything** so you'll
>> have to do:
>> 
>> make -k all
>> make package/fast
>> 
>> to achieve what you want.
>> 
>> -- 
>> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20130206/f9aae94c/attachment-0001.htm>


More information about the CMake mailing list