View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0012593CMakeCMakepublic2011-11-26 16:092012-01-04 15:53
ReporterStefan Majewsky 
Assigned ToAlex Neundorf 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionno change required 
Platformi686OSopenSUSEOS Version12.1
Product VersionCMake 2.8.6 
Target VersionFixed in Version 
Summary0012593: CMAKE_C_COMPILER cannot contain command line arguments
DescriptionThe 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.

TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0027861)
Alex Neundorf (developer)
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 (developer)
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 (developer)
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

 Issue History
Date Modified Username Field Change
2011-11-26 16:09 Stefan Majewsky New Issue
2011-11-28 15:08 Alex Neundorf Assigned To => Alex Neundorf
2011-11-28 15:08 Alex Neundorf Status new => assigned
2011-11-28 15:08 Alex Neundorf Note Added: 0027861
2011-12-11 10:30 Alex Neundorf Note Added: 0027943
2012-01-04 15:53 Alex Neundorf Note Added: 0028173
2012-01-04 15:53 Alex Neundorf Status assigned => closed
2012-01-04 15:53 Alex Neundorf Resolution open => no change required


Copyright © 2000 - 2018 MantisBT Team