Basic Cmake and make on Mac OS Maverick for C
I'm a complete beginner in using Cmake to compile my own C code and I'm running Mac OS X Mavericks.
My problem is as follow. For my intro to Cmake, created a folder containing the following folders
bin/ build/ src/ fonctions.h fonctions.c main.c
Here my CMakeLists.txt file:
project(Addition) add_executable( bin/addition src/main.c src/fonctions.h src/fonctions.c )
When I run:
$ cmake . -G "Unix Makefiles"
and then make from my root folder, no problem.
But when I run:
$ cmake .. -G "Unix Makefiles"
and then make from my /build folder I got this error message:
Linking C executable bin/addition ld: can't open output file for writing: bin/addition, errno=2 for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [bin/addition] Error 1 make: *** [CMakeFiles/bin/addition.dir/all] Error 2 make: *** [all] Error 2
Anyone knows why?
add_executable( addition src/main.c src/fonctions.h src/fonctions.c )