-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
[openssl] Fix vcpkg-cmake-wrapper.cmake #18475
Conversation
@SpriteOvO, could you help test this PR? |
I fetch this PR with the following method: message("Fetching 'vcpkg'...")
FetchContent_Declare(
vcpkg
GIT_REPOSITORY "https://github.com/PhoebeHui/vcpkg.git"
GIT_TAG "4545560ec03fd5ff28b4a580c2f47e09f781d65a"
)
FetchContent_MakeAvailable(vcpkg)
# bootstrap...
# find OpenSSL... but the compilation still failed and I got same error messages.
|
@SpriteOvO Clean reconfigure? |
Yes, I tried twice and deleted the CMake cache both times. |
@SpriteOvO, I double confirmed the Crypt32.lib;ws2_32.lib have added to %AdditionalDependencies% in project file, so it should work, I suspect you haven't get these changes, you can check if these in installed\x64-windows-static\share\openssl\vcpkg-cmake-wrapper.cmake file maually. |
@PhoebeHui I checked that file and it has the same content as the latest commit in your PR branch. I created a new project to test the master branch and your PR branch and they both work fine, the problem only occurs in the project I'm currently developing. Maybe some other stuff screwed it up, I'll do some investigating. BTW, I got a warning |
The warning only appears if you are using I'm sorry I didn't figure out these details earlier. CMakeLists.txt: cmake_minimum_required(VERSION 3.20)
include(FetchContent)
project(vcpkg_issue_18408)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED True)
# vcpkg
#
message("Fetching 'vcpkg'...")
FetchContent_Declare(
vcpkg
GIT_REPOSITORY "https://github.com/PhoebeHui/vcpkg.git"
GIT_TAG "86418e5b882e5dc59d15a39402d23193b64c94f8"
)
FetchContent_MakeAvailable(vcpkg)
message("Fetch 'vcpkg' done.")
message("Bootstrapping 'vcpkg'...")
if (MSVC)
execute_process(
COMMAND powershell ./bootstrap-vcpkg.bat -disableMetrics
WORKING_DIRECTORY ${vcpkg_SOURCE_DIR}
COMMAND_ECHO STDOUT
)
if (NOT EXISTS "${vcpkg_SOURCE_DIR}/vcpkg.exe")
message(FATAL_ERROR "Bootstrap 'vcpkg' failed.")
endif()
else()
message(FATAL_ERROR "Need to port.")
endif()
message("Bootstrap 'vcpkg' done.")
include("${vcpkg_SOURCE_DIR}/scripts/buildsystems/vcpkg.cmake")
# OpenSSL
#
message("Installing 'OpenSSL'...")
execute_process(
COMMAND powershell ./vcpkg.exe install openssl:x64-windows-static
WORKING_DIRECTORY ${vcpkg_SOURCE_DIR}
COMMAND_ECHO STDOUT
)
set(OPENSSL_ROOT_DIR PATH "${vcpkg_SOURCE_DIR}/installed/x64-windows-static")
set(OPENSSL_USE_STATIC_LIBS BOOL TRUE)
find_package(OpenSSL REQUIRED)
message("Install 'OpenSSL' done.")
# asio
#
message("Fetching 'asio'...")
FetchContent_Declare(
asio
GIT_REPOSITORY "https://github.com/chriskohlhoff/asio.git"
GIT_TAG "asio-1-18-2"
)
FetchContent_MakeAvailable(asio)
message("Fetch 'asio' done.")
add_executable(
vcpkg_issue_18408
main.cpp
)
target_include_directories(
vcpkg_issue_18408 PRIVATE
"${asio_SOURCE_DIR}/asio/include"
)
target_link_libraries(
vcpkg_issue_18408 PRIVATE
OpenSSL::SSL OpenSSL::Crypto
) main.cpp: #include <openssl/sha.h>
#include <asio.hpp>
#include <asio/ssl.hpp>
int main()
{
return 0;
} |
@SpriteOvO, it looks you need change your configuration to x64 in your VS project, or change to x64 visual Studio prompt. |
@PhoebeHui The configuration is always and this is the full CMake output:
|
@SpriteOvO, this is unrelated to the changes, could you please report an issue with repro steps and full failure logs instead? |
@PhoebeHui Sure, I will do it later. |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
@vicroms, could you help merge this PR? |
Fixes #18408
PR #18042 added a new vcpkg-cmake-wrapper.cmake which override the origin one under windows and unix folder, so merge the changes:
openssl/vcpkg-cmake-wrapper.cmake -> openssl/vcpkg-cmake-wrapper.cmake.in
openssl/windows/vcpkg-cmake-wrapper.cmake -> openssl/vcpkg-cmake-wrapper.cmake.in
openssl/unix/vcpkg-cmake-wrapper.cmake -> openssl/vcpkg-cmake-wrapper.cmake.in