mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-24 02:37:55 +08:00
dcc7ddcd5c
* [mbedtls/nana] Update to the latest version * [nana] Remove unused patch and update patch EOF
103 lines
2.8 KiB
Diff
Executable File
103 lines
2.8 KiB
Diff
Executable File
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
|
index 8833246..f68ab02 100644
|
|
--- a/CMakeLists.txt
|
|
+++ b/CMakeLists.txt
|
|
@@ -28,6 +28,7 @@ set(MBEDTLS_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
|
|
|
option(USE_PKCS11_HELPER_LIBRARY "Build mbed TLS with the pkcs11-helper library." OFF)
|
|
option(ENABLE_ZLIB_SUPPORT "Build mbed TLS with zlib library." OFF)
|
|
+option(ENABLE_PTHREAD "Build mbed TLS with pthread" OFF)
|
|
|
|
option(ENABLE_PROGRAMS "Build mbed TLS programs." ON)
|
|
|
|
@@ -231,6 +232,8 @@ else()
|
|
set(LIB_INSTALL_DIR lib)
|
|
endif()
|
|
|
|
+include_directories(${CMAKE_CURRENT_BINARY_DIR}/include/)
|
|
+
|
|
if(ENABLE_ZLIB_SUPPORT)
|
|
find_package(ZLIB)
|
|
|
|
@@ -239,6 +242,17 @@ if(ENABLE_ZLIB_SUPPORT)
|
|
endif(ZLIB_FOUND)
|
|
endif(ENABLE_ZLIB_SUPPORT)
|
|
|
|
+if(ENABLE_PTHREAD)
|
|
+ if(WIN32)
|
|
+ find_package(pthreads_windows REQUIRED)
|
|
+ include_directories(${PThreads4W_INCLUDE_DIR})
|
|
+ else()
|
|
+ set(CMAKE_THREAD_PREFER_PTHREAD ON)
|
|
+ find_package(Threads REQUIRED)
|
|
+ endif()
|
|
+ set(LINK_WITH_PTHREAD ON)
|
|
+endif()
|
|
+
|
|
add_subdirectory(include)
|
|
|
|
add_subdirectory(3rdparty)
|
|
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
|
|
index 62c0f62..7923202 100644
|
|
--- a/include/CMakeLists.txt
|
|
+++ b/include/CMakeLists.txt
|
|
@@ -1,10 +1,14 @@
|
|
option(INSTALL_MBEDTLS_HEADERS "Install mbed TLS headers." ON)
|
|
|
|
+configure_file(mbedtls/config_threading.h.in mbedtls/config_threading.h)
|
|
+
|
|
if(INSTALL_MBEDTLS_HEADERS)
|
|
|
|
file(GLOB headers "mbedtls/*.h")
|
|
file(GLOB psa_headers "psa/*.h")
|
|
-
|
|
+
|
|
+ set(headers ${headers} ${CMAKE_CURRENT_BINARY_DIR}/mbedtls/config_threading.h)
|
|
+
|
|
install(FILES ${headers}
|
|
DESTINATION include/mbedtls
|
|
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
|
|
diff --git a/include/mbedtls/config.h b/include/mbedtls/config.h
|
|
index 1e6e052..51c20da 100644
|
|
--- a/include/mbedtls/config.h
|
|
+++ b/include/mbedtls/config.h
|
|
@@ -24,6 +24,8 @@
|
|
* limitations under the License.
|
|
*/
|
|
|
|
+#include "mbedtls/config_threading.h"
|
|
+
|
|
#ifndef MBEDTLS_CONFIG_H
|
|
#define MBEDTLS_CONFIG_H
|
|
|
|
diff --git a/include/mbedtls/config_threading.h.in b/include/mbedtls/config_threading.h.in
|
|
new file mode 100644
|
|
index 0000000..9d5d42e
|
|
--- /dev/null
|
|
+++ b/include/mbedtls/config_threading.h.in
|
|
@@ -0,0 +1,6 @@
|
|
+#cmakedefine ENABLE_PTHREAD
|
|
+
|
|
+#ifdef ENABLE_PTHREAD
|
|
+#define MBEDTLS_THREADING_C
|
|
+#define MBEDTLS_THREADING_PTHREAD
|
|
+#endif
|
|
\ No newline at end of file
|
|
diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt
|
|
index 33e2cfc..4b99331 100644
|
|
--- a/library/CMakeLists.txt
|
|
+++ b/library/CMakeLists.txt
|
|
@@ -137,7 +137,11 @@ if(ENABLE_ZLIB_SUPPORT)
|
|
endif(ENABLE_ZLIB_SUPPORT)
|
|
|
|
if(LINK_WITH_PTHREAD)
|
|
- set(libs ${libs} pthread)
|
|
+ if(WIN32)
|
|
+ set(libs ${libs} ${PThreads4W_LIBRARY})
|
|
+ else()
|
|
+ set(libs ${libs} pthread)
|
|
+ endif()
|
|
endif()
|
|
|
|
if(LINK_WITH_TRUSTED_STORAGE)
|