Am 15.07.21 um 09:17 schrieb Dennis Luehring via Boost:
my boost build: mkdir ~/dev/3rdparty-liux-gcc cd ~/dev/3rdparty-linux-gcc wget https://dl.bintray.com/boostorg/release/1.75.0/source/boost_1_75_0.tar.bz2
tar -xf boost_1_75_0.tar.bz2 ln -s boost_1_75_0 ./boost cd boost_1_75_0 ./bootstrap.sh ./b2 --toolset=gcc cxxflags=-fPIC --build-dir=./_build address-model=64 architecture=x86 link=static threading=multi --with-graph --with-nowide --with-test --width-config --with-system --with-filesystem --stagedir=./_x64 ln -s _x64/lib lib
my simple test hierarchy:
boost_using_cmake_tests boost_using_cmake_tests\_build boost_using_cmake_tests\boost_using_cmake boost_using_cmake_tests\boost_using_cmake\CMakeLists.txt cmake_minimum_required (VERSION 3.16) set(Boost_NO_BOOST_CMAKE TRUE) set(Boost_NO_SYSTEM_PATHS TRUE) project (using_boost_with_cmake) set( MY_THIRD_PARTY_LIBS "~/dev/3rdparty-linux-gcc" ) set( BOOST_ROOT ${MY_THIRD_PARTY_LIBS}/boost ) set( BOOST_INCLUDEDIR ${BOOST_ROOT}/boost) set( BOOST_LIBRARYDIR ${BOOST_ROOT}/lib) find_package(Boost REQUIRED COMPONENTS unit_test_framework filesystem system) You explicitely opt-out of Boosts CMake support: set(Boost_NO_BOOST_CMAKE TRUE) You set the wrong folder: set( BOOST_ROOT ${MY_THIRD_PARTY_LIBS}/boost )
The INCLUDEDIR/LIBRARYDIR are not required. --> More generic: `export CMAKE_PREFIX_PATH=$HOME/dev/3rdparty-linux-gc/boost_1_75_:$CMAKE_PREFIX_PATH` Then you don't need ANY BOOST_*/Boost_* settings in your CML and can simply call find_package