BewareMyPower opened a new pull request, #251:
URL: https://github.com/apache/pulsar-client-cpp/pull/251

   ### 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 an element like:
   
   ```
   debug;C:/Program Files/OpenSSL/lib/VC/libcrypto64MDd.lib
   ```
   
   The list above have two elements:
   1. `debug`
   2. `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:
   
   ```
   C:/Program Files/OpenSSL/lib/VC/libcrypto64MDd.lib
   ```
   
   i.e. the `debug` and `optimized` elements are removed, the rest elements 
that follows `debug` or `optimized` (determined by the build mode) will be 
retained.
   
   See 
https://github.com/apache/pulsar-client-cpp/blob/a57bb072ce6140757917353cc1d5a0007ddc353d/lib/CMakeLists.txt#L109
   
   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`:
   
   > fatal error LNK1181: cannot open input file 'C:\Program'
   
   ### Modifications
   
   Instead of setting the `STATIC_LIBRARY_FLAGS` property, set the 
`STATIC_LIBRARY_OPTIONS` property, which is a list rather than a string. So the 
blank in the list element won't affect. Then in `remove_libtype`, return a list 
instead of a string.
   
   References:
   - 
https://cmake.org/cmake/help/latest/prop_tgt/STATIC_LIBRARY_OPTIONS.html#prop_tgt:STATIC_LIBRARY_OPTIONS
   - 
https://cmake.org/cmake/help/latest/prop_tgt/STATIC_LIBRARY_FLAGS.html#prop_tgt:STATIC_LIBRARY_FLAGS
   
   ### Documentation
   
   <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
   
   - [ ] `doc-required` 
   (Your PR needs to update docs and you will update later)
   
   - [x] `doc-not-needed` 
   (Please explain why)
   
   - [ ] `doc` 
   (Your PR contains doc changes)
   
   - [ ] `doc-complete`
   (Docs have been already added)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to