Windows下CMake 中使用 pkg-config

#
set(PKG_CONFIG_EXECUTABLE "F:/vcpkg/packages/pkgconf_x64-windows/tools/pkgconf/pkgconf.exe")
#set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH ON)

set(PKG_CONFIG_ARGN "--errors-to-stdout"
                    "--no-cache"
                    "--log-file=F:/pkgconf.log"
                    "--with-path=F:/vcpkg/packages/zlib_x64-windows/lib/pkgconfig"
                    "--with-path=F:/vcpkg/packages/bzip2_x64-windows/lib/pkgconfig"
                    "--with-path=F:/vcpkg/packages/openssl_x64-windows/lib/pkgconfig"
                    "--path"
                    )

------------

# OpenSSL
list(APPEND CMAKE_PREFIX_PATH "F:/vcpkg/packages/openssl_x64-windows/share/openssl") 
#find_package(OpenSSL REQUIRED)
#target_link_libraries(main PRIVATE OpenSSL::SSL OpenSSL::Crypto)
#set(ENV{PKG_CONFIG_PATH} "F:/vcpkg/packages/openssl_x64-windows/lib/pkgconfig")
#list(APPEND ENV{PKG_CONFIG_PATH} "F:/vcpkg/packages/openssl_x64-windows/lib/pkgconfig")
#list(APPEND CMAKE_PREFIX_PATH "F:/vcpkg/packages/openssl_x64-windows/lib/pkgconfig")
#find_package(PkgConfig REQUIRED)
pkg_search_module(OpenSSL-libcrypto REQUIRED libcrypto)
pkg_search_module(OpenSSL-libssl REQUIRED libssl)
pkg_search_module(OpenSSL REQUIRED openssl)  #  libssl libcrypto

#include_directories(${OpenSSL_INCLUDE_DIRS})

message("OpenSSL_INCLUDE_DIRS  >>> ${OpenSSL_INCLUDE_DIRS}")

message("OpenSSL_LIBRARIES  >>> ${OpenSSL_LIBRARIES}")
posted @ 2023-03-07 11:35  ParamousGIS  阅读(1272)  评论(0编辑  收藏  举报