[cmake-developers] [CMake 0014771]: Ninja generator does not always honor SYMBOLIC rules with no command

Mantis Bug Tracker mantis at public.kitware.com
Tue Feb 25 09:50:37 EST 2014


The following issue has been SUBMITTED. 
====================================================================== 
http://www.cmake.org/Bug/view.php?id=14771 
====================================================================== 
Reported By:                Brad King
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   14771
Category:                   CMake
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2014-02-25 09:50 EST
Last Modified:              2014-02-25 09:50 EST
====================================================================== 
Summary:                    Ninja generator does not always honor SYMBOLIC rules
with no command
Description: 
The 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.

====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2014-02-25 09:50 Brad King      New Issue                                    
======================================================================



More information about the cmake-developers mailing list