Skip to content

Support crypto (AKA eay) with MSVC as well #679

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ install:
build_script:
- md build
- cd build
- cmake -DCMAKE_PREFIX_PATH=c:\projects\libpcap\Win32\WpdPack -G"Visual Studio 12 2013" ..
- cmake -DCMAKE_PREFIX_PATH=c:\projects\libpcap\Win32\WpdPack -DOPENSSL_ROOT_DIR=c:\OpenSSL-Win32 -G"Visual Studio 12 2013" ..
- msbuild -nologo -p:Configuration=Release tcpdump.sln
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ if(WITH_CRYPTO)
# Check for some functions.
#
cmake_push_check_state()
set(CMAKE_REQUIRED_LIBRARIES crypto)
set(CMAKE_REQUIRED_LIBRARIES ${CRYPTO_LIBRARIES})

#
# 1) do we have EVP_CIPHER_CTX_new?
Expand Down
22 changes: 20 additions & 2 deletions cmake/Modules/FindCRYPTO.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,29 @@
# Try to find libcrypto.
#

if(MSVC)
find_package(OpenSSL QUIET)
endif()

# Try to find the header
find_path(CRYPTO_INCLUDE_DIR openssl/crypto.h)
find_path(CRYPTO_INCLUDE_DIR openssl/crypto.h
HINTS
${OPENSSL_INCLUDE_DIR}
)

# Try to find the library
find_library(CRYPTO_LIBRARY crypto)
if(NOT MSVC)
find_library(CRYPTO_LIBRARY crypto)
else()
if(USE_STATIC_RT)
set(OPENSSL_MSVC_STATIC_RT 1)
endif()
# going the extra mile...
set(CRYPTO_LIBRARY_RELEASE ${LIB_EAY_RELEASE})
set(CRYPTO_LIBRARY_DEBUG ${LIB_EAY_DEBUG})
include(SelectLibraryConfigurations)
select_library_configurations(CRYPTO)
endif()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(CRYPTO
Expand Down