View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0015995CMakeCMakepublic2016-03-01 07:422016-06-10 14:31
Reporterstw_sesa 
Assigned Togeoffviola 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionmoved 
Platformx86_64OSWindowsOS Version7
Product VersionCMake 3.4.3 
Target VersionFixed in Version 
Summary0015995: GHS Multi Generator: add_custom_command / add_custom_target does not work
DescriptionThe GHS Multi Generator does not handle custom commands added via add_custom_command() correctly / at all. The custom commands are not used in the generated project files and never executed.
Instead the default compiler seems to be called, which obviously fails.
Steps To ReproduceCreate a simple CMakeLists.txt like this:

# CMakeLists.txt
cmake_minimum_required (VERSION 2.8)
add_custom_target (a_txt ALL DEPENDS a.txt)
add_custom_command (OUTPUT a.txt COMMAND type b.txt > a.txt DEPENDS b.txt)
add_custom_command (OUTPUT b.txt COMMAND type c.txt > b.txt DEPENDS c.txt)
file(WRITE ${CMAKE_BINARY_DIR}/c.txt "hello world" )

-----------------------------------

Generate the GHC Project using CMake and try to build it.
Output from the build:

Building D:\cmake-ghc\build\custom_target_test_ghc\default.gpj
Output from Linking a_txt.gpj:

ccintarm: Error: output file 'a_txt' is a directory.

Error: build failed
Build failed (Tue Mar 01 13:32:50 2016)
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0040876)
geoffviola (developer)
2016-04-17 19:03

GHS MULTI is not as general purpose as some of the generators. add_custom_command only works with executables and libraries, but not custom_targets.

custom_targets could be supported with a few workarounds. For example, a custom_target could be treated as a [Library] in the .gpj and a junk .c file could be generated just to use the shell scripting MULTI.

Even with that workaround, there is still an issue of the order of the commands. It seems that the second command fails sometimes, because GHS MULTI runs it before b.txt is generated. I'm not sure if the shell commands run multi threaded.

I've submitted a support request with Green Hills. They may have a solution to some of these issues.
(0042949)
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
2016-03-01 07:42 stw_sesa New Issue
2016-04-17 17:05 geoffviola Assigned To => geoffviola
2016-04-17 17:05 geoffviola Status new => assigned
2016-04-17 19:03 geoffviola Note Added: 0040876
2016-06-10 14:29 Kitware Robot Note Added: 0042949
2016-06-10 14:29 Kitware Robot Status assigned => resolved
2016-06-10 14:29 Kitware Robot Resolution open => moved
2016-06-10 14:31 Kitware Robot Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team