Hi,
TL;DR: The project compiles fine first time, but after touching a source
file to trigger a recompile, the recompilation fails with a large list of
errors.
To reproduce this must be done:
1) Have set(CMAKE_INCLUDE_CURRENT_DIR ON)
2) call your executable "list"
3) #include anywhere in your project or include a system/library
header that #includes
My own example, folder names have nothing to do with the bug:
[-] Blink
CMakeLists.txt
[-]blink
main.cpp
CMakeLists.txt
Top CMakeLists.txt content:
cmake_minimum_required(VERSION 2.8.12)
Project(Blink)
add_subdirectory(blink)
The other CMakeLists.txt file:
set(CMAKE_INCLUDE_CURRENT_DIR ON)
add_executable(list main.cpp)
main.cpp:
#include
#include
int main(int argc, char *argv[])
{
printf("Hello, world\n");
return 0;
}
The project will compile, but if main.cpp gets touched the
recompilation will fail.
Using Ubuntu 16.04, cmake version 3.5.1, any compiler (gcc/clang)
And here's the sample output of a failed compilation (the first umpteen lines):
build$ make
Scanning dependencies of target list
make[2]: Circular blink/CMakeFiles/list.dir/main.cpp.o <- blink/list
dependency dropped.
[ 50%] Building CXX object blink/CMakeFiles/list.dir/main.cpp.o
In file included from /media/data/docs/dev/Blink/blink/main.cpp:2:0:
/media/data/docs/dev/Blink/build/blink/list:1:1: error: stray ‘\177’ in program
ELF > � @ @ � @ 8 @@
^
/media/data/docs/dev/Blink/build/blink/list:1:1: error: stray ‘\2’ in program
/media/data/docs/dev/Blink/build/blink/list:1:1: error: stray ‘\1’ in program
/media/data/docs/dev/Blink/build/blink/list:1:1: error: stray ‘\1’ in program
/media/data/docs/dev/Blink/build/blink/list:1:8: warning: null
character(s) ignored
ELF > � @ @ � @ 8 @@
^
Plus lots and lots of lines, and ends with:
/media/data/docs/dev/Blink/build/blink/list:1:2: error: ‘ELF’ does not
name a type
ELF > � @ @ � @ 8 @@
^
/media/data/docs/dev/Blink/build/blink/list:1:651: error: ‘N’ does not
name a type
x-x86-64.so.2 GNU GNU �נ.;N�)��S� cQ
^
blink/CMakeFiles/list.dir/build.make:62: recipe for target
'blink/CMakeFiles/list.dir/main.cpp.o' failed
make[2]: *** [blink/CMakeFiles/list.dir/main.cpp.o] Error 1
CMakeFiles/Makefile2:85: recipe for target
'blink/CMakeFiles/list.dir/all' failed
make[1]: *** [blink/CMakeFiles/list.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
--
Powered by www.kitware.com
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Kitware offers various services to support the CMake community. For more
information on each offering, please visit:
CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers