queezythegreat / arduino-cmake

Arduino CMake Build system
645 stars 216 forks source link

Error with multiple libraries added with link_directories command #83

Closed szaffarano closed 9 years ago

szaffarano commented 10 years ago

If I add to my CMakeLists.txt

link_directories(${CMAKE_CURRENT_SOURCE_DIR}/libraries/)

And I add 2 or more libraries in this directory, then I get the error:

$ VERBOSE=1 make all
.......
.......
cd /home/sebas/Temp/test-error/build/sketch && /usr/bin/avr-g++    -g -Os       -mcall-prologues -ffunction-sections -fdata-sections -fno-exceptions   -DF_CPU=16000000L -DARDUINO=100 -mmcu=atmega328p -I"/usr/share/arduino/hardware/arduino/cores/arduino" -I"/usr/share/arduino/libraries" -I"/usr/share/arduino/hardware/arduino/variants/eightanaloginputs" -I"/usr/share/arduino/libraries/SD" -I"/usr/share/arduino/libraries/SD/utility";-I"/usr/share/arduino/libraries/LiquidCrystal" -I"/usr/share/arduino/libraries/LiquidCrystal/utility";-I"/usr/share/arduino/libraries/Wire" -I"/usr/share/arduino/libraries/Wire/utility" -I"/home/sebas/Temp/test-error/libraries/Util" -I"/home/sebas/Temp/test-error/libraries/Util/utility"  -I"/home/sebas/Temp/test-error/sketch" -I"/home/sebas/Temp/test-error/libraries/Util" -o CMakeFiles/nano328_Util.dir/__/libraries/Util/Util.cpp.obj -c /home/sebas/Temp/test-error/libraries/Util/Util.cpp
avr-g++: fatal error: no input files
compilation terminated.
/bin/sh: 1: -I/usr/share/arduino/libraries/LiquidCrystal: not found
/bin/sh: 1: -I/usr/share/arduino/libraries/Wire: not found
make[2]: *** [sketch/CMakeFiles/nano328_Util.dir/__/libraries/Util/Util.cpp.obj] Error 127
make[2]: se sale del directorio «/home/sebas/Temp/test-error/build»
make[1]: *** [sketch/CMakeFiles/nano328_Util.dir/all] Error 2
make[1]: se sale del directorio «/home/sebas/Temp/test-error/build»
make: *** [all] Error 2

Please look at the ";" in the middle of the avr-g++ sentence:

.....  -I"/usr/share/arduino/libraries/SD/utility";-I"/usr/share/arduino/libraries/LiquidCrystal" ....

With only one library in my custom libraries path, all works ok.

Here is a test which reproduces the error.

cevich commented 9 years ago

Mmm, this was merged, probably can be closed no?

szaffarano commented 9 years ago

Thank you!