From 442b82a6c5dd08a415c0a566837f8ed85aecc630 Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Thu, 21 May 2020 21:53:39 +0200 Subject: [PATCH] CMake: add more STL checks and enable them in setup.h Closes https://github.com/wxWidgets/wxWidgets/pull/1862 --- build/cmake/setup.cmake | 71 +++++++++++++++++++++++++++++------------ 1 file changed, 51 insertions(+), 20 deletions(-) diff --git a/build/cmake/setup.cmake b/build/cmake/setup.cmake index 7808705b74..e26af41982 100644 --- a/build/cmake/setup.cmake +++ b/build/cmake/setup.cmake @@ -156,26 +156,58 @@ if(wxUSE_STL AND NOT wxHAS_CXX11) if(NOT wxTEST_STL) message(FATAL_ERROR "Can't use wxUSE_STL as basic STL functionality is missing") endif() - - wx_check_cxx_source_compiles(" - std::string foo, bar; - foo.compare(bar); - foo.compare(1, 1, bar); - foo.compare(1, 1, bar, 1, 1); - foo.compare(\"\"); - foo.compare(1, 1, \"\"); - foo.compare(1, 1, \"\", 2);" - HAVE_STD_STRING_COMPARE - string - ) - - wx_check_cxx_source_compiles( - "std::wstring s;" - HAVE_STD_WSTRING - string - ) endif() +wx_check_cxx_source_compiles(" + std::string foo, bar; + foo.compare(bar); + foo.compare(1, 1, bar); + foo.compare(1, 1, bar, 1, 1); + foo.compare(\"\"); + foo.compare(1, 1, \"\"); + foo.compare(1, 1, \"\", 2);" + HAVE_STD_STRING_COMPARE + string + ) + +wx_check_cxx_source_compiles( + "std::wstring s;" + HAVE_STD_WSTRING + string + ) + +wx_check_cxx_source_compiles(" + std::hash_map, std::equal_to > test1; + std::hash_set, std::equal_to > test2;" + HAVE_HASH_MAP + hash_map hash_set + ) +set(HAVE_STD_HASH_MAP ${HAVE_HASH_MAP}) + +wx_check_cxx_source_compiles(" + __gnu_cxx::hash_map, std::equal_to > test1; + __gnu_cxx::hash_set, std::equal_to > test2;" + HAVE_EXT_HASH_MAP + ext/hash_map ext/hash_set + ) +set(HAVE_GNU_CXX_HASH_MAP ${HAVE_EXT_HASH_MAP}) + +wx_check_cxx_source_compiles(" + std::unordered_map test1; + std::unordered_set test2;" + HAVE_STD_UNORDERED_MAP + unordered_map unordered_set + ) +set(HAVE_STD_UNORDERED_SET ${HAVE_STD_UNORDERED_MAP}) + +wx_check_cxx_source_compiles(" + std::tr1::unordered_map test1; + std::tr1::unordered_set test2;" + HAVE_TR1_UNORDERED_MAP + tr1/unordered_map tr1/unordered_set + ) +set(HAVE_TR1_UNORDERED_SET ${HAVE_TR1_UNORDERED_MAP}) + # Check for availability of GCC's atomic operations builtins. wx_check_c_source_compiles(" unsigned int value=0; @@ -544,8 +576,6 @@ check_struct_has_member("struct passwd" pw_gecos pwd.h HAVE_PW_GECOS) # Check for functions # --------------------------------------------------------------------------- -# TODO: wcslen - # Check various string symbols foreach(func ftime @@ -554,6 +584,7 @@ foreach(func wcsdup wcsnlen wcscasecmp wcsncasecmp wcsrctombs wcstoull + wcslen ) string(TOUPPER ${func} func_upper) check_symbol_exists(${func} wchar.h HAVE_${func_upper})