File tree 2 files changed +36
-2
lines changed 2 files changed +36
-2
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,34 @@ if( CMAKE_COMPILER_IS_GNUCXX )
9
9
endif ()
10
10
endif ( CMAKE_COMPILER_IS_GNUCXX )
11
11
12
+ include (CheckIncludeFileCXX)
13
+ include (CheckTypeSize)
14
+ include (CheckStructHasMember)
15
+ include (CheckCXXSymbolExists)
16
+
17
+ check_include_file_cxx(clocale HAVE_CLOCALE)
18
+ check_cxx_symbol_exists(localeconv clocale HAVE_LOCALECONV)
19
+
20
+ if (CMAKE_VERSION VERSION_LESS 3.0.0)
21
+ # The "LANGUAGE CXX" parameter is not supported in CMake versions below 3,
22
+ # so the C compiler and header has to be used.
23
+ check_include_file(locale.h HAVE_LOCALE_H)
24
+ set (CMAKE_EXTRA_INCLUDE_FILES locale.h)
25
+ check_type_size("struct lconv" LCONV_SIZE)
26
+ unset (CMAKE_EXTRA_INCLUDE_FILES)
27
+ check_struct_has_member("struct lconv" decimal_point locale.h HAVE_DECIMAL_POINT)
28
+ else ()
29
+ set (CMAKE_EXTRA_INCLUDE_FILES clocale)
30
+ check_type_size(lconv LCONV_SIZE LANGUAGE CXX)
31
+ unset (CMAKE_EXTRA_INCLUDE_FILES)
32
+ check_struct_has_member(lconv decimal_point clocale HAVE_DECIMAL_POINT LANGUAGE CXX)
33
+ endif ()
34
+
35
+ if (NOT (HAVE_CLOCALE AND HAVE_LCONV_SIZE AND HAVE_DECIMAL_POINT AND HAVE_LOCALECONV))
36
+ message (WARNING "Locale functionality is not supported" )
37
+ add_definitions (-DJSONCPP_NO_LOCALE_SUPPORT)
38
+ endif ()
39
+
12
40
SET ( JSONCPP_INCLUDE_DIR ../../include )
13
41
14
42
SET ( PUBLIC_HEADERS
Original file line number Diff line number Diff line change 6
6
#ifndef LIB_JSONCPP_JSON_TOOL_H_INCLUDED
7
7
#define LIB_JSONCPP_JSON_TOOL_H_INCLUDED
8
8
9
- #ifndef NO_LOCALE_SUPPORT
9
+
10
+ // Also support old flag NO_LOCALE_SUPPORT
11
+ #ifdef NO_LOCALE_SUPPORT
12
+ #define JSONCPP_NO_LOCALE_SUPPORT
13
+ #endif
14
+
15
+ #ifndef JSONCPP_NO_LOCALE_SUPPORT
10
16
#include < clocale>
11
17
#endif
12
18
18
24
19
25
namespace Json {
20
26
static char getDecimalPoint () {
21
- #ifdef NO_LOCALE_SUPPORT
27
+ #ifdef JSONCPP_NO_LOCALE_SUPPORT
22
28
return ' \0 ' ;
23
29
#else
24
30
struct lconv * lc = localeconv ();
You can’t perform that action at this time.
0 commit comments