Boost logo

Boost :

From: Dennis Luehring (dl.soluz_at_[hidden])
Date: 2022-06-04 08:51:00


this is a small test to get the linker error

CMakeLists.txt

cmake_minimum_required(VERSION 3.18)
project(example)
find_package(Boost CONFIG REQUIRED COMPONENTS unit_test_framework)
add_executable(example "main.cpp")
target_link_libraries(example Boost::unit_test_framework)

---
main.cpp
#define BOOST_TEST_MODULE MyTest
#include <boost/test/unit_test.hpp>
BOOST_AUTO_TEST_CASE( my_test )
{
   BOOST_CHECK( true );
}
---
how to build
my build environment LLVM 14, cmake 3.23, VS2017 latest, Boost 1.79
build boost 1.79 with VS2017
   1. boostrap.bat
   2. b2 -j%NUMBER_OF_PROCESSORS% toolset=msvc-14.1 address-model=64
--stagedir=.\lib64-msvc-14.1 --build-dir=.\__build --build-type=complete
threading=multi architecture=x86 --with-test
build example on console:
   1. set my_ninja_dir=D:/temp/clang_cl_test/ninja-win
   2. set my_llvm_dir=C:/Program Files/LLVM/bin
   3. set my_boost_dir=D:/temp/clang_cl_test/boost_1_79_0/lib64-msvc-14.1
   4. set path=%path%;%my_ninja_dir%;%my_llvm_dir%
   5. "C:\Program Files (x86)\Microsoft Visual
Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat"
   VS2017/cl build:
     6. cmake -G Ninja -DCMAKE_PREFIX_PATH="%my_boost_dir%"
-DCMAKE_BUILD_TYPE="Debug" ..\example
   clang-cl build:
     6. cmake -G Ninja -DCMAKE_C_COMPILER="clang-cl.exe"
-DCMAKE_CXX_COMPILER="clang-cl.exe" -DBoost_COMPILER="vc141"
-DCMAKE_PREFIX_PATH="%my_boost_dir%" ..\example
   7. ninja
the VS2017/cl builds and the example exe works
the clang-cl build got a link error:
  lld-link: error: could not open
'libboost_unit_test_framework-clangw14-mt-gd-x64-1_79.lib': no such file
or directory
  even when boost is built with -layout=tagged

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk