[cmake-developers] [CMake 0012593]: CMAKE_C_COMPILER cannot contain command line arguments

Mantis Bug Tracker mantis at public.kitware.com
Sat Nov 26 16:09:14 EST 2011


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=12593 
====================================================================== 
Reported By:                Stefan Majewsky
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   12593
Category:                   CMake
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2011-11-26 16:09 EST
Last Modified:              2011-11-26 16:09 EST
====================================================================== 
Summary:                    CMAKE_C_COMPILER cannot contain command line
arguments
Description: 
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.


====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2011-11-26 16:09 Stefan MajewskyNew Issue                                    
======================================================================




More information about the cmake-developers mailing list