vcpkg/ports/libproxy/support-windows.patch

84 lines
2.8 KiB
Diff
Raw Normal View History

diff --git a/cmake/paths.cmk b/cmake/paths.cmk
index 593ebc1..bbf8754 100644
--- a/cmake/paths.cmk
+++ b/cmake/paths.cmk
@@ -1,4 +1,4 @@
-if(WIN32 AND NOT MINGW)
+if(0)
set(CMAKE_INSTALL_PREFIX "" CACHE PATH "Install prefix")
set(BIN_INSTALL_DIR . CACHE PATH "Binary install dir")
set(LIB_INSTALL_DIR . CACHE PATH "Library install dir")
diff --git a/libproxy/cmake/devfiles.cmk b/libproxy/cmake/devfiles.cmk
index 0301dce..0eb5f83 100644
--- a/libproxy/cmake/devfiles.cmk
+++ b/libproxy/cmake/devfiles.cmk
@@ -1,4 +1,4 @@
-if(NOT WIN32 OR MINGW)
+if(1)
# PkgConfig file
set (PKGCONFIG_PREFIX ${CMAKE_INSTALL_PREFIX})
diff --git a/libproxy/cmake/libproxy.cmk b/libproxy/cmake/libproxy.cmk
index aab7593..465685f 100644
--- a/libproxy/cmake/libproxy.cmk
+++ b/libproxy/cmake/libproxy.cmk
@@ -21,5 +21,5 @@ set_property(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/proxy.cpp
set_target_properties(libproxy PROPERTIES PREFIX "" VERSION 1.0.0 SOVERSION 1)
set_target_properties(libproxy PROPERTIES INTERFACE_LINK_LIBRARIES "")
set_target_properties(libproxy PROPERTIES LINK_INTERFACE_LIBRARIES "")
-install(TARGETS libproxy DESTINATION ${LIB_INSTALL_DIR})
+install(TARGETS libproxy RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
install(FILES proxy.h DESTINATION ${INCLUDE_INSTALL_DIR})
diff --git a/libproxy/modules/config_kde.cpp b/libproxy/modules/config_kde.cpp
index b9bd241..73b978e 100644
--- a/libproxy/modules/config_kde.cpp
+++ b/libproxy/modules/config_kde.cpp
@@ -19,7 +19,9 @@
******************************************************************************/
#include <sys/stat.h>
+#if !defined(WIN32)
#include <unistd.h>
+#endif
#include <algorithm>
#include <cstdlib>
@@ -137,7 +139,11 @@ private:
string command_output(const string &cmdline) throw (runtime_error) {
// Capture stderr as well
const string command = "(" + cmdline + ")2>&1";
+#if !defined(WIN32)
FILE *pipe = popen(command.c_str(), "r");
+#else
+ FILE *pipe = _popen(command.c_str(), "r");
+#endif
if (!pipe)
throw runtime_error("Unable to run command");
@@ -148,7 +154,11 @@ private:
result += buffer; // TODO: If this throws bad_alloc, pipe is leaked
}
+#if !defined(WIN32)
if(pclose(pipe) != 0)
+#else
+ if(_pclose(pipe) != 0)
+#endif
throw runtime_error("Command failed");
// Trim newlines and whitespace at end
diff --git a/libproxy/url.cpp b/libproxy/url.cpp
index b61a9bc..021763e 100644
--- a/libproxy/url.cpp
+++ b/libproxy/url.cpp
@@ -33,7 +33,9 @@
#include <cstdlib> // For atoi()
#include <sys/stat.h> // For stat()
#include <algorithm> // For transform()
+#if !defined(WIN32)
#include <unistd.h> // For read() close()
+#endif
#ifdef WIN32
#include <io.h>