The following issue has been SUBMITTED. 
====================================================================== 
http://www.cmake.org/Bug/view.php?id=13889 
====================================================================== 
Reported By:                Micha Hergarden
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   13889
Category:                   CMake
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2013-02-04 06:00 EST
Last Modified:              2013-02-04 06:00 EST
====================================================================== 
Summary:                    Multiple add_custom_command for the same output file
lead to multiple rules being generated for the same file
Description: 
The cmake ninja generator adds multiple build rules for the same file, when
there are multiple add_custom_command supplied in subdirectories. When ninja is
run with the generated build.ninja file this leads to the following warning:

ninja: warning: multiple rules generate /tmp/test.c. build will not be correct;
continuing anyway

I am using the latest ninja from the git repository:
https://github.com/martine/ninja.git
commit 05736568b9a26599865dd7452e62f70ecdbc9e41

Steps to Reproduce: 
1. Create a CMakeLists.txt file which adds two subdirectories, e.g.:

cmake_minimum_required(VERSION 2.8)
ADD_SUBDIRECTORY(tst1)
ADD_SUBDIRECTORY(tst2)

2. Create two CMakeLists.txt files for the subdirectories, both of which add a
custom command for the same output file, and an executable using that file,
e.g.:
ADD_CUSTOM_COMMAND(OUTPUT /tmp/test.c COMMAND cmake ARGS -E copy
/home/test/test.c /tmp/test.c)
ADD_EXECUTABLE(test1 /tmp/test.c)

3. Run cmake -G Ninja
   You can now examine the build.ninja file to see the multiple build rules
4. Run ninja
   You will now see the ninja warning.

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

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2013-02-04 06:00 Micha HergardenNew 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

Reply via email to