View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0014597CMakeCMakepublic2013-11-26 04:172016-06-10 14:31
Reportertisi 
Assigned ToKitware Robot 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionmoved 
Platformx86OSWindowsOS Version7
Product VersionCMake 2.8.12 
Target VersionFixed in Version 
Summary0014597: Ninja: several add_custom_command(Target ... POST_BUILD ...) may lead to a command which breaks the command line limit
DescriptionWe encountered the following problem with a project for an embedded microcontroller, but it is reproducable on normal x86 machines. We use the command add_custom_command(Target <Target> POST_BUILD <Commands>) to run severeal commands after linking (some hex-file manipulations like calculating crc32, moving of memory and so on).

In the past we used the makefile generator and our project worked fine, but we want to switch to ninja for some other reasons.

We found the following issue:
The ninja generator combines the linker command and all the add_custom_commands to one large command (all commands are combinded by &&, so linker-command && custom1 && custom2 && custom3 && ...), which breaks the command line limit of windows (8kB). I think the same issue would be true on linux with an higher limit (i think 32kb).

Is it possible to change the behavior of the generator to support something like that (e.g. intermediate targets for the add_custom_commands)? Right now we make a shell script and use only one add_custom_command, but its not nice that there is a different behavior between the make and the ninja build at all.
Steps To ReproduceI've uploaded a file with a cmake project, which demonstrates that. You will need a c compiler, but it doesn't matter which one.

Just run
cmake -G "Ninja" <source_path> && ninja
on Windows and you should see the issue.
TagsNo tags attached.
Attached Fileszip file icon AddCustomCommandDemo.zip [^] (985 bytes) 2013-11-26 04:17

 Relationships

  Notes
(0034562)
Peter Kuemmel (developer)
2013-11-26 05:45

Thanks for the test case, I could reproduce it.

We already use "response files" for large single commands, but not when multiple commands are merged. I try to fix this.
(0036204)
Alexandre Chassany (reporter)
2014-06-16 11:24

Hi,

I'd like to know if you have any update on this issue ? I also encounter this issue on a project and i'd like to know if you have any idea when a fix to this issue will be available ?

Thx
(0037855)
Alexandre Chassany (reporter)
2015-01-28 16:00

Any update on this issue ? Any pointer where i can investigate ?

Thx
(0042433)
Kitware Robot (administrator)
2016-06-10 14:29

Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.

 Issue History
Date Modified Username Field Change
2013-11-26 04:17 tisi New Issue
2013-11-26 04:17 tisi File Added: AddCustomCommandDemo.zip
2013-11-26 05:42 Peter Kuemmel Assigned To => Peter Kuemmel
2013-11-26 05:42 Peter Kuemmel Status new => assigned
2013-11-26 05:45 Peter Kuemmel Note Added: 0034562
2013-11-26 05:45 Peter Kuemmel Status assigned => confirmed
2014-04-13 05:48 Peter Kuemmel Assigned To Peter Kuemmel =>
2014-06-16 11:24 Alexandre Chassany Note Added: 0036204
2015-01-28 16:00 Alexandre Chassany Note Added: 0037855
2016-06-10 14:29 Kitware Robot Note Added: 0042433
2016-06-10 14:29 Kitware Robot Status confirmed => resolved
2016-06-10 14:29 Kitware Robot Resolution open => moved
2016-06-10 14:29 Kitware Robot Assigned To => Kitware Robot
2016-06-10 14:31 Kitware Robot Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team