I need to compile boost libraries with ExternalProject_Add
, and the build command needs
c++11 flags on MacOS platform with Clang.
The command should look like this:
./bin/b2 debug release cxxflags="-std=c++11 -stdlib=libc++" linkflags=-stdlib=libc++
But I have a problem with the quotes and space.
set(BOOST_CXX_FLAGS cxxflags="-std=c++11 -stdlib=libc++")
set(BOOST_TOOL_SET toolset=clang ${BOOST_CXX_FLAGS}
linkflags=-stdlib=libc++)
ExternalProject_Add(boost
....
BUILD_COMMAND ./bin/b2 debug release
${BOOST_TOOL_SET}
....
)
The ${BOOST_TOOL_SET}
value is a list, and cxxflags="-std=c++11
-stdlib=libc++"
is one item in it. The generated command line becomes strange:
./bin/b2 debug release "cxxflags=\"-std=c++11 -stdlib=libc++\""
linkflags=-stdlib=libc++
It seems the flag is translated by CMake when it detected the space inside the argument and wrapped it with quote marks, but it's not what I want.
I searched on the Internet, but haven't found any help. Is there any tip about this issue?