MantisBT - CMake
View Issue Details
0012593CMakeCMakepublic2011-11-26 16:092012-01-04 15:53
Stefan Majewsky 
Alex Neundorf 
normalminoralways
closedno change required 
i686openSUSE12.1
CMake 2.8.6 
 
0012593: CMAKE_C_COMPILER cannot contain command line arguments
The summary looks like I want CMAKE_C_FLAGS, but no! My usecase is linking something against dietlibc (http://www.fefe.de/dietlibc/ [^] for reference). The documentation for dietlibc suggests that I shall use the "diet" command for compiling. That command takes a gcc command line, e.g.

diet gcc -o test test.c

"diet" has its own bunch of options, e.g.

diet -Os -v gcc -o test test.c

I tried to use diet in CMake via

set(CMAKE_C_COMPILER "diet gcc")

but that outputs "diet gcc" into the Makefile verbatim (with the quotes!), and of course make then complains that the command "diet gcc" does not exist. When the quotes are omitted in CMakeLists.txt, the command in the Makefile becomes diet;gcc.

My current workaround is to

set(CMAKE_C_COMPILER ${PROJECT_SOURCE_DIR}/invoke-compiler.sh)

where that shell script calls "diet gcc $@", but I'd prefer a proper solution.

No tags attached.
Issue History
2011-11-26 16:09Stefan MajewskyNew Issue
2011-11-28 15:08Alex NeundorfAssigned To => Alex Neundorf
2011-11-28 15:08Alex NeundorfStatusnew => assigned
2011-11-28 15:08Alex NeundorfNote Added: 0027861
2011-12-11 10:30Alex NeundorfNote Added: 0027943
2012-01-04 15:53Alex NeundorfNote Added: 0028173
2012-01-04 15:53Alex NeundorfStatusassigned => closed
2012-01-04 15:53Alex NeundorfResolutionopen => no change required

Notes
(0027861)
Alex Neundorf   
2011-11-28 15:08   
Setting the CC/CXX environment variable before the initial cmake run to "diet gcc" should work.
set(CMAKE_C_COMPILER diet gcc)
should also work, if done early enough, i.e. at the cmake command line.

Alex
(0027943)
Alex Neundorf   
2011-12-11 10:30   
Has this solved your problem ?
If not, please let me know here, otherwise I'll close this ticket.

Alex
(0028173)
Alex Neundorf   
2012-01-04 15:53   
I interpret the silence here as that my suggestion works, so I'm closing this bug.
Feel free to reopen it if it doesn't.

Alex