Fix the static library might failed to link on Windows #251
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
Currently the CI in master is broken, here is an example failure: https://github.com/apache/pulsar-client-cpp/actions/runs/4688588681/jobs/8309495018?pr=249
The reason is that the latest Windows runner image is already integrated with the OpenSSL library to link, i.e. the
COMMON_LIBS
list variable might have a sub-list like:The list above have two elements:
debug
C:/Program Files/OpenSSL/lib/VC/libcrypto64MDd.lib
When building the static library, the list above will be converted to a space-separated string like:
i.e. the
debug
andoptimized
elements are removed, the rest elements that followsdebug
oroptimized
(determined by the build mode) will be retained.See
pulsar-client-cpp/lib/CMakeLists.txt
Line 109 in a57bb07
However, since there is a blank in
Program Files
, the string above is unexpectedly treated as two elements:C:/Program
Files/OpenSSL/lib/VC/libcrypto64MDd.lib
Then, the CI failed when linking to
pulsarWithDeps.lib
:Modifications
Instead of setting the
STATIC_LIBRARY_FLAGS
property, set theSTATIC_LIBRARY_OPTIONS
property, which is a list rather than a string. So the blank in the list element won't affect. Then inremove_libtype
, return a list instead of a string.References:
Documentation
doc-required
(Your PR needs to update docs and you will update later)
doc-not-needed
(Please explain why)
doc
(Your PR contains doc changes)
doc-complete
(Docs have been already added)