Linker errors under Linux on using locale in a tiny example - using my own boost build

i can't built a simple locale from_utf using example with my own build
boost 1.84.0
[system]
SUSE Tumbleweed
gcc (SUSE Linux) 13.2.1 20240206 [revision
67ac78caf31f7cb3202177e6428a46d829b70f23]
[boost build]
using
https://boostorg.jfrog.io/artifactory/main/release/1.84.0/source/boost_1_84_...
tar -xf boost_1_84_0.tar.bz2
cd boost_1_84_0
./bootstrap.sh --prefix=/home/test/boost_1_84_0_install
./b2 install
----
[CMakeLists.txt]
cmake_minimum_required (VERSION 3.14)
project (MyTest)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
list(APPEND CMAKE_PREFIX_PATH "/home/test/boost_1_84_0_install/lib/cmake")
find_package( Boost REQUIRED COMPONENTS locale )
add_executable( my_test main.cpp)
target_link_libraries( my_test PRIVATE Boost::boost )
----
[main.cpp]
#include

Dennis Luehring wrote: ...
find_package( Boost REQUIRED COMPONENTS locale ) add_executable( my_test main.cpp) target_link_libraries( my_test PRIVATE Boost::boost ) ... any idea what is happening here?
Since Locale is a compiled library, you need to link to Boost::locale. target_link_libraries( my_test PRIVATE Boost::boost Boost::locale )

On 3/20/24 23:07, Peter Dimov via Boost wrote:
Dennis Luehring wrote: ...
find_package( Boost REQUIRED COMPONENTS locale ) add_executable( my_test main.cpp) target_link_libraries( my_test PRIVATE Boost::boost ) ... any idea what is happening here?
Since Locale is a compiled library, you need to link to Boost::locale.
target_link_libraries( my_test PRIVATE Boost::boost Boost::locale )
What is the Boost::boost target?

Andrey Semashev wrote:
On 3/20/24 23:07, Peter Dimov via Boost wrote:
Dennis Luehring wrote: ...
find_package( Boost REQUIRED COMPONENTS locale ) add_executable( my_test main.cpp) target_link_libraries( my_test PRIVATE Boost::boost ) ... any idea what is happening here?
Since Locale is a compiled library, you need to link to Boost::locale.
target_link_libraries( my_test PRIVATE Boost::boost Boost::locale )
What is the Boost::boost target?
It's the (FindBoost) target for all header-only libraries. https://cmake.org/cmake/help/latest/module/FindBoost.html#imported-targets We call this Boost::headers, but Boost::boost is also defined for compatibility.

Am 20.03.2024 um 21:07 schrieb Peter Dimov via Boost:
Since Locale is a compiled library, you need to link to Boost::locale.
target_link_libraries( my_test PRIVATE Boost::boost Boost::locale )
thank your for solving it - i copied that Boost cmake stuff over from a big project which uses locale very often - but i did't found any Boost::locale used in this project which is based only on find_package(boost config ...) - maybe some other boost lib is grabbing the dependency automaticly in this project? thanks again
participants (3)
-
Andrey Semashev
-
Dennis Luehring
-
Peter Dimov