View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0014771CMakeCMakepublic2014-02-25 09:502016-06-10 14:31
ReporterBrad King 
Assigned ToKitware Robot 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionmoved 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0014771: Ninja generator does not always honor SYMBOLIC rules with no command
DescriptionThe SYMBOLIC source file property is a mark typically used on a custom command output to say that the file will never actually exist. This can be used to create always-out-of-date rules that run on every build.

When a custom command has no actual command line and a symbolic output the Ninja generator implements this by creating a phony build rule. However, the Ninja documentation states:

 "If a phony build statement is written without any dependencies,
  the target will be considered out of date if it does not exist."

If there are order-only dependencies then Ninja does not consider a phony target to be out of date.
Steps To Reproduce$ cat ../CMakeLists.txt
cmake_minimum_required(VERSION 2.8)
project(OrderedBuildAlways NONE)
add_custom_target(first)
add_custom_command(
  OUTPUT never-created
  COMMAND
  VERBATIM
  )
add_custom_command(
  OUTPUT always-printed
  COMMAND ${CMAKE_COMMAND} -E echo "always printed"
  COMMAND ${CMAKE_COMMAND} -E touch always-printed
  DEPENDS never-created
  VERBATIM
  )
set_property(SOURCE never-created PROPERTY SYMBOLIC 1)
add_custom_target(drive ALL DEPENDS always-printed)
add_dependencies(drive first)

$ cmake .. -G Ninja
$ ninja
[1/1] Generating always-printed
always printed
$ ninja
ninja: no work to do.
TagsNo tags attached.
Attached Files

 Relationships
related to 0014728closedBen Boeckel [CMake/Ninja] add_dependencies() to objlib's user is ignored. 
related to 0014747closed Target dependencies do not trigget build on Ninja 
related to 0014963closedBrad King Add explicit specification of custom command side effect outputs 

  Notes
(0035192)
Brad King (manager)
2014-02-25 09:54

The build.ninja file generated for the example contains

 build never-created: phony || first

and the order-only dependency on "first" prevents this from being considered always out of date. However, we need to preserve the order-only dependency too. We could fix this by creating a single target

 build cmake-ninja-always-out-of-date: phony

and then update our other phony (SYMBOLIC) rules to be

 build never-created: phony | cmake-ninja-always-out-of-date || first
(0042493)
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
2014-02-25 09:50 Brad King New Issue
2014-02-25 09:50 Brad King Relationship added related to 0014728
2014-02-25 09:50 Brad King Relationship added related to 0014747
2014-02-25 09:52 Brad King Note Added: 0035191
2014-02-25 09:54 Brad King Note Added: 0035192
2014-02-25 09:56 Brad King Note Deleted: 0035191
2014-06-11 08:35 Brad King Relationship added related to 0014963
2014-07-01 09:28 Brad King Status new => backlog
2016-06-10 14:29 Kitware Robot Note Added: 0042493
2016-06-10 14:29 Kitware Robot Status backlog => 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