
Hello, I'm trying to convert CMake build system for Boost.Locale to Boost.Build one. I have one obvious issue: how do find a library? How do I convert this CMake code to Boost.Build one: if(MSVC AND "${CMAKE_BUILD_TYPE}" STREQUAL "Debug") set(ICU_SUFFIX "d") endif() find_library(ICU_UC icuuc${ICU_SUFFIX}) find_library(ICU_DATA icudt NAMES icudata) find_library(ICU_I18N icuin${ICU_SUFFIX} NAMES icui18n${ICU_SUFFIX}) find_path(ICU_INCLUDE_DIR unicode/unistr.h) Note: I search for icuuc or icuucd under debug/msvc icuin or icui18n or icuind under debug/msvc icudata or icudt Also I need the build to fail or disable library if ICU not found. I've looked into the Jamfile of regex... but it does not look correctly for debug icu version when debug build is done! (And actually this is a bug). Also the code looks like a hack. Is there any specific way do to this? Thanks, Artyom

Look at how Boost.Regex does it. It also uses ICU.
As I already mentioned: Boost.Regex ICU library search has a bug -- it does not search correctly debug/release versions when using MSVC compiler. Also it too tighten to specific platforms/implementations. So I ask if there is any standard way to do this, as today lib z ; But with fallback, with error reporting if not found, with options to search where is the library. I assume that ICU is not the only 3rd part library that Boost uses so Boost.Build should have some generic find_library like functionality I just can't find any documentation for it. BTW: Is there anything like CMAKE_INCLUDE_PATH/CMAKE_LIBRARY_PATH of CMake or autotools CXXFLAGS/LDFLAGS that allow to pass a path to libraries -- but in generic way -- to all modules. Artyom

Artyom wrote:
Look at how Boost.Regex does it. It also uses ICU.
As I already mentioned:
Boost.Regex ICU library search has a bug -- it does not search correctly debug/release versions when using MSVC compiler.
Is _d prefix actually needed? That is: - is linking to release version of ICU gonna cause problems due to ABI changes? - is _d prefix used by official distribution of ICU? If so, it's easy to change.
Also it too tighten to specific platforms/implementations.
So I ask if there is any standard way to do this, as today
lib z ;
But with fallback, with error reporting if not found, with options to search where is the library.
I assume that ICU is not the only 3rd part library that Boost uses so Boost.Build should have some generic find_library like functionality I just can't find any documentation for it.
I recommend you wait for a week. While it's certainly possible to improve ICU autodetection for your library, an convenient and consistent interface for such checks was one of my goals for 1.43 and is being designed right now.
BTW: Is there anything like CMAKE_INCLUDE_PATH/CMAKE_LIBRARY_PATH of CMake or autotools CXXFLAGS/LDFLAGS that allow to pass a path to libraries -- but in generic way -- to all modules.
You would use <include>whatever or <library-path>whatever in the requirements of Jamroot, or in project-config.jam - Volodya

Is _d prefix actually needed? That is:
- is linking to release version of ICU gonna cause problems due to ABI changes? - is _d prefix used by official distribution of ICU?
If so, it's easy to change.
Yes, icu release links to MSVC90.DLL and icu debug to MSVC90D.DLL and this is very bad idea to link an application to both MSVC90.DLL **and** MSVC90D.DLL (I spend few weeks trying to figure out where is the problem and why my application does not start). And this is not "_d" prefix but rather "d" -> icuuc.lib/icuucd.lib and this is for MSVC builds only.
I recommend you wait for a week. While it's certainly possible to improve ICU autodetection for your library, an convenient and consistent interface for such checks was one of my goals for 1.43 and is being designed right now.
Ok this is very good. Because without such checks Boost.Build is quite... underpowered.
You would use <include>whatever or <library-path>whatever in the requirements of Jamroot, or in project-config.jam
Ok, so meanwhile I'll add explicit parameters to bjam. Artyom P.S.: To be honest... This is second build system I learn for last several month. I was quite frustrated by moving to CMake from autotools just in order to add MSVC support... I really hope that Boost.Build would be little bit simpler after my frustration with CMake.

Artyom wrote:
Look at how Boost.Regex does it. It also uses ICU.
As I already mentioned:
Boost.Regex ICU library search has a bug -- it does not search correctly debug/release versions when using MSVC compiler.
Also it too tighten to specific platforms/implementations.
So I ask if there is any standard way to do this, as today
lib z ;
I don't know if it's a standard way or not, but in the Sandbox, you can find build_extensions. I use them to specify and build dependencies like zlib, libpng, libtiff, etc. 1) Add the extensions to BOOST_BUILD_PATH += /path/to/exts 2) In Jamfile, add using zlib : X.Y.Z : /path/to/zlib/sources ; Perhaps you'll find them useful. Best regards, -- Mateusz Loskot, http://mateusz.loskot.net
participants (4)
-
Artyom
-
Mateusz Loskot
-
Mathias Gaunard
-
Vladimir Prus