[cmake-developers] [CMake 0014446]: Regression in cmMakefile::GetSourceFileWithOutput

Mantis Bug Tracker mantis at public.kitware.com
Sat Sep 28 10:26:36 EDT 2013


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=14446 
====================================================================== 
Reported By:                Stephen Kelly
Assigned To:                Brad King
====================================================================== 
Project:                    CMake
Issue ID:                   14446
Category:                   CMake
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     assigned
Target Version:             CMake 2.8.12
====================================================================== 
Date Submitted:             2013-09-28 10:26 EDT
Last Modified:              2013-09-28 10:26 EDT
====================================================================== 
Summary:                    Regression in cmMakefile::GetSourceFileWithOutput
Description: 

The kde strigidaemon repo does not build with the next branch (and 2.8.12 RC).

 http://build.kde.org/view/kdesupport/job/strigidaemon_master/23/consoleText


 [ 55%] [ 57%] Error copying file (if different) from
"/srv/jenkins/workspace/strigidaemon_master/build/bin/daemon/dbus/dbusclientinterface.cpp"
to
"/srv/jenkins/workspace/strigidaemon_master/bin/daemon/dbus/generated/dbusclientinterface.cpp".
 make[2]: *** [bin/daemon/dbus/dbusclientinterface.cpp] Error 1
 make[2]: *** Waiting for unfinished jobs....
 Generating dbustestinterface.cpp
 Scanning dependencies of target strigicmd
 Building CXX object
bin/daemon/xsd/CMakeFiles/strigidaemonconfiguration.dir/strigidaemonconfiguration.cpp.o
 Error copying file (if different) from
"/srv/jenkins/workspace/strigidaemon_master/build/bin/daemon/dbus/dbustestinterface.cpp"
to
"/srv/jenkins/workspace/strigidaemon_master/bin/daemon/dbus/generated/dbustestinterface.cpp".
 [ 59%] make[2]: *** [bin/daemon/dbus/dbustestinterface.cpp] Error 1
 make[1]: *** [bin/daemon/dbus/CMakeFiles/dbusserver.dir/all] Error 2
 make[1]: *** Waiting for unfinished jobs....
 [ 59%] Building CXX object
bin/strigicmd/CMakeFiles/strigicmd.dir/strigicmd.cpp.o

It builds prior to commit 2268c41a057d948 (Optimize custom command full-path
dependency lookup, 2013-08-06). 

It also builds with the following patch:

 diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index fd06a33..2aea078 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -2094,7 +2094,7 @@ cmSourceFile *cmMakefile::GetSourceFileWithOutput(const
char *cname)
 
   // If the queried path is not absolute we use the backward compatible
   // linear-time search for an output with a matching suffix.
-  if(!cmSystemTools::FileIsFullPath(cname))
+//   if(!cmSystemTools::FileIsFullPath(cname))
     {
     return LinearGetSourceFileWithOutput(cname);
     }

The code is here:

 https://projects.kde.org/projects/kdesupport/strigi/strigidaemon/repository/revisions/master/entry/bin/daemon/dbus/CMakeLists.txt

It looks buggy to me as in the perl-found branch (as taken by KDE jenkins), two
custom commands have the same output file. A policy may be needed to choose the
linear search in old behavior.


Steps to Reproduce: 

The problem can be reduced to this testcase:

 cmake_minimum_required(VERSION 2.8)

 execute_process(COMMAND ${CMAKE_COMMAND} -E touch
"${CMAKE_CURRENT_BINARY_DIR}/input.cpp")
 execute_process(COMMAND ${CMAKE_COMMAND} -E touch
"${CMAKE_CURRENT_BINARY_DIR}/main_dep.h")

 add_custom_command(
     OUTPUT  "${CMAKE_CURRENT_BINARY_DIR}/output.cpp"
     COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${CMAKE_CURRENT_BINARY_DIR}/input.cpp" "${CMAKE_CURRENT_BINARY_DIR}/output.cpp"
     MAIN_DEPENDENCY "${CMAKE_CURRENT_BINARY_DIR}/main_dep.h"
 )
 add_custom_command(
     OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/output.cpp"
     COMMAND ${CMAKE_COMMAND} -E copy_if_different
         "${CMAKE_CURRENT_BINARY_DIR}/output.cpp"
         "${CMAKE_CURRENT_SOURCE_DIR}/final_output.cpp"
 )

 add_library(dbusserver STATIC
     "${CMAKE_CURRENT_BINARY_DIR}/output.cpp"
 )

If the MAIN_DEPENDENCY line is commented out, an error is reported at CMake
time.

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

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2013-09-28 10:26 Stephen Kelly  New Issue                                    
2013-09-28 10:26 Stephen Kelly  Status                   new => assigned     
2013-09-28 10:26 Stephen Kelly  Assigned To               => Brad King       
======================================================================




More information about the cmake-developers mailing list