[CMake] Re: [cmake 2.5 CVS] CMAKE_${LANG}_FLAGS is initialized with space

Rodolfo Schulz de Lima rodolfo at rodsoft.org
Fri Dec 14 14:06:24 EST 2007


Bill Hoffman escreveu:
> Can you give an example that shows the unwanted semicolons?

For sure. Here's the setup:

test.c:
int main() {}

CMakeLists.txt:
list(APPEND CMAKE_C_FLAGS -Wall)
add_executable(test test.c)

when we run make, we have:
gcc: no input files
/bin/sh: -Wall: not found
make[2]: ** [CMakeFiles/test.dir/test.o] Erro 127
make[1]: ** [CMakeFiles/test.dir/all] Erro 2
make: ** [all] Erro 2

If we do 'make VERBOSE=1' (thanks on this one...):

/usr/bin/cmake -H/home/rodolfo/src/tst -B/home/rodolfo/src/tst 
--check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /home/rodolfo/src/tst/CMakeFiles 1
make -f CMakeFiles/Makefile2 all
make[1]: Entrando no diretório `/home/rodolfo/src/tst'
make -f CMakeFiles/test.dir/build.make CMakeFiles/test.dir/depend
make[2]: Entrando no diretório `/home/rodolfo/src/tst'
make[2]: Nada a ser feito para `CMakeFiles/test.dir/depend'.
make[2]: Saindo do diretório `/home/rodolfo/src/tst'
make -f CMakeFiles/test.dir/build.make CMakeFiles/test.dir/build
make[2]: Entrando no diretório `/home/rodolfo/src/tst'
/usr/bin/cmake -E cmake_progress_report /home/rodolfo/src/tst/CMakeFiles 1
[100%] Building C object CMakeFiles/test.dir/test.o
/usr/local/bin/gcc  ;-Wall   -o CMakeFiles/test.dir/test.o   -c 
/home/rodolfo/src/tst/test.c
gcc: no input files
/bin/sh: -Wall: not found
make[2]: ** [CMakeFiles/test.dir/test.o] Erro 127
make[2]: Saindo do diretório `/home/rodolfo/src/tst'
make[1]: ** [CMakeFiles/test.dir/all] Erro 2
make[1]: Saindo do diretório `/home/rodolfo/src/tst'
make: ** [all] Erro 2

See... the compiler arguments gets a ';-Wall', which confuses the shell 
interpreter. A way to circumvent this would be deleting all leading 
space from CMAKE_C_FLAGS before calling add_executable, but I smell a 
bug somewhere.

Regards,
rod



More information about the CMake mailing list