queezythegreat / arduino-cmake

Arduino CMake Build system
644 stars 216 forks source link

no spaces allowed in folder names in project path #48

Closed poramasionwu closed 11 years ago

poramasionwu commented 11 years ago

The project fails to compile if there are spaces in any of the folder names leading to the build folder...

example: if try the make command in the folder "my arduino project/build", I get errors

queezythegreat commented 11 years ago

Hi, could you please provide an example of your configuration.

HappyHeyoka commented 11 years ago

@naismith15 : I just found arduino-cmake and am having fun with it - I saw your comment I thought I would try to reproduce your problem.

Something that gets me occasionally with CMake is that you need to quote file names with spaces or some punctuation - this is not unique to arduino-cmake.

I made a simple 'blinky light' project in a folder with a space in the name and a source file also with spaces in the name and it builds fine for me.

eg: this is my CMakeLists.txt and it is in a folder named test blink; note the quoted file in the SRCS section generate_arduino_firmware(testblink SRCS testblink.cpp "source with spaces.cpp" PORT /dev/ttyACM1 SERIAL "microcom -p @INPUT_PORT@ -s 57600" BOARD ethernet) My platform is linux, hope this helps...

poramasionwu commented 11 years ago

I'm on Ubuntu 12.04.

I may just be missing the correct punctuation, I'm still new to cmake. My folder name is: test cmake

The error I get is:

    ~/arduino_projects/projects/test cmake/example/Blink/Blink.ino:8:20: fatal error: config.h: No such file or directory

my CMakeLists.txt is as follows:

    set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/ArduinoToolchain.cmake)
    cmake_minimum_required(VERSION 2.8)
    #====================================================================#
    #  Setup Project                                                     #
    #====================================================================#
    project("test cmake" C CXX)
    print_board_list()
    print_programmer_list()
    add_subdirectory(example)   #add the example directory into build
HappyHeyoka commented 11 years ago

what this does: add_subdirectory(example) #add the example directory into build is direct CMake to process another CMakeLists.txt file in a subdirectory example

What is the content of that file and what source/headers are in that subdirectory...?

poramasionwu commented 11 years ago

I'm basically just running queezy's project and following his readme. So the other CMakeLists.txt essentially looks like as shown in:

https://github.com/queezythegreat/arduino-cmake/blob/master/example/CMakeLists.txt

HappyHeyoka commented 11 years ago

Ok, I'm about stumped - not exactly a CMake expert and only a week into using arduino-cmake :-( So, last suggestions:

queezythegreat commented 11 years ago

Hi,

Sorry for responding so slowly, I've been a little bit busy. So I have tried to reproduce your problem, and I think I've reproduced it, although I got a different error. Here is what I did:

mkdir -p "dev/path with spaces"
cd "dev/path with spaces"

git clone git://github.com/queezythegreat/arduino-cmake.git
cd arduino-cmake

mkdir build
cd build

cmake ..
make

Configuration of the project worked as a charm, no errors. Building of the Arduino libraries worked without any errors. As the first firmware image was being built I got the error you describe:

-- The C compiler identification is GNU 4.7.0
-- The CXX compiler identification is GNU 4.7.0
-- Arduino SDK version 1.0: /usr/share/arduino
-- Check for working C compiler: /usr/bin/avr-gcc
-- Check for working C compiler: /usr/bin/avr-gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/avr-g++
-- Check for working CXX compiler: /usr/bin/avr-g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Arduino Boards:
--            uno: Arduino Uno

===== output omitted ========

-- 
-- Generating example Wire-master_writer
-- Generating blink_original
-- Generating blink_bundled
-- Generating blink_lib
-- Generating blink
-- Configuring done
-- Generating done
-- Build files have been written to: /home/queezy/dev/dir with spaces/arduino-cmake/build

Scanning dependencies of target uno_CORE
[  2%] Building CXX object example/CMakeFiles/uno_CORE.dir/usr/share/arduino/hardware/arduino/cores/arduino/WString.cpp.obj
[  4%] Building CXX object example/CMakeFiles/uno_CORE.dir/usr/share/arduino/hardware/arduino/cores/arduino/HardwareSerial.cpp.obj
[  6%] Building CXX object example/CMakeFiles/uno_CORE.dir/usr/share/arduino/hardware/arduino/cores/arduino/IPAddress.cpp.obj

===== output omitted ========

[ 82%] Building C object example/CMakeFiles/diecimila_CORE.dir/usr/share/arduino/hardware/arduino/cores/arduino/wiring_pulse.c.obj
Linking CXX static library libdiecimila_CORE.a
[ 82%] Built target diecimila_CORE
Scanning dependencies of target blink_bundled
[ 84%] Building CXX object example/CMakeFiles/blink_bundled.dir/blink_bundled_Blink.cpp.obj
avr-g++: error: with: No such file or directory
avr-g++: error: spaces/arduino-cmake/example/Blink: No such file or directory
make[2]: *** [example/CMakeFiles/blink_bundled.dir/blink_bundled_Blink.cpp.obj] Error 1
make[1]: *** [example/CMakeFiles/blink_bundled.dir/all] Error 2
make: *** [all] Error 2

I'm assuming that the error I got is the same as yours.

The error stems from the improper way the compiler options where being generated. I have fixed the problem, and the new version of arduino-cmake should be availabe under the develop branch.

Could you please confirm that this fiexes your problem.