mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-27 18:44:13 +08:00
95 lines
2.9 KiB
Diff
95 lines
2.9 KiB
Diff
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
|
index 553f13b..03dc546 100644
|
|
--- a/CMakeLists.txt
|
|
+++ b/CMakeLists.txt
|
|
@@ -230,6 +230,9 @@
|
|
${SOURCE_DIR}/src/bson/bson-writer.h
|
|
)
|
|
|
|
+add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
|
+
|
|
+if (NOT BSON_ENABLE_STATIC)
|
|
add_library(bson_shared SHARED ${SOURCES} ${HEADERS})
|
|
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
|
|
set_target_properties(bson_shared PROPERTIES COMPILE_DEFINITIONS "BSON_COMPILATION;JSONSL_PARSE_NAN")
|
|
@@ -263,16 +266,21 @@
|
|
# must be handled specially since we can't resolve them
|
|
set(BSON_SYSTEM_LIBS ${BSON_SYSTEM_LIBS} ws2_32)
|
|
endif()
|
|
+endif()
|
|
|
|
if (BSON_ENABLE_STATIC)
|
|
add_library(bson_static STATIC ${SOURCES} ${HEADERS})
|
|
+ set(CMAKE_CXX_VISIBILITY_PRESET hidden)
|
|
set_target_properties(bson_static PROPERTIES COMPILE_DEFINITIONS "BSON_COMPILATION;BSON_STATIC;JSONSL_PARSE_NAN")
|
|
set_target_properties(bson_static PROPERTIES VERSION ${BSON_VERSION})
|
|
set_target_properties(bson_static PROPERTIES OUTPUT_NAME "bson-static-${BSON_API_VERSION}")
|
|
+ set(THREADS_PREFER_PTHREAD_FLAG 1)
|
|
+ find_package (Threads REQUIRED)
|
|
target_link_libraries(bson_static Threads::Threads)
|
|
if (RT_LIBRARY)
|
|
target_link_libraries (bson_static ${RT_LIBRARY})
|
|
endif()
|
|
+ find_library(M_LIBRARY m)
|
|
if (M_LIBRARY)
|
|
target_link_libraries (bson_static ${M_LIBRARY})
|
|
endif()
|
|
@@ -332,7 +340,7 @@
|
|
add_executable (${bin} ${BSON_EXAMPLE_SOURCES})
|
|
|
|
# Link against the shared lib like normal apps
|
|
- target_link_libraries(${bin} bson_shared)
|
|
+ target_link_libraries(${bin} bson_shared bson_static)
|
|
|
|
set (EXAMPLES ${EXAMPLES} ${bin})
|
|
endfunction ()
|
|
@@ -349,6 +357,7 @@
|
|
endif () # ENABLE_EXAMPLES
|
|
|
|
set (BSON_HEADER_INSTALL_DIR "include/libbson-${BSON_API_VERSION}")
|
|
+if (NOT BSON_ENABLE_STATIC)
|
|
install(
|
|
TARGETS bson_shared ${EXAMPLES}
|
|
LIBRARY DESTINATION lib
|
|
@@ -355,6 +364,7 @@
|
|
ARCHIVE DESTINATION lib
|
|
RUNTIME DESTINATION bin
|
|
)
|
|
+endif ()
|
|
if (BSON_ENABLE_STATIC)
|
|
install(
|
|
TARGETS bson_static ${EXAMPLES}
|
|
diff --git a/src/bson/bson-compat.h b/src/bson/bson-compat.h
|
|
index 05fc614..e8e2214 100644
|
|
--- a/src/bson/bson-compat.h
|
|
+++ b/src/bson/bson-compat.h
|
|
@@ -39,11 +39,11 @@
|
|
|
|
|
|
#ifdef BSON_OS_WIN32
|
|
-#if defined(_WIN32_WINNT) && (_WIN32_WINNT < 0x0600)
|
|
+#if defined(_WIN32_WINNT) && (_WIN32_WINNT < 0x0602)
|
|
#undef _WIN32_WINNT
|
|
#endif
|
|
#ifndef _WIN32_WINNT
|
|
-#define _WIN32_WINNT 0x0600
|
|
+#define _WIN32_WINNT 0x0602
|
|
#endif
|
|
#ifndef NOMINMAX
|
|
#define NOMINMAX
|
|
diff --git a/src/bson/bson-iso8601.c b/src/bson/bson-iso8601.c
|
|
index 8beea90..cb4b531 100644
|
|
--- a/src/bson/bson-iso8601.c
|
|
+++ b/src/bson/bson-iso8601.c
|
|
@@ -115,8 +115,8 @@ _bson_iso8601_date_parse (const char *str,
|
|
const char *day_ptr;
|
|
const char *hour_ptr;
|
|
const char *min_ptr;
|
|
- const char *sec_ptr;
|
|
- const char *millis_ptr;
|
|
+ const char *sec_ptr = NULL;
|
|
+ const char *millis_ptr = NULL;
|
|
const char *tz_ptr;
|
|
|
|
int32_t year_len = 0;
|