Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[C++] Fix Windows build issues about static library (apache#10956)
### Motivation On Windows Platform, .lib files can be either **static libraries** or **import libraries**. For example, when we build an executable with dynamic linking, we need to link to `xxx.lib` during compilation and `xxx.dll` for running. The `xxx.lib` here is not the static library but the import library that is associated with the dynamic library. Currently if C++ library is built on Windows using release mode, following files wil be generated under `<BUILD_DIR>\lib\Release`: - pulsar.dll - pulsar.lib However, the associated import library (`pulsar.lib`) of `pulsar.dll` is overwritten by the static library because they share the same name. So we must set `-DBUILD_STATIC_LIB=OFF` option to disable building static libraries. However, it will fail on Windows: ``` CMake Error at lib/CMakeLists.txt:100 (target_include_directories): Cannot specify include directories for target "pulsarStatic" which is not built by this project. ``` ### Modifications - For MSVC compiler on Windows, use a different name for the static library to avoid overwriting the import library. - Fix the CMake failure when `-DBUILD_STATIC_LIB=OFF` is configured. - Add CI to build C++ client without static library on Windows. After this change, if C++ library is built on Windows using release mode, following files wil be generated under `<BUILD_DIR>\lib\Release`: - pulsar.dll: the dynamic library - pulsar.lib: the import library associated with pulsar.dll - pulsar-static.lib: the static library
- Loading branch information