[cmake-developers] [CMake 0013474]: CMake Makefile generator does not re-scan dependencies if object fails to build
Mantis Bug Tracker
mantis at public.kitware.com
Wed Aug 15 11:29:41 EDT 2012
The following issue has been SUBMITTED.
======================================================================
http://public.kitware.com/Bug/view.php?id=13474
======================================================================
Reported By: Brad King
Assigned To:
======================================================================
Project: CMake
Issue ID: 13474
Category: CMake
Reproducibility: always
Severity: minor
Priority: normal
Status: new
======================================================================
Date Submitted: 2012-08-15 11:29 EDT
Last Modified: 2012-08-15 11:29 EDT
======================================================================
Summary: CMake Makefile generator does not re-scan
dependencies if object fails to build
Description:
While tracking down behavior reported in issue
http://public.kitware.com/Bug/view.php?id=13471 I narrowed it down to a test
case not involving Fortran. If a source file fails to produce an object file,
perhaps due to a compilation error, then the user typically edits it to fix the
error. On the next "make" CMake should re-scan dependencies of the modified
file. It doesn't always do this. See steps to reproduce.
Steps to Reproduce:
$ cat ../CMakeLists.txt
cmake_minimum_required(VERSION 2.8)
project(bug CXX)
add_executable(bug bug.cxx)
$ cat ../bug.hxx
int bug(void) { return 0; }
$ cat ../bug.cxx
//#include "bug.hxx"
int main() { return bug(); }
$ cmake .. && make
...
Scanning dependencies of target bug
[100%] Building CXX object CMakeFiles/bug.dir/bug.cxx.o
.../bug.cxx: In function ‘int main()’:
.../bug.cxx:2:25: error: ‘bug’ was not declared in this scope
$ vi ../bug.cxx && cat ../bug.cxx
#include "bug.hxx"
int main() { return bug(); }
$ make
[100%] Building CXX object CMakeFiles/bug.dir/bug.cxx.o
Linking CXX executable bug
[100%] Built target bug
# The above should have re-scanned. Now it does not know about bug.hxx:
$ touch ../bug.hxx
$ make
[100%] Built target bug
# The above should have re-compiled. One can work around the problem with an
explicit "make depend":
$ make depend
$ make
Scanning dependencies of target bug
[100%] Building CXX object CMakeFiles/bug.dir/bug.cxx.o
Linking CXX executable bug
[100%] Built target bug
======================================================================
Issue History
Date Modified Username Field Change
======================================================================
2012-08-15 11:29 Brad King New Issue
======================================================================
More information about the cmake-developers
mailing list