Pallavi-Banerjee21 / votca

Automatically exported from code.google.com/p/votca
0 stars 0 forks source link

build.sh doesn't correctly pass space-containing arguments to cmake #133

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
Attempt to invoke build.sh using -DCMAKE_CXX_FLAGS="-Bextra/dir/ -std=c++0x" 
(required for my boost compilation with icc)

What is the expected output? What do you see instead?
Depending on the combination of the use of quotes and backslashes, cmake will 
take either only -Bextra/dir as the extra flag, or a nonworking flag such as 
"-Bextra/dir.

What version of the product are you using? On what operating system?
build.sh v1.8.5 on Linux (Scientific Linux 5 variant).
Compiler icc 12.1 and boost 1.47.0

Please provide any additional information below.
I fixed build.sh (attached) by using an array to store cmake_opts. 
Space-containing options are now correctly and transparently passed to cmake.
A minor cosmetic problem now happens: when the cmake invocation command is 
printed to the user the quotes around the space-containing arguments aren't be 
printed (this may mislead users into thinking their flags won't be correctly 
parsed by cmake).

I haven't researched whether this fix significantly changes the minimum bash 
version requirement.

Cheers,
Manuel Melo

Original issue reported on code.google.com by manuel.n...@gmail.com on 7 Jul 2013 at 12:05

Attachments:

GoogleCodeExporter commented 8 years ago
Hi Manuel,

thanks a lot for the report and your fix, I will incorporate it soon. I usually 
use CXXFLAGS to set compiler flags, but it should work with CMAKE_CXX_FLAGS, 
too. 

Array are supported in bash since 2.x, so I think that should be fine, I am 
more afraid some extglob stuff, we are using, is not supported by bash-2.x. 

Concerning the printed message, I am just printing ${cmake_opts[@]// /\\ }, 
which print "\ " instead of space, which is not very nice, but at least not 
wrong.

Original comment by christop...@gmail.com on 7 Jul 2013 at 5:11

GoogleCodeExporter commented 8 years ago
This issue was closed by revision b7e5a6bf0d0d.

Original comment by christop...@gmail.com on 7 Jul 2013 at 5:38