1616
1717include (IncludeNlohmannJson )
1818find_package (CURL REQUIRED )
19- find_package (OpenSSL REQUIRED )
19+ if (NOT WIN32 )
20+ find_package (OpenSSL REQUIRED )
21+ endif ()
2022
2123# the library
2224add_library (
@@ -90,8 +92,9 @@ add_library(
9092 internal /oauth2_service_account_credentials.h
9193 internal /oauth2_universe_domain.cc
9294 internal /oauth2_universe_domain.h
93- internal /openssl_util.cc
94- internal /openssl_util.h
95+ internal /openssl/parse_service_account_p12_file.cc
96+ internal /openssl/sign_using_sha256.cc
97+ internal /parse_service_account_p12_file.h
9598 internal /populate_rest_options.cc
9699 internal /populate_rest_options.h
97100 internal /rest_carrier.cc
@@ -109,6 +112,7 @@ add_library(
109112 internal /rest_response.cc
110113 internal /rest_response.h
111114 internal /rest_retry_loop.h
115+ internal /sign_using_sha256.h
112116 internal /tracing_http_payload.cc
113117 internal /tracing_http_payload.h
114118 internal /tracing_rest_client.cc
@@ -117,15 +121,25 @@ add_library(
117121 internal /tracing_rest_response.h
118122 internal /unified_rest_credentials.cc
119123 internal /unified_rest_credentials.h
124+ internal /win32/parse_service_account_p12_file.cc
125+ internal /win32/sign_using_sha256.cc
126+ internal /win32/win32_helpers.cc
127+ internal /win32/win32_helpers.h
120128 rest_options.h )
121129target_link_libraries (
122130 google_cloud_cpp_rest_internal
123131 PUBLIC absl::span google-cloud-cpp::common CURL::libcurl
124- nlohmann_json::nlohmann_json OpenSSL::SSL OpenSSL::Crypto )
132+ nlohmann_json::nlohmann_json )
125133if (WIN32 )
134+ target_compile_definitions (google_cloud_cpp_rest_internal
135+ PRIVATE WIN32_LEAN_AND_MEAN )
126136 # We use `setsockopt()` directly, which requires the ws2_32 (Winsock2 for
127137 # Windows32?) library on Windows.
128- target_link_libraries (google_cloud_cpp_rest_internal PUBLIC ws2_32 )
138+ target_link_libraries (google_cloud_cpp_rest_internal PUBLIC ws2_32 bcrypt
139+ crypt32 )
140+ else ()
141+ target_link_libraries (google_cloud_cpp_rest_internal PUBLIC OpenSSL::SSL
142+ OpenSSL::Crypto )
129143endif ()
130144google_cloud_cpp_add_common_options (google_cloud_cpp_rest_internal )
131145target_include_directories (
@@ -165,9 +179,17 @@ google_cloud_cpp_install_headers(google_cloud_cpp_rest_internal
165179 include /google/cloud )
166180
167181google_cloud_cpp_add_pkgconfig (
168- rest_internal "REST library for the Google Cloud C++ Client Library"
182+ rest_internal
183+ "REST library for the Google Cloud C++ Client Library"
169184 "Provides REST Transport for the Google Cloud C++ Client Library."
170- "google_cloud_cpp_common" "libcurl" "openssl" )
185+ "google_cloud_cpp_common"
186+ "libcurl"
187+ NON_WIN32_REQUIRES
188+ openssl
189+ WIN32_LIBS
190+ ws2_32
191+ bcrypt
192+ crypt32 )
171193
172194# Create and install the CMake configuration files.
173195include (CMakePackageConfigHelpers )
0 commit comments