[cmake-developers] [wishlist BUG?] limit on the length of the CFLAGS environment variable too small?
Alan W. Irwin
irwin at beluga.phys.uvic.ca
Mon Aug 1 16:20:04 EDT 2011
On 2011-08-01 15:01-0400 Brad King wrote:
> On 07/31/2011 02:54 PM, Alan W. Irwin wrote:
>> It looks okay to me, but I am not familiar with the format of that
>> file so I have attached it so you can see for yourself. Also, to help
>> you replicate exactly what I did using the minimal CMakeLists.txt file
>> I posted, here is how I created that CFLAGS:
>>
>> export CFLAGS=$(gcc -c -Q -O0 --help=optimizers \
>> |grep enabled |sed -e "s?\\[enabled\\]? ?g" -e "s? -f? -fno-?g")
>> CFLAGS="-g $CFLAGS"
>
> You're putting literal newlines into the value of CFLAGS. This is
> not supported. Convert them to normal spaces first.
Forget my last post. You were absolutely correct. My test with
echo $CFLAGS |od -a
is meaningless since echo itself (or its bash environment?) removes
all the tabs and newlines that the above was putting into CFLAGS. I
definitely don't understand why that removal happens, but I have
proved that is the case by piping the inner part of the above $()
command to od -a directly.
Anyhow, here is the correct way to create this long list of gcc
options in a form that CMake understands:
export CFLAGS=$(gcc -c -Q -O0 --help=optimizers \
|grep enabled |sed -e "s?\\[enabled\\]? ?g" -e "s? -f? -fno-?g" \
| tr -d "\n"|tr -d "\t" |sed "s? *? ?g")
CFLAGS="-g $CFLAGS"
CMake 2.8.5 had no trouble with that form at all for the simple test
project so there is no issue here. Thanks for helping me to
understand that.
Alan
__________________________
Alan W. Irwin
Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).
Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of
Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________
Linux-powered Science
__________________________
More information about the cmake-developers
mailing list