You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by yo...@apache.org on 2021/12/23 14:41:10 UTC
[pulsar] 04/08: Fix Version.h not found when CMake binary directory is customized (#13324)
This is an automated email from the ASF dual-hosted git repository.
yong pushed a commit to branch branch-2.8
in repository https://gitbox.apache.org/repos/asf/pulsar.git
commit 05d88f198cedce17e19a08e7ca4905a027e5db76
Author: Yunze Xu <xy...@163.com>
AuthorDate: Wed Dec 15 17:08:09 2021 +0800
Fix Version.h not found when CMake binary directory is customized (#13324)
### Motivation
When I build C++ tests on my local env, the following error happened.
```
tests/VersionTest.cc:19:10: fatal error: 'pulsar/Version.h' file not found
#include <pulsar/Version.h>
```
It's because I specified another directory as CMake directory.
```bash
mkdir _builds && cd _builds && cmake ..
```
After https://github.com/apache/pulsar/pull/12769, the `Version.h` is generated under `${CMAKE_BINARY_DIR}/include/pulsar` directory but it's not included in `CMakeLists.txt`. CI works well because it's built in the default CMake directory so that `CMAKE_BINARY_DIR` is the same with `CMAKE_SOURCE_DIR`, which is included.
### Modifications
Add the `${CMAKE_BINARY_DIR}/include` to `included_directories`.
(cherry picked from commit ca37e67211feda4f7e0984e6414e707f1c1dfd07)
---
pulsar-client-cpp/CMakeLists.txt | 1 +
1 file changed, 1 insertion(+)
diff --git a/pulsar-client-cpp/CMakeLists.txt b/pulsar-client-cpp/CMakeLists.txt
index a8ca467..22d5605 100644
--- a/pulsar-client-cpp/CMakeLists.txt
+++ b/pulsar-client-cpp/CMakeLists.txt
@@ -332,6 +332,7 @@ file(MAKE_DIRECTORY ${AUTOGEN_DIR})
include_directories(
${CMAKE_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/include
+ ${CMAKE_BINARY_DIR}/include
${AUTOGEN_DIR}
${Boost_INCLUDE_DIR}
${OPENSSL_INCLUDE_DIR}