Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MSVC: Fixes from vcpkg #912

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ if(MSVC)
"C4706" # assignment within conditional expression
"C4996" # The POSIX name for this item is deprecated.
# Instead, use the ISO C and C++ conformant name
"C5045" # Compiler will insert Spectre mitigation for memory
# load if /Qspectre switch specified
)
elseif(CMAKE_C_COMPILER_ID MATCHES "Intel")
add_definitions(-D_CRT_SUPPRESS_RESTRICT)
Expand All @@ -186,6 +188,10 @@ if(MSVC)
${MSVC_DISABLED_WARNINGS_LIST})
string(REGEX REPLACE "[/-]W[1234][ ]?" "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -MP -W4 ${MSVC_DISABLED_WARNINGS_STR}")
if(MSVC_VERSION GREATER_EQUAL 1912)
message(STATUS "Enabling spectre mitigation")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Qspectre")
endif()
endif()

check_function_exists(asprintf HAVE_ASPRINTF)
Expand Down
4 changes: 0 additions & 4 deletions apps/ocspcheck/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
if(NOT MSVC)

set(
OCSPCHECK_SRC
http.c
Expand Down Expand Up @@ -33,5 +31,3 @@ if(ENABLE_LIBRESSL_INSTALL)
install(FILES ocspcheck.8 DESTINATION ${CMAKE_INSTALL_MANDIR}/man8)

endif(ENABLE_LIBRESSL_INSTALL)

endif()
2 changes: 2 additions & 0 deletions crypto/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -778,6 +778,8 @@ endif()
if(NOT HAVE_GETOPT)
set(CRYPTO_SRC ${CRYPTO_SRC} compat/getopt_long.c)
set(EXTRA_EXPORT ${EXTRA_EXPORT} getopt)
set(EXTRA_EXPORT ${EXTRA_EXPORT} optarg)
set(EXTRA_EXPORT ${EXTRA_EXPORT} optind)
endif()

if(NOT HAVE_GETPAGESIZE)
Expand Down
3 changes: 2 additions & 1 deletion include/compat/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ ssize_t pwrite(int d, const void *buf, size_t nbytes, off_t offset);
#include <io.h>
#include <process.h>

#define STDIN_FILENO 0
#define STDOUT_FILENO 1
#define STDERR_FILENO 2

Expand Down Expand Up @@ -65,7 +66,7 @@ int getentropy(void *buf, size_t buflen);
#endif

#ifndef HAVE_GETOPT
#include <getopt.h>
#include "getopt.h"
#endif

#ifndef HAVE_GETPAGESIZE
Expand Down
2 changes: 2 additions & 0 deletions tls/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ if(WIN32)
compat/pread.c
compat/pwrite.c
)

set(LIBTLS_EXTRA_EXPORT ${LIBTLS_EXTRA_EXPORT} ftruncate)
endif()

if(NOT "${OPENSSLDIR}" STREQUAL "")
Expand Down