From 389b9c35e0ae57d61999e3a8fe5f8685b6eae765 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Sun, 18 Oct 2015 17:50:40 +0100 Subject: [PATCH] Try and improve ICU detection to avoid "DLL Hell". --- build/Jamfile.v2 | 16 +++++++++++++++- build/has_icu_test.cpp | 6 +++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/build/Jamfile.v2 b/build/Jamfile.v2 index f69362c6..05c4d170 100644 --- a/build/Jamfile.v2 +++ b/build/Jamfile.v2 @@ -115,7 +115,21 @@ if ! $(disable-icu) } -exe has_icu : ./has_icu_test.cpp : $(ICU_OPTS) ; +actions regex_simple_run_action +{ + $(>) > $(<) +} + +rule regex-run-simple ( sources + : args * : input-files * : requirements * : target-name ) +{ + exe $(target-name)_exe : $(sources) : $(requirements) ; + explicit $(target-name)_exe ; + make $(target-name).output : $(target-name)_exe : @mp_simple_run_action ; + explicit $(target-name).output ; + alias $(target-name) : $(target-name).output ; +} + +regex-run-simple has_icu_test.cpp : : : $(ICU_OPTS) : has_icu ; explicit has_icu ; alias icu_options : : : : [ check-target-builds has_icu : $(ICU_OPTS) : ] ; diff --git a/build/has_icu_test.cpp b/build/has_icu_test.cpp index f79880cc..518ac2ff 100644 --- a/build/has_icu_test.cpp +++ b/build/has_icu_test.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #if defined(_MSC_VER) && !defined(_DLL) #error "Mixing ICU with a static runtime doesn't work" @@ -22,5 +23,8 @@ int main() { UErrorCode err = U_ZERO_ERROR; UChar32 c = ::u_charFromName(U_UNICODE_CHAR_NAME, "GREEK SMALL LETTER ALPHA", &err); + if(err) return err; + U_NAMESPACE_QUALIFIER Locale l; + boost::scoped_ptr p_col(U_NAMESPACE_QUALIFIER Collator::createInstance(l, err)); return err; -} \ No newline at end of file +}