Re: [cmake-developers] Possibly an obscure bug

2016-06-15 Thread Chuck Atkins
This isn't a bug but more of a weird side effect of having your executable
named the same as an include file and adding the destination directory for
the executable in the include path.  The same thing would happen if your
executable was named foo and you had "#include ".  By setting
CMAKE_INCLUDE_CURRENT_DIR to on then CMake is adding
-I/path/to/source/blink and -I/path/to/build/blink to the compile line.
The default destination for the list executable also happens to be
/path/to/build/blink.  The second time around, the list executable from the
first run is in the include path, thus #include  picks up the
executable instead of the C++ header.
-- 

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

Re: [cmake-developers] Possibly an obscure bug

2016-06-15 Thread Ben Boeckel
On Wed, Jun 15, 2016 at 21:34:27 +0300, Binkie Pinkie wrote:
> 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   @@
>  ^

Looks like the built binary gets found by the compiler and it tries to
#include it. Try setting:

set(EXECUTABLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}/bin")

to put the executable outside of the -I paths.

--Ben
-- 

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

[cmake-developers] Possibly an obscure bug

2016-06-15 Thread Binkie Pinkie
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