From c1e3f9d41451f0ae13babdd01a5f899f702d5bf2 Mon Sep 17 00:00:00 2001
From: Michael Wilder <wilder.michael@cimcor.com>
Date: Fri, 21 Aug 2015 13:49:58 -0500
Subject: [PATCH 3/3] do not use ssh_threads_static library (pthreads) in Visual Studio projects
 Signed-off-by: Michael Wilder wilder.michael@cimcor.com

---
 CMakeLists.txt       |   17 +++++++++++++++--
 tests/CMakeLists.txt |   20 +++++++++++++-------
 2 files changed, 28 insertions(+), 9 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 69d0196..522bfe0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,7 +8,7 @@ set(APPLICATION_NAME ${PROJECT_NAME})
 
 set(APPLICATION_VERSION_MAJOR "0")
 set(APPLICATION_VERSION_MINOR "7")
-set(APPLICATION_VERSION_PATCH "0")
+set(APPLICATION_VERSION_PATCH "1")
 
 set(APPLICATION_VERSION "${APPLICATION_VERSION_MAJOR}.${APPLICATION_VERSION_MINOR}.${APPLICATION_VERSION_PATCH}")
 
@@ -85,7 +85,19 @@ add_subdirectory(src)
 
 # pkg-config file
 configure_file(libssh.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/libssh.pc)
-configure_file(libssh_threads.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/libssh_threads.pc)
+if (NOT CMAKE_USE_WIN32_THREADS_INIT)
+	configure_file(libssh_threads.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/libssh_threads.pc)
+endif ()
+if (CMAKE_USE_WIN32_THREADS_INIT)
+install(
+  FILES
+    ${CMAKE_CURRENT_BINARY_DIR}/libssh.pc
+  DESTINATION
+    ${LIB_INSTALL_DIR}/pkgconfig
+  COMPONENT
+    pkgconfig
+)
+else ()
 install(
   FILES
     ${CMAKE_CURRENT_BINARY_DIR}/libssh.pc
@@ -95,6 +107,7 @@ install(
   COMPONENT
     pkgconfig
 )
+endif ()
 
 # cmake config files
 set(LIBSSH_LIBRARY_NAME ${CMAKE_SHARED_LIBRARY_PREFIX}ssh${CMAKE_SHARED_LIBRARY_SUFFIX})
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 3bbb330..00906ac 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -9,9 +9,9 @@ set(TORTURE_LIBRARY torture)
 include_directories(
   ${LIBSSH_PUBLIC_INCLUDE_DIRS}
   ${CMOCKA_INCLUDE_DIR}
-  ${OPENSSL_INCLUDE_DIR}
-  ${GCRYPT_INCLUDE_DIR}
-  ${ZLIB_INCLUDE_DIR}
+  ${OPENSSL_INCLUDE_DIRS}
+  ${GCRYPT_INCLUDE_DIRS}
+  ${ZLIB_INCLUDE_DIRS}
   ${CMAKE_BINARY_DIR}
   ${CMAKE_SOURCE_DIR}/src
   ${CMAKE_CURRENT_SOURCE_DIR}
@@ -23,10 +23,16 @@ set(TORTURE_LINK_LIBRARIES
     ${LIBSSH_LINK_LIBRARIES})
 
 if (Threads_FOUND)
-    set(TORTURE_LINK_LIBRARIES
-        ${TORTURE_LINK_LIBRARIES}
-        ${LIBSSH_THREADS_STATIC_LIBRARY}
-        ${LIBSSH_THREADS_LINK_LIBRARIES})
+	if (CMAKE_USE_WIN32_THREADS_INIT)
+		set(TORTURE_LINK_LIBRARIES
+			${TORTURE_LINK_LIBRARIES}
+			${LIBSSH_THREADS_LINK_LIBRARIES})
+	else ()
+		set(TORTURE_LINK_LIBRARIES
+			${TORTURE_LINK_LIBRARIES}
+			${LIBSSH_THREADS_STATIC_LIBRARY}
+			${LIBSSH_THREADS_LINK_LIBRARIES})
+	endif ()
 endif ()
 
 # create test library
-- 
1.7.1

