MantisBT - CMake
View Issue Details
0014721CMakeCMakepublic2014-01-27 11:002016-06-10 14:31
Andreas Mohr 
Robert Maynard 
normalminoralways
closedmoved 
PCLinuxUbuntu LTS12.04
CMake 2.8.12.1 
 
0014721: Ninja: warning message related to WriteUnknownExplicitDependencies() for CMakeCache.txt: file entry simply not supported yet??
See minimal test case below.

amoh@lxamoh9010:~/cmake_tests/ninja_cmakecache_txt/build$ ninja
ninja: warning: multiple rules generate CMakeCache.txt. builds involving this target will not be correct; continuing anyway
ninja: no work to do.


Ninja 1.4.0, using CMake trunk.
cmake_minimum_required(VERSION 2.8)

project(ninja_cmakecache_txt C)

# ...and add a default target to create a backup of CMakeCache.txt,
# since that file might get destroyed too easily (at least CMake 2.6.4
# will kill it on out-of-disk-space, resulting in complete abort of
# configuration run):
if(NOT TARGET master_backup_CMakeCache)
  # CMAKE_CACHEFILE_DIR defined when cache already existing only...
  if(DEFINED CMAKE_CACHEFILE_DIR)
    # Better reference specific CMAKE_CACHEFILE_DIR variable (same as CMAKE_BINARY_DIR).
    # Unfortunately there's no CMake file name variable for "CMakeCache.txt"
    # (source code of CMake always open-codes that name),
    # thus there's nothing to reference here.
    set(CMakeCache_file "${CMAKE_CACHEFILE_DIR}/CMakeCache.txt")
    set(CMakeCache_file_backup "${CMakeCache_file}.backup")
    add_custom_command(OUTPUT "${CMakeCache_file_backup}"
      # copy_if_different _not_ needed (target dependency needs remaking? --> _do_ copy!)
      COMMAND "${CMAKE_COMMAND}" -E copy "${CMakeCache_file}" "${CMakeCache_file_backup}"
      DEPENDS "${CMakeCache_file}"
      COMMENT "creating CMakeCache backup (${CMakeCache_file_backup})"
    )
    add_custom_target(master_backup_CMakeCache ALL DEPENDS "${CMakeCache_file_backup}")
  endif(DEFINED CMAKE_CACHEFILE_DIR)
endif(NOT TARGET master_backup_CMakeCache)

file(WRITE test1.c "int main() { return 1; }")
add_library(test1 SHARED test1.c)
WriteUnknownExplicitDependencies() seems to be the function responsible for creating/filtering out these parts.

Manually removing the part

# =============================================================================
# Unknown Build Time Dependencies.
# Tell Ninja that they may appear as side effects of build rules
# otherwise ordered by order-only dependencies.

build CMakeCache.txt: phony CMakeCache.txt


from build.ninja makes the warning message go away, in fact.


So tell me that WriteUnknownExplicitDependencies() handling simply failed to have CMakeCache.txt listed as a build-environment-related file?
Or perhaps my sample is completely invalid since there might be a problem? (read: "I don't know what I'm doing here" :)

Thanks,

Andreas Mohr
No tags attached.
Issue History
2014-01-27 11:00Andreas MohrNew Issue
2014-01-27 11:08Brad KingAssigned To => Robert Maynard
2014-01-27 11:08Brad KingStatusnew => assigned
2016-06-10 14:29Kitware RobotNote Added: 0042470
2016-06-10 14:29Kitware RobotStatusassigned => resolved
2016-06-10 14:29Kitware RobotResolutionopen => moved
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0042470)
Kitware Robot   
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.