Open tlanc007 opened 5 years ago
Would it be correct to rename this issue as follows: "Fails to build under MacOS with XCode"?
Sure. I just renamed it.
I had no trouble building on MacOS/Xcode using the develop branch. Here are the steps I used:
tar xjf ~/Downloads/boost_1_70_0.tar.bz
cd boost_1_70
./bootstrap.sh
./b2 --with-test --with-system --with-filesystem
cd ..
git clone https://github.com/cierelabs/boostache.git
cd boostache
git checkout develop
mkdir build
cd build
cmake -G Xcode -DBOOST_ROOT=~/work/ciere/boost_1_70_0 ..
xcodebuild -scheme ALL_BUILD
# test
examples/Debug/example1 # etc.
Sorry, I wasn't clear. I wasn't referring to the Xcode as a generator. There is an issue when using the native compiler for Makefile generation. That is why I didn't use Xcode as the original subject.
cmake -DBoost_NO_BOOST_CMAKE=true -G "Unix Makefiles" ..
The -std option is never passed to the compiler and so there will be errors like:
boostache/include/boost/boostache/vm/traits.hpp:76:32: error: a space is required between consecutive right angle brackets (use '> >') struct is_map<std::map<T1,T2>>
But: CC=clang CXX=clang++ cmake -DBoost_NO_BOOST_CMAKE=true -G "Unix Makefiles" ..
is fine, assuming one's path is pointing to different compilers than the native ones provided by Xcode.
I'm not seeing this issue...
For Unix Makefiles it finds (without my help) /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
I used cmake -G "Unix Makefiles" -DBOOST_ROOT=/blah/blah ..
without any special environment changes. Adding -DBoost_NO_BOOST_CMAKE=true
makes no difference.
I wonder if it's an Xcode setup issue. I did have to do sudo xcode-select --reset
for the Xcode generator previously. Maybe try it?
The logic in the CMakeLists.txt doesn't recognize the native MacOS (Xcode) compiler as a clang compiler. The result is that the examples won't build as the search paths and compiler options are wrong.
The work around is to specify a true clang/llvm compiler when running cmake.