Santosh Singh
Santosh Singh

Reputation: 887

Make C/C++ project static library using CMake for ios target

I am making a build using make tool, for gdal library, I am able to configure using the following command.

cmake .. -G Xcode \                                                   
-DCMAKE_TOOLCHAIN_FILE=../ios-cmake/ios.toolchain.cmake \
-DPLATFORM=OS64COMBINED \
-DENABLE_BITCODE=1 \
-DCMAKE_INSTALL_PREFIX=../install \
-DPROJ_LIBRARY=/opt/homebrew/opt/proj/lib/libproj.a \
-DPROJ_INCLUDE_DIR=/opt/homebrew/opt/proj/include \
-DCRYPTOPP_LIBRARY=/opt/homebrew/opt/cryptopp/lib/libcryptopp.a \
-DCRYPTOPP_INCLUDE_DIR=/opt/homebrew/opt/cryptopp/include \
-DXercesC_LIBRARY=/opt/homebrew/opt/xerces-c/lib/libxerces-c.a \
-DXercesC_INCLUDE_DIR=/opt/homebrew/opt/xerces-c/include \
-DBUILD_APPS=OFF \
-DBUILD_PYTHON_BINDINGS=OFF \
-DWITH_GDAL_TOOLS=OFF \
-DLIBKML_INCLUDE_DIR=/opt/homebrew/Cellar/libkml/1.3.0_1/include \
-DLIBKML_LIBRARY_DIR=/opt/homebrew/Cellar/libkml/1.3.0_1/lib/libkml.a \
-DBOOST_INCLUDE_DIR=/opt/homebrew/Cellar/boost/1.86.0_2/include \
-DBOOST_LIBRARY_DIR=/opt/homebrew/Cellar/boost/1.86.0_2/lib

It successfully configure then project but it always failed when making build using "cmake --build . --config Release".

ERROR :

    ** BUILD FAILED **


The following build commands failed:
    CompileC /Users/santoshsingh/GDAL\ SETUP/gdal/build-ios/build/ogr_LIBKML.build/Release-iphoneos/Objects-normal/arm64/ogrlibkmlgeometry.o /Users/santoshsingh/GDAL\ SETUP/gdal/ogr/ogrsf_frmts/libkml/ogrlibkmlgeometry.cpp normal arm64 c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'ogr_LIBKML' from project 'gdal')



In file included from /opt/homebrew/Cellar/libkml/1.3.0_1/include/kml/dom/kml_cast.h:31:
/opt/homebrew/Cellar/libkml/1.3.0_1/include/kml/base/xml_element.h:31:10: fatal error: 'boost/intrusive_ptr.hpp' file not found
   31 | #include "boost/intrusive_ptr.hpp"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~

Upvotes: 0

Views: 39

Answers (1)

Neil Butcher
Neil Butcher

Reputation: 608

Looking at the gdal docs, there doesn't seem to be a BOOST_INCLUDE_DIR CMake general configure option provided. So adding this to the cmake command is probably not doing anything to include the header files. Instead the documentation says:

Similarly, recent versions of Homebrew no longer bundle Boost with libkml, 
causing a failure to find Boost headers. You should either install Boost 
manually or disable libkml when building on MacOS:

cmake -DGDAL_USE_LIBKML=OFF ..

So were there any warnings or mentions of boost during the cmake configure step of the cmake process, was a manually installed version found?

After installing boost manually (or finding an existing BoostConfig.cmake file) you can point to it with the cmake option -Boost_DIR.

Upvotes: 0

Related Questions