The following issue has been SUBMITTED. ====================================================================== http://public.kitware.com/Bug/view.php?id=14721 ====================================================================== Reported By: Andreas Mohr Assigned To: ====================================================================== Project: CMake Issue ID: 14721 Category: CMake Reproducibility: always Severity: minor Priority: normal Status: new ====================================================================== Date Submitted: 2014-01-27 11:00 EST Last Modified: 2014-01-27 11:00 EST ====================================================================== Summary: Ninja: warning message related to WriteUnknownExplicitDependencies() for CMakeCache.txt: file entry simply not supported yet?? Description: 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. Steps to Reproduce: 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) Additional Information: 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 ====================================================================== Issue History Date Modified Username Field Change ====================================================================== 2014-01-27 11:00 Andreas Mohr New Issue ====================================================================== -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers