Update FBThriftCppLibrary.cmake to use PROJECT_SOURCE_DIR and PROJECT_BINARY_DIR#701
Closed
zhztheplayer wants to merge 1 commit into
Closed
Update FBThriftCppLibrary.cmake to use PROJECT_SOURCE_DIR and PROJECT_BINARY_DIR#701zhztheplayer wants to merge 1 commit into
zhztheplayer wants to merge 1 commit into
Conversation
Contributor
|
@createdbysk has imported this pull request. If you are a Meta employee, you can view this in D109468864. |
meta-codesync Bot
pushed a commit
to facebook/fboss
that referenced
this pull request
Jun 23, 2026
…_BINARY_DIR
Summary:
### The Bug
When the CMake project A, which is using `add_fbthrift_cpp_library`, is imported by another parent CMake project B by `FetchContent`, project B may not build because the generated CPP sources refer to header files that don't exist.
E.g.,
```
[488/1435] Building CXX object _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o
FAILED: [code=1] _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o
/usr/bin/ccache /usr/bin/c++ -DBOOST_ATOMIC_DYN_LINK -DBOOST_ATOMIC_NO_LIB -DBOOST_CONTEXT_DYN_LINK -DBOOST_CONTEXT_NO_LIB -DBOOST_FILESYSTEM_DYN_LINK -DBOOST_FILESYSTEM_NO_LIB -DBOOST_PROGRAM_OPTIONS_DYN_LINK -DBOOST_PROGRAM_OPTIONS_NO_LIB -DBOOST_REGEX_DYN_LINK -DBOOST_REGEX_NO_LIB -DBOOST_THREAD_DYN_LINK -DBOOST_THREAD_NO_LIB -DFOLLY_HAS_COROUTINES=1 -DGFLAGS_IS_A_DLL=0 -DVELOX_ENABLE_PARQUET -I/root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/. -I/root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/velox/external/xxhash -I/root/Public/code/velox4j/src/main/cpp/cmake-build-debug -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/velox -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/velox/external -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/folly-src -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/folly-build -isystem /usr/include/libdwarf -mavx2 -mfma -mavx -mf16c -mlzcnt -mbmi2 -DUSE_VELOX_COMMON_BASE -DHAS_UNCAUGHT_EXCEPTIONS -Wall -Wextra -Wno-unused -Wno-unused-parameter -Wno-sign-compare -Wno-ignored-qualifiers -Wno-implicit-fallthrough -Wno-class-memaccess -Wno-comment -Wno-int-in-bool-context -Wno-redundant-move -Wno-array-bounds -Wno-maybe-uninitialized -Wno-unused-result -Wno-format-overflow -Wno-strict-aliasing -g -std=gnu++20 -fPIC -fdiagnostics-color=always -fcoroutines -fsized-deallocation -MD -MT _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o -MF _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o.d -o _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o -c /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-build/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_serialization.cpp
/root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-build/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_serialization.cpp:7:10: fatal error: cmake-build-debug/_deps/velox-src/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_custom_protocol.h: No such file or directory
7 | #include "cmake-build-debug/_deps/velox-src/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_custom_protocol.h"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
While the generated header is under `cmake-build-debug/_deps/velox-build/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_custom_protocol.h`.
### The Fix
The PR is a general fix for the issue by turning `CMAKE_SOURCE_DIR` / `CMAKE_BINARY_DIR` to `PROJECT_SOURCE_DIR` / `PROJECT_BINARY_DIR`, to make the generated sources portable for any parent CMake projects' use.
This fixes Velox bug facebookincubator/velox#17853.
X-link: facebook/fbthrift#701
Reviewed By: hchokshi
Differential Revision: D109468864
Pulled By: createdbysk
fbshipit-source-id: c4b54a9e63cb7064748831be463fc1a5a2c8c918
meta-codesync Bot
pushed a commit
to facebookexperimental/rust-shed
that referenced
this pull request
Jun 23, 2026
…_BINARY_DIR
Summary:
### The Bug
When the CMake project A, which is using `add_fbthrift_cpp_library`, is imported by another parent CMake project B by `FetchContent`, project B may not build because the generated CPP sources refer to header files that don't exist.
E.g.,
```
[488/1435] Building CXX object _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o
FAILED: [code=1] _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o
/usr/bin/ccache /usr/bin/c++ -DBOOST_ATOMIC_DYN_LINK -DBOOST_ATOMIC_NO_LIB -DBOOST_CONTEXT_DYN_LINK -DBOOST_CONTEXT_NO_LIB -DBOOST_FILESYSTEM_DYN_LINK -DBOOST_FILESYSTEM_NO_LIB -DBOOST_PROGRAM_OPTIONS_DYN_LINK -DBOOST_PROGRAM_OPTIONS_NO_LIB -DBOOST_REGEX_DYN_LINK -DBOOST_REGEX_NO_LIB -DBOOST_THREAD_DYN_LINK -DBOOST_THREAD_NO_LIB -DFOLLY_HAS_COROUTINES=1 -DGFLAGS_IS_A_DLL=0 -DVELOX_ENABLE_PARQUET -I/root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/. -I/root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/velox/external/xxhash -I/root/Public/code/velox4j/src/main/cpp/cmake-build-debug -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/velox -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/velox/external -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/folly-src -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/folly-build -isystem /usr/include/libdwarf -mavx2 -mfma -mavx -mf16c -mlzcnt -mbmi2 -DUSE_VELOX_COMMON_BASE -DHAS_UNCAUGHT_EXCEPTIONS -Wall -Wextra -Wno-unused -Wno-unused-parameter -Wno-sign-compare -Wno-ignored-qualifiers -Wno-implicit-fallthrough -Wno-class-memaccess -Wno-comment -Wno-int-in-bool-context -Wno-redundant-move -Wno-array-bounds -Wno-maybe-uninitialized -Wno-unused-result -Wno-format-overflow -Wno-strict-aliasing -g -std=gnu++20 -fPIC -fdiagnostics-color=always -fcoroutines -fsized-deallocation -MD -MT _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o -MF _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o.d -o _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o -c /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-build/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_serialization.cpp
/root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-build/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_serialization.cpp:7:10: fatal error: cmake-build-debug/_deps/velox-src/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_custom_protocol.h: No such file or directory
7 | #include "cmake-build-debug/_deps/velox-src/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_custom_protocol.h"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
While the generated header is under `cmake-build-debug/_deps/velox-build/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_custom_protocol.h`.
### The Fix
The PR is a general fix for the issue by turning `CMAKE_SOURCE_DIR` / `CMAKE_BINARY_DIR` to `PROJECT_SOURCE_DIR` / `PROJECT_BINARY_DIR`, to make the generated sources portable for any parent CMake projects' use.
This fixes Velox bug facebookincubator/velox#17853.
X-link: facebook/fbthrift#701
Reviewed By: hchokshi
Differential Revision: D109468864
Pulled By: createdbysk
fbshipit-source-id: c4b54a9e63cb7064748831be463fc1a5a2c8c918
meta-codesync Bot
pushed a commit
to facebook/fb303
that referenced
this pull request
Jun 23, 2026
…_BINARY_DIR
Summary:
### The Bug
When the CMake project A, which is using `add_fbthrift_cpp_library`, is imported by another parent CMake project B by `FetchContent`, project B may not build because the generated CPP sources refer to header files that don't exist.
E.g.,
```
[488/1435] Building CXX object _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o
FAILED: [code=1] _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o
/usr/bin/ccache /usr/bin/c++ -DBOOST_ATOMIC_DYN_LINK -DBOOST_ATOMIC_NO_LIB -DBOOST_CONTEXT_DYN_LINK -DBOOST_CONTEXT_NO_LIB -DBOOST_FILESYSTEM_DYN_LINK -DBOOST_FILESYSTEM_NO_LIB -DBOOST_PROGRAM_OPTIONS_DYN_LINK -DBOOST_PROGRAM_OPTIONS_NO_LIB -DBOOST_REGEX_DYN_LINK -DBOOST_REGEX_NO_LIB -DBOOST_THREAD_DYN_LINK -DBOOST_THREAD_NO_LIB -DFOLLY_HAS_COROUTINES=1 -DGFLAGS_IS_A_DLL=0 -DVELOX_ENABLE_PARQUET -I/root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/. -I/root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/velox/external/xxhash -I/root/Public/code/velox4j/src/main/cpp/cmake-build-debug -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/velox -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/velox/external -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/folly-src -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/folly-build -isystem /usr/include/libdwarf -mavx2 -mfma -mavx -mf16c -mlzcnt -mbmi2 -DUSE_VELOX_COMMON_BASE -DHAS_UNCAUGHT_EXCEPTIONS -Wall -Wextra -Wno-unused -Wno-unused-parameter -Wno-sign-compare -Wno-ignored-qualifiers -Wno-implicit-fallthrough -Wno-class-memaccess -Wno-comment -Wno-int-in-bool-context -Wno-redundant-move -Wno-array-bounds -Wno-maybe-uninitialized -Wno-unused-result -Wno-format-overflow -Wno-strict-aliasing -g -std=gnu++20 -fPIC -fdiagnostics-color=always -fcoroutines -fsized-deallocation -MD -MT _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o -MF _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o.d -o _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o -c /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-build/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_serialization.cpp
/root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-build/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_serialization.cpp:7:10: fatal error: cmake-build-debug/_deps/velox-src/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_custom_protocol.h: No such file or directory
7 | #include "cmake-build-debug/_deps/velox-src/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_custom_protocol.h"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
While the generated header is under `cmake-build-debug/_deps/velox-build/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_custom_protocol.h`.
### The Fix
The PR is a general fix for the issue by turning `CMAKE_SOURCE_DIR` / `CMAKE_BINARY_DIR` to `PROJECT_SOURCE_DIR` / `PROJECT_BINARY_DIR`, to make the generated sources portable for any parent CMake projects' use.
This fixes Velox bug facebookincubator/velox#17853.
X-link: facebook/fbthrift#701
Reviewed By: hchokshi
Differential Revision: D109468864
Pulled By: createdbysk
fbshipit-source-id: c4b54a9e63cb7064748831be463fc1a5a2c8c918
Contributor
|
@createdbysk merged this pull request in 0f352e4. |
meta-codesync Bot
pushed a commit
to facebook/folly
that referenced
this pull request
Jun 23, 2026
…_BINARY_DIR
Summary:
### The Bug
When the CMake project A, which is using `add_fbthrift_cpp_library`, is imported by another parent CMake project B by `FetchContent`, project B may not build because the generated CPP sources refer to header files that don't exist.
E.g.,
```
[488/1435] Building CXX object _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o
FAILED: [code=1] _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o
/usr/bin/ccache /usr/bin/c++ -DBOOST_ATOMIC_DYN_LINK -DBOOST_ATOMIC_NO_LIB -DBOOST_CONTEXT_DYN_LINK -DBOOST_CONTEXT_NO_LIB -DBOOST_FILESYSTEM_DYN_LINK -DBOOST_FILESYSTEM_NO_LIB -DBOOST_PROGRAM_OPTIONS_DYN_LINK -DBOOST_PROGRAM_OPTIONS_NO_LIB -DBOOST_REGEX_DYN_LINK -DBOOST_REGEX_NO_LIB -DBOOST_THREAD_DYN_LINK -DBOOST_THREAD_NO_LIB -DFOLLY_HAS_COROUTINES=1 -DGFLAGS_IS_A_DLL=0 -DVELOX_ENABLE_PARQUET -I/root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/. -I/root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/velox/external/xxhash -I/root/Public/code/velox4j/src/main/cpp/cmake-build-debug -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/velox -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/velox/external -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/folly-src -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/folly-build -isystem /usr/include/libdwarf -mavx2 -mfma -mavx -mf16c -mlzcnt -mbmi2 -DUSE_VELOX_COMMON_BASE -DHAS_UNCAUGHT_EXCEPTIONS -Wall -Wextra -Wno-unused -Wno-unused-parameter -Wno-sign-compare -Wno-ignored-qualifiers -Wno-implicit-fallthrough -Wno-class-memaccess -Wno-comment -Wno-int-in-bool-context -Wno-redundant-move -Wno-array-bounds -Wno-maybe-uninitialized -Wno-unused-result -Wno-format-overflow -Wno-strict-aliasing -g -std=gnu++20 -fPIC -fdiagnostics-color=always -fcoroutines -fsized-deallocation -MD -MT _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o -MF _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o.d -o _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o -c /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-build/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_serialization.cpp
/root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-build/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_serialization.cpp:7:10: fatal error: cmake-build-debug/_deps/velox-src/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_custom_protocol.h: No such file or directory
7 | #include "cmake-build-debug/_deps/velox-src/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_custom_protocol.h"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
While the generated header is under `cmake-build-debug/_deps/velox-build/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_custom_protocol.h`.
### The Fix
The PR is a general fix for the issue by turning `CMAKE_SOURCE_DIR` / `CMAKE_BINARY_DIR` to `PROJECT_SOURCE_DIR` / `PROJECT_BINARY_DIR`, to make the generated sources portable for any parent CMake projects' use.
This fixes Velox bug facebookincubator/velox#17853.
X-link: facebook/fbthrift#701
Reviewed By: hchokshi
Differential Revision: D109468864
Pulled By: createdbysk
fbshipit-source-id: c4b54a9e63cb7064748831be463fc1a5a2c8c918
meta-codesync Bot
pushed a commit
to facebookincubator/hsthrift
that referenced
this pull request
Jun 23, 2026
…_BINARY_DIR
Summary:
### The Bug
When the CMake project A, which is using `add_fbthrift_cpp_library`, is imported by another parent CMake project B by `FetchContent`, project B may not build because the generated CPP sources refer to header files that don't exist.
E.g.,
```
[488/1435] Building CXX object _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o
FAILED: [code=1] _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o
/usr/bin/ccache /usr/bin/c++ -DBOOST_ATOMIC_DYN_LINK -DBOOST_ATOMIC_NO_LIB -DBOOST_CONTEXT_DYN_LINK -DBOOST_CONTEXT_NO_LIB -DBOOST_FILESYSTEM_DYN_LINK -DBOOST_FILESYSTEM_NO_LIB -DBOOST_PROGRAM_OPTIONS_DYN_LINK -DBOOST_PROGRAM_OPTIONS_NO_LIB -DBOOST_REGEX_DYN_LINK -DBOOST_REGEX_NO_LIB -DBOOST_THREAD_DYN_LINK -DBOOST_THREAD_NO_LIB -DFOLLY_HAS_COROUTINES=1 -DGFLAGS_IS_A_DLL=0 -DVELOX_ENABLE_PARQUET -I/root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/. -I/root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/velox/external/xxhash -I/root/Public/code/velox4j/src/main/cpp/cmake-build-debug -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/velox -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/velox/external -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/folly-src -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/folly-build -isystem /usr/include/libdwarf -mavx2 -mfma -mavx -mf16c -mlzcnt -mbmi2 -DUSE_VELOX_COMMON_BASE -DHAS_UNCAUGHT_EXCEPTIONS -Wall -Wextra -Wno-unused -Wno-unused-parameter -Wno-sign-compare -Wno-ignored-qualifiers -Wno-implicit-fallthrough -Wno-class-memaccess -Wno-comment -Wno-int-in-bool-context -Wno-redundant-move -Wno-array-bounds -Wno-maybe-uninitialized -Wno-unused-result -Wno-format-overflow -Wno-strict-aliasing -g -std=gnu++20 -fPIC -fdiagnostics-color=always -fcoroutines -fsized-deallocation -MD -MT _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o -MF _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o.d -o _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o -c /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-build/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_serialization.cpp
/root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-build/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_serialization.cpp:7:10: fatal error: cmake-build-debug/_deps/velox-src/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_custom_protocol.h: No such file or directory
7 | #include "cmake-build-debug/_deps/velox-src/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_custom_protocol.h"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
While the generated header is under `cmake-build-debug/_deps/velox-build/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_custom_protocol.h`.
### The Fix
The PR is a general fix for the issue by turning `CMAKE_SOURCE_DIR` / `CMAKE_BINARY_DIR` to `PROJECT_SOURCE_DIR` / `PROJECT_BINARY_DIR`, to make the generated sources portable for any parent CMake projects' use.
This fixes Velox bug facebookincubator/velox#17853.
X-link: facebook/fbthrift#701
Reviewed By: hchokshi
Differential Revision: D109468864
Pulled By: createdbysk
fbshipit-source-id: c4b54a9e63cb7064748831be463fc1a5a2c8c918
meta-codesync Bot
pushed a commit
to facebook/CacheLib
that referenced
this pull request
Jun 23, 2026
…_BINARY_DIR
Summary:
### The Bug
When the CMake project A, which is using `add_fbthrift_cpp_library`, is imported by another parent CMake project B by `FetchContent`, project B may not build because the generated CPP sources refer to header files that don't exist.
E.g.,
```
[488/1435] Building CXX object _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o
FAILED: [code=1] _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o
/usr/bin/ccache /usr/bin/c++ -DBOOST_ATOMIC_DYN_LINK -DBOOST_ATOMIC_NO_LIB -DBOOST_CONTEXT_DYN_LINK -DBOOST_CONTEXT_NO_LIB -DBOOST_FILESYSTEM_DYN_LINK -DBOOST_FILESYSTEM_NO_LIB -DBOOST_PROGRAM_OPTIONS_DYN_LINK -DBOOST_PROGRAM_OPTIONS_NO_LIB -DBOOST_REGEX_DYN_LINK -DBOOST_REGEX_NO_LIB -DBOOST_THREAD_DYN_LINK -DBOOST_THREAD_NO_LIB -DFOLLY_HAS_COROUTINES=1 -DGFLAGS_IS_A_DLL=0 -DVELOX_ENABLE_PARQUET -I/root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/. -I/root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/velox/external/xxhash -I/root/Public/code/velox4j/src/main/cpp/cmake-build-debug -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/velox -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/velox/external -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/folly-src -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/folly-build -isystem /usr/include/libdwarf -mavx2 -mfma -mavx -mf16c -mlzcnt -mbmi2 -DUSE_VELOX_COMMON_BASE -DHAS_UNCAUGHT_EXCEPTIONS -Wall -Wextra -Wno-unused -Wno-unused-parameter -Wno-sign-compare -Wno-ignored-qualifiers -Wno-implicit-fallthrough -Wno-class-memaccess -Wno-comment -Wno-int-in-bool-context -Wno-redundant-move -Wno-array-bounds -Wno-maybe-uninitialized -Wno-unused-result -Wno-format-overflow -Wno-strict-aliasing -g -std=gnu++20 -fPIC -fdiagnostics-color=always -fcoroutines -fsized-deallocation -MD -MT _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o -MF _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o.d -o _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o -c /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-build/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_serialization.cpp
/root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-build/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_serialization.cpp:7:10: fatal error: cmake-build-debug/_deps/velox-src/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_custom_protocol.h: No such file or directory
7 | #include "cmake-build-debug/_deps/velox-src/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_custom_protocol.h"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
While the generated header is under `cmake-build-debug/_deps/velox-build/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_custom_protocol.h`.
### The Fix
The PR is a general fix for the issue by turning `CMAKE_SOURCE_DIR` / `CMAKE_BINARY_DIR` to `PROJECT_SOURCE_DIR` / `PROJECT_BINARY_DIR`, to make the generated sources portable for any parent CMake projects' use.
This fixes Velox bug facebookincubator/velox#17853.
X-link: facebook/fbthrift#701
Reviewed By: hchokshi
Differential Revision: D109468864
Pulled By: createdbysk
fbshipit-source-id: c4b54a9e63cb7064748831be463fc1a5a2c8c918
meta-codesync Bot
pushed a commit
to facebook/hhvm
that referenced
this pull request
Jun 23, 2026
…_BINARY_DIR
Summary:
### The Bug
When the CMake project A, which is using `add_fbthrift_cpp_library`, is imported by another parent CMake project B by `FetchContent`, project B may not build because the generated CPP sources refer to header files that don't exist.
E.g.,
```
[488/1435] Building CXX object _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o
FAILED: [code=1] _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o
/usr/bin/ccache /usr/bin/c++ -DBOOST_ATOMIC_DYN_LINK -DBOOST_ATOMIC_NO_LIB -DBOOST_CONTEXT_DYN_LINK -DBOOST_CONTEXT_NO_LIB -DBOOST_FILESYSTEM_DYN_LINK -DBOOST_FILESYSTEM_NO_LIB -DBOOST_PROGRAM_OPTIONS_DYN_LINK -DBOOST_PROGRAM_OPTIONS_NO_LIB -DBOOST_REGEX_DYN_LINK -DBOOST_REGEX_NO_LIB -DBOOST_THREAD_DYN_LINK -DBOOST_THREAD_NO_LIB -DFOLLY_HAS_COROUTINES=1 -DGFLAGS_IS_A_DLL=0 -DVELOX_ENABLE_PARQUET -I/root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/. -I/root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/velox/external/xxhash -I/root/Public/code/velox4j/src/main/cpp/cmake-build-debug -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/velox -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/velox/external -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/folly-src -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/folly-build -isystem /usr/include/libdwarf -mavx2 -mfma -mavx -mf16c -mlzcnt -mbmi2 -DUSE_VELOX_COMMON_BASE -DHAS_UNCAUGHT_EXCEPTIONS -Wall -Wextra -Wno-unused -Wno-unused-parameter -Wno-sign-compare -Wno-ignored-qualifiers -Wno-implicit-fallthrough -Wno-class-memaccess -Wno-comment -Wno-int-in-bool-context -Wno-redundant-move -Wno-array-bounds -Wno-maybe-uninitialized -Wno-unused-result -Wno-format-overflow -Wno-strict-aliasing -g -std=gnu++20 -fPIC -fdiagnostics-color=always -fcoroutines -fsized-deallocation -MD -MT _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o -MF _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o.d -o _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o -c /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-build/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_serialization.cpp
/root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-build/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_serialization.cpp:7:10: fatal error: cmake-build-debug/_deps/velox-src/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_custom_protocol.h: No such file or directory
7 | #include "cmake-build-debug/_deps/velox-src/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_custom_protocol.h"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
While the generated header is under `cmake-build-debug/_deps/velox-build/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_custom_protocol.h`.
### The Fix
The PR is a general fix for the issue by turning `CMAKE_SOURCE_DIR` / `CMAKE_BINARY_DIR` to `PROJECT_SOURCE_DIR` / `PROJECT_BINARY_DIR`, to make the generated sources portable for any parent CMake projects' use.
This fixes Velox bug facebookincubator/velox#17853.
X-link: facebook/fbthrift#701
Reviewed By: hchokshi
Differential Revision: D109468864
Pulled By: createdbysk
fbshipit-source-id: c4b54a9e63cb7064748831be463fc1a5a2c8c918
meta-codesync Bot
pushed a commit
to facebook/mvfst
that referenced
this pull request
Jun 23, 2026
…_BINARY_DIR
Summary:
### The Bug
When the CMake project A, which is using `add_fbthrift_cpp_library`, is imported by another parent CMake project B by `FetchContent`, project B may not build because the generated CPP sources refer to header files that don't exist.
E.g.,
```
[488/1435] Building CXX object _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o
FAILED: [code=1] _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o
/usr/bin/ccache /usr/bin/c++ -DBOOST_ATOMIC_DYN_LINK -DBOOST_ATOMIC_NO_LIB -DBOOST_CONTEXT_DYN_LINK -DBOOST_CONTEXT_NO_LIB -DBOOST_FILESYSTEM_DYN_LINK -DBOOST_FILESYSTEM_NO_LIB -DBOOST_PROGRAM_OPTIONS_DYN_LINK -DBOOST_PROGRAM_OPTIONS_NO_LIB -DBOOST_REGEX_DYN_LINK -DBOOST_REGEX_NO_LIB -DBOOST_THREAD_DYN_LINK -DBOOST_THREAD_NO_LIB -DFOLLY_HAS_COROUTINES=1 -DGFLAGS_IS_A_DLL=0 -DVELOX_ENABLE_PARQUET -I/root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/. -I/root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/velox/external/xxhash -I/root/Public/code/velox4j/src/main/cpp/cmake-build-debug -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/velox -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/velox/external -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/folly-src -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/folly-build -isystem /usr/include/libdwarf -mavx2 -mfma -mavx -mf16c -mlzcnt -mbmi2 -DUSE_VELOX_COMMON_BASE -DHAS_UNCAUGHT_EXCEPTIONS -Wall -Wextra -Wno-unused -Wno-unused-parameter -Wno-sign-compare -Wno-ignored-qualifiers -Wno-implicit-fallthrough -Wno-class-memaccess -Wno-comment -Wno-int-in-bool-context -Wno-redundant-move -Wno-array-bounds -Wno-maybe-uninitialized -Wno-unused-result -Wno-format-overflow -Wno-strict-aliasing -g -std=gnu++20 -fPIC -fdiagnostics-color=always -fcoroutines -fsized-deallocation -MD -MT _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o -MF _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o.d -o _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o -c /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-build/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_serialization.cpp
/root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-build/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_serialization.cpp:7:10: fatal error: cmake-build-debug/_deps/velox-src/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_custom_protocol.h: No such file or directory
7 | #include "cmake-build-debug/_deps/velox-src/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_custom_protocol.h"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
While the generated header is under `cmake-build-debug/_deps/velox-build/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_custom_protocol.h`.
### The Fix
The PR is a general fix for the issue by turning `CMAKE_SOURCE_DIR` / `CMAKE_BINARY_DIR` to `PROJECT_SOURCE_DIR` / `PROJECT_BINARY_DIR`, to make the generated sources portable for any parent CMake projects' use.
This fixes Velox bug facebookincubator/velox#17853.
X-link: facebook/fbthrift#701
Reviewed By: hchokshi
Differential Revision: D109468864
Pulled By: createdbysk
fbshipit-source-id: c4b54a9e63cb7064748831be463fc1a5a2c8c918
meta-codesync Bot
pushed a commit
to facebookexperimental/moxygen
that referenced
this pull request
Jun 23, 2026
…_BINARY_DIR
Summary:
### The Bug
When the CMake project A, which is using `add_fbthrift_cpp_library`, is imported by another parent CMake project B by `FetchContent`, project B may not build because the generated CPP sources refer to header files that don't exist.
E.g.,
```
[488/1435] Building CXX object _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o
FAILED: [code=1] _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o
/usr/bin/ccache /usr/bin/c++ -DBOOST_ATOMIC_DYN_LINK -DBOOST_ATOMIC_NO_LIB -DBOOST_CONTEXT_DYN_LINK -DBOOST_CONTEXT_NO_LIB -DBOOST_FILESYSTEM_DYN_LINK -DBOOST_FILESYSTEM_NO_LIB -DBOOST_PROGRAM_OPTIONS_DYN_LINK -DBOOST_PROGRAM_OPTIONS_NO_LIB -DBOOST_REGEX_DYN_LINK -DBOOST_REGEX_NO_LIB -DBOOST_THREAD_DYN_LINK -DBOOST_THREAD_NO_LIB -DFOLLY_HAS_COROUTINES=1 -DGFLAGS_IS_A_DLL=0 -DVELOX_ENABLE_PARQUET -I/root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/. -I/root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/velox/external/xxhash -I/root/Public/code/velox4j/src/main/cpp/cmake-build-debug -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/velox -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/velox/external -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/folly-src -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/folly-build -isystem /usr/include/libdwarf -mavx2 -mfma -mavx -mf16c -mlzcnt -mbmi2 -DUSE_VELOX_COMMON_BASE -DHAS_UNCAUGHT_EXCEPTIONS -Wall -Wextra -Wno-unused -Wno-unused-parameter -Wno-sign-compare -Wno-ignored-qualifiers -Wno-implicit-fallthrough -Wno-class-memaccess -Wno-comment -Wno-int-in-bool-context -Wno-redundant-move -Wno-array-bounds -Wno-maybe-uninitialized -Wno-unused-result -Wno-format-overflow -Wno-strict-aliasing -g -std=gnu++20 -fPIC -fdiagnostics-color=always -fcoroutines -fsized-deallocation -MD -MT _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o -MF _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o.d -o _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o -c /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-build/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_serialization.cpp
/root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-build/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_serialization.cpp:7:10: fatal error: cmake-build-debug/_deps/velox-src/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_custom_protocol.h: No such file or directory
7 | #include "cmake-build-debug/_deps/velox-src/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_custom_protocol.h"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
While the generated header is under `cmake-build-debug/_deps/velox-build/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_custom_protocol.h`.
### The Fix
The PR is a general fix for the issue by turning `CMAKE_SOURCE_DIR` / `CMAKE_BINARY_DIR` to `PROJECT_SOURCE_DIR` / `PROJECT_BINARY_DIR`, to make the generated sources portable for any parent CMake projects' use.
This fixes Velox bug facebookincubator/velox#17853.
X-link: facebook/fbthrift#701
Reviewed By: hchokshi
Differential Revision: D109468864
Pulled By: createdbysk
fbshipit-source-id: c4b54a9e63cb7064748831be463fc1a5a2c8c918
meta-codesync Bot
pushed a commit
to facebook/openr
that referenced
this pull request
Jun 23, 2026
…_BINARY_DIR
Summary:
### The Bug
When the CMake project A, which is using `add_fbthrift_cpp_library`, is imported by another parent CMake project B by `FetchContent`, project B may not build because the generated CPP sources refer to header files that don't exist.
E.g.,
```
[488/1435] Building CXX object _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o
FAILED: [code=1] _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o
/usr/bin/ccache /usr/bin/c++ -DBOOST_ATOMIC_DYN_LINK -DBOOST_ATOMIC_NO_LIB -DBOOST_CONTEXT_DYN_LINK -DBOOST_CONTEXT_NO_LIB -DBOOST_FILESYSTEM_DYN_LINK -DBOOST_FILESYSTEM_NO_LIB -DBOOST_PROGRAM_OPTIONS_DYN_LINK -DBOOST_PROGRAM_OPTIONS_NO_LIB -DBOOST_REGEX_DYN_LINK -DBOOST_REGEX_NO_LIB -DBOOST_THREAD_DYN_LINK -DBOOST_THREAD_NO_LIB -DFOLLY_HAS_COROUTINES=1 -DGFLAGS_IS_A_DLL=0 -DVELOX_ENABLE_PARQUET -I/root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/. -I/root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/velox/external/xxhash -I/root/Public/code/velox4j/src/main/cpp/cmake-build-debug -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/velox -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/velox/external -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/folly-src -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/folly-build -isystem /usr/include/libdwarf -mavx2 -mfma -mavx -mf16c -mlzcnt -mbmi2 -DUSE_VELOX_COMMON_BASE -DHAS_UNCAUGHT_EXCEPTIONS -Wall -Wextra -Wno-unused -Wno-unused-parameter -Wno-sign-compare -Wno-ignored-qualifiers -Wno-implicit-fallthrough -Wno-class-memaccess -Wno-comment -Wno-int-in-bool-context -Wno-redundant-move -Wno-array-bounds -Wno-maybe-uninitialized -Wno-unused-result -Wno-format-overflow -Wno-strict-aliasing -g -std=gnu++20 -fPIC -fdiagnostics-color=always -fcoroutines -fsized-deallocation -MD -MT _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o -MF _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o.d -o _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o -c /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-build/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_serialization.cpp
/root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-build/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_serialization.cpp:7:10: fatal error: cmake-build-debug/_deps/velox-src/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_custom_protocol.h: No such file or directory
7 | #include "cmake-build-debug/_deps/velox-src/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_custom_protocol.h"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
While the generated header is under `cmake-build-debug/_deps/velox-build/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_custom_protocol.h`.
### The Fix
The PR is a general fix for the issue by turning `CMAKE_SOURCE_DIR` / `CMAKE_BINARY_DIR` to `PROJECT_SOURCE_DIR` / `PROJECT_BINARY_DIR`, to make the generated sources portable for any parent CMake projects' use.
This fixes Velox bug facebookincubator/velox#17853.
X-link: facebook/fbthrift#701
Reviewed By: hchokshi
Differential Revision: D109468864
Pulled By: createdbysk
fbshipit-source-id: c4b54a9e63cb7064748831be463fc1a5a2c8c918
meta-codesync Bot
pushed a commit
to facebookincubator/fizz
that referenced
this pull request
Jun 23, 2026
…_BINARY_DIR
Summary:
### The Bug
When the CMake project A, which is using `add_fbthrift_cpp_library`, is imported by another parent CMake project B by `FetchContent`, project B may not build because the generated CPP sources refer to header files that don't exist.
E.g.,
```
[488/1435] Building CXX object _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o
FAILED: [code=1] _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o
/usr/bin/ccache /usr/bin/c++ -DBOOST_ATOMIC_DYN_LINK -DBOOST_ATOMIC_NO_LIB -DBOOST_CONTEXT_DYN_LINK -DBOOST_CONTEXT_NO_LIB -DBOOST_FILESYSTEM_DYN_LINK -DBOOST_FILESYSTEM_NO_LIB -DBOOST_PROGRAM_OPTIONS_DYN_LINK -DBOOST_PROGRAM_OPTIONS_NO_LIB -DBOOST_REGEX_DYN_LINK -DBOOST_REGEX_NO_LIB -DBOOST_THREAD_DYN_LINK -DBOOST_THREAD_NO_LIB -DFOLLY_HAS_COROUTINES=1 -DGFLAGS_IS_A_DLL=0 -DVELOX_ENABLE_PARQUET -I/root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/. -I/root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/velox/external/xxhash -I/root/Public/code/velox4j/src/main/cpp/cmake-build-debug -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/velox -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/velox/external -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/folly-src -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/folly-build -isystem /usr/include/libdwarf -mavx2 -mfma -mavx -mf16c -mlzcnt -mbmi2 -DUSE_VELOX_COMMON_BASE -DHAS_UNCAUGHT_EXCEPTIONS -Wall -Wextra -Wno-unused -Wno-unused-parameter -Wno-sign-compare -Wno-ignored-qualifiers -Wno-implicit-fallthrough -Wno-class-memaccess -Wno-comment -Wno-int-in-bool-context -Wno-redundant-move -Wno-array-bounds -Wno-maybe-uninitialized -Wno-unused-result -Wno-format-overflow -Wno-strict-aliasing -g -std=gnu++20 -fPIC -fdiagnostics-color=always -fcoroutines -fsized-deallocation -MD -MT _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o -MF _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o.d -o _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o -c /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-build/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_serialization.cpp
/root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-build/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_serialization.cpp:7:10: fatal error: cmake-build-debug/_deps/velox-src/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_custom_protocol.h: No such file or directory
7 | #include "cmake-build-debug/_deps/velox-src/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_custom_protocol.h"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
While the generated header is under `cmake-build-debug/_deps/velox-build/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_custom_protocol.h`.
### The Fix
The PR is a general fix for the issue by turning `CMAKE_SOURCE_DIR` / `CMAKE_BINARY_DIR` to `PROJECT_SOURCE_DIR` / `PROJECT_BINARY_DIR`, to make the generated sources portable for any parent CMake projects' use.
This fixes Velox bug facebookincubator/velox#17853.
X-link: facebook/fbthrift#701
Reviewed By: hchokshi
Differential Revision: D109468864
Pulled By: createdbysk
fbshipit-source-id: c4b54a9e63cb7064748831be463fc1a5a2c8c918
meta-codesync Bot
pushed a commit
to facebook/proxygen
that referenced
this pull request
Jun 23, 2026
…_BINARY_DIR
Summary:
### The Bug
When the CMake project A, which is using `add_fbthrift_cpp_library`, is imported by another parent CMake project B by `FetchContent`, project B may not build because the generated CPP sources refer to header files that don't exist.
E.g.,
```
[488/1435] Building CXX object _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o
FAILED: [code=1] _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o
/usr/bin/ccache /usr/bin/c++ -DBOOST_ATOMIC_DYN_LINK -DBOOST_ATOMIC_NO_LIB -DBOOST_CONTEXT_DYN_LINK -DBOOST_CONTEXT_NO_LIB -DBOOST_FILESYSTEM_DYN_LINK -DBOOST_FILESYSTEM_NO_LIB -DBOOST_PROGRAM_OPTIONS_DYN_LINK -DBOOST_PROGRAM_OPTIONS_NO_LIB -DBOOST_REGEX_DYN_LINK -DBOOST_REGEX_NO_LIB -DBOOST_THREAD_DYN_LINK -DBOOST_THREAD_NO_LIB -DFOLLY_HAS_COROUTINES=1 -DGFLAGS_IS_A_DLL=0 -DVELOX_ENABLE_PARQUET -I/root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/. -I/root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/velox/external/xxhash -I/root/Public/code/velox4j/src/main/cpp/cmake-build-debug -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/velox -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/velox/external -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/folly-src -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/folly-build -isystem /usr/include/libdwarf -mavx2 -mfma -mavx -mf16c -mlzcnt -mbmi2 -DUSE_VELOX_COMMON_BASE -DHAS_UNCAUGHT_EXCEPTIONS -Wall -Wextra -Wno-unused -Wno-unused-parameter -Wno-sign-compare -Wno-ignored-qualifiers -Wno-implicit-fallthrough -Wno-class-memaccess -Wno-comment -Wno-int-in-bool-context -Wno-redundant-move -Wno-array-bounds -Wno-maybe-uninitialized -Wno-unused-result -Wno-format-overflow -Wno-strict-aliasing -g -std=gnu++20 -fPIC -fdiagnostics-color=always -fcoroutines -fsized-deallocation -MD -MT _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o -MF _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o.d -o _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o -c /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-build/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_serialization.cpp
/root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-build/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_serialization.cpp:7:10: fatal error: cmake-build-debug/_deps/velox-src/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_custom_protocol.h: No such file or directory
7 | #include "cmake-build-debug/_deps/velox-src/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_custom_protocol.h"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
While the generated header is under `cmake-build-debug/_deps/velox-build/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_custom_protocol.h`.
### The Fix
The PR is a general fix for the issue by turning `CMAKE_SOURCE_DIR` / `CMAKE_BINARY_DIR` to `PROJECT_SOURCE_DIR` / `PROJECT_BINARY_DIR`, to make the generated sources portable for any parent CMake projects' use.
This fixes Velox bug facebookincubator/velox#17853.
X-link: facebook/fbthrift#701
Reviewed By: hchokshi
Differential Revision: D109468864
Pulled By: createdbysk
fbshipit-source-id: c4b54a9e63cb7064748831be463fc1a5a2c8c918
meta-codesync Bot
pushed a commit
to facebook/sapling
that referenced
this pull request
Jun 23, 2026
…_BINARY_DIR
Summary:
### The Bug
When the CMake project A, which is using `add_fbthrift_cpp_library`, is imported by another parent CMake project B by `FetchContent`, project B may not build because the generated CPP sources refer to header files that don't exist.
E.g.,
```
[488/1435] Building CXX object _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o
FAILED: [code=1] _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o
/usr/bin/ccache /usr/bin/c++ -DBOOST_ATOMIC_DYN_LINK -DBOOST_ATOMIC_NO_LIB -DBOOST_CONTEXT_DYN_LINK -DBOOST_CONTEXT_NO_LIB -DBOOST_FILESYSTEM_DYN_LINK -DBOOST_FILESYSTEM_NO_LIB -DBOOST_PROGRAM_OPTIONS_DYN_LINK -DBOOST_PROGRAM_OPTIONS_NO_LIB -DBOOST_REGEX_DYN_LINK -DBOOST_REGEX_NO_LIB -DBOOST_THREAD_DYN_LINK -DBOOST_THREAD_NO_LIB -DFOLLY_HAS_COROUTINES=1 -DGFLAGS_IS_A_DLL=0 -DVELOX_ENABLE_PARQUET -I/root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/. -I/root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/velox/external/xxhash -I/root/Public/code/velox4j/src/main/cpp/cmake-build-debug -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/velox -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/velox/external -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/folly-src -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/folly-build -isystem /usr/include/libdwarf -mavx2 -mfma -mavx -mf16c -mlzcnt -mbmi2 -DUSE_VELOX_COMMON_BASE -DHAS_UNCAUGHT_EXCEPTIONS -Wall -Wextra -Wno-unused -Wno-unused-parameter -Wno-sign-compare -Wno-ignored-qualifiers -Wno-implicit-fallthrough -Wno-class-memaccess -Wno-comment -Wno-int-in-bool-context -Wno-redundant-move -Wno-array-bounds -Wno-maybe-uninitialized -Wno-unused-result -Wno-format-overflow -Wno-strict-aliasing -g -std=gnu++20 -fPIC -fdiagnostics-color=always -fcoroutines -fsized-deallocation -MD -MT _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o -MF _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o.d -o _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o -c /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-build/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_serialization.cpp
/root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-build/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_serialization.cpp:7:10: fatal error: cmake-build-debug/_deps/velox-src/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_custom_protocol.h: No such file or directory
7 | #include "cmake-build-debug/_deps/velox-src/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_custom_protocol.h"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
While the generated header is under `cmake-build-debug/_deps/velox-build/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_custom_protocol.h`.
### The Fix
The PR is a general fix for the issue by turning `CMAKE_SOURCE_DIR` / `CMAKE_BINARY_DIR` to `PROJECT_SOURCE_DIR` / `PROJECT_BINARY_DIR`, to make the generated sources portable for any parent CMake projects' use.
This fixes Velox bug facebookincubator/velox#17853.
X-link: facebook/fbthrift#701
Reviewed By: hchokshi
Differential Revision: D109468864
Pulled By: createdbysk
fbshipit-source-id: c4b54a9e63cb7064748831be463fc1a5a2c8c918
meta-codesync Bot
pushed a commit
to facebookexperimental/edencommon
that referenced
this pull request
Jun 23, 2026
…_BINARY_DIR
Summary:
### The Bug
When the CMake project A, which is using `add_fbthrift_cpp_library`, is imported by another parent CMake project B by `FetchContent`, project B may not build because the generated CPP sources refer to header files that don't exist.
E.g.,
```
[488/1435] Building CXX object _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o
FAILED: [code=1] _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o
/usr/bin/ccache /usr/bin/c++ -DBOOST_ATOMIC_DYN_LINK -DBOOST_ATOMIC_NO_LIB -DBOOST_CONTEXT_DYN_LINK -DBOOST_CONTEXT_NO_LIB -DBOOST_FILESYSTEM_DYN_LINK -DBOOST_FILESYSTEM_NO_LIB -DBOOST_PROGRAM_OPTIONS_DYN_LINK -DBOOST_PROGRAM_OPTIONS_NO_LIB -DBOOST_REGEX_DYN_LINK -DBOOST_REGEX_NO_LIB -DBOOST_THREAD_DYN_LINK -DBOOST_THREAD_NO_LIB -DFOLLY_HAS_COROUTINES=1 -DGFLAGS_IS_A_DLL=0 -DVELOX_ENABLE_PARQUET -I/root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/. -I/root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/velox/external/xxhash -I/root/Public/code/velox4j/src/main/cpp/cmake-build-debug -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/velox -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/velox/external -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/folly-src -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/folly-build -isystem /usr/include/libdwarf -mavx2 -mfma -mavx -mf16c -mlzcnt -mbmi2 -DUSE_VELOX_COMMON_BASE -DHAS_UNCAUGHT_EXCEPTIONS -Wall -Wextra -Wno-unused -Wno-unused-parameter -Wno-sign-compare -Wno-ignored-qualifiers -Wno-implicit-fallthrough -Wno-class-memaccess -Wno-comment -Wno-int-in-bool-context -Wno-redundant-move -Wno-array-bounds -Wno-maybe-uninitialized -Wno-unused-result -Wno-format-overflow -Wno-strict-aliasing -g -std=gnu++20 -fPIC -fdiagnostics-color=always -fcoroutines -fsized-deallocation -MD -MT _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o -MF _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o.d -o _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o -c /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-build/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_serialization.cpp
/root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-build/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_serialization.cpp:7:10: fatal error: cmake-build-debug/_deps/velox-src/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_custom_protocol.h: No such file or directory
7 | #include "cmake-build-debug/_deps/velox-src/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_custom_protocol.h"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
While the generated header is under `cmake-build-debug/_deps/velox-build/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_custom_protocol.h`.
### The Fix
The PR is a general fix for the issue by turning `CMAKE_SOURCE_DIR` / `CMAKE_BINARY_DIR` to `PROJECT_SOURCE_DIR` / `PROJECT_BINARY_DIR`, to make the generated sources portable for any parent CMake projects' use.
This fixes Velox bug facebookincubator/velox#17853.
X-link: facebook/fbthrift#701
Reviewed By: hchokshi
Differential Revision: D109468864
Pulled By: createdbysk
fbshipit-source-id: c4b54a9e63cb7064748831be463fc1a5a2c8c918
meta-codesync Bot
pushed a commit
to facebookincubator/katran
that referenced
this pull request
Jun 23, 2026
…_BINARY_DIR
Summary:
### The Bug
When the CMake project A, which is using `add_fbthrift_cpp_library`, is imported by another parent CMake project B by `FetchContent`, project B may not build because the generated CPP sources refer to header files that don't exist.
E.g.,
```
[488/1435] Building CXX object _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o
FAILED: [code=1] _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o
/usr/bin/ccache /usr/bin/c++ -DBOOST_ATOMIC_DYN_LINK -DBOOST_ATOMIC_NO_LIB -DBOOST_CONTEXT_DYN_LINK -DBOOST_CONTEXT_NO_LIB -DBOOST_FILESYSTEM_DYN_LINK -DBOOST_FILESYSTEM_NO_LIB -DBOOST_PROGRAM_OPTIONS_DYN_LINK -DBOOST_PROGRAM_OPTIONS_NO_LIB -DBOOST_REGEX_DYN_LINK -DBOOST_REGEX_NO_LIB -DBOOST_THREAD_DYN_LINK -DBOOST_THREAD_NO_LIB -DFOLLY_HAS_COROUTINES=1 -DGFLAGS_IS_A_DLL=0 -DVELOX_ENABLE_PARQUET -I/root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/. -I/root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/velox/external/xxhash -I/root/Public/code/velox4j/src/main/cpp/cmake-build-debug -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/velox -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/velox/external -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/folly-src -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/folly-build -isystem /usr/include/libdwarf -mavx2 -mfma -mavx -mf16c -mlzcnt -mbmi2 -DUSE_VELOX_COMMON_BASE -DHAS_UNCAUGHT_EXCEPTIONS -Wall -Wextra -Wno-unused -Wno-unused-parameter -Wno-sign-compare -Wno-ignored-qualifiers -Wno-implicit-fallthrough -Wno-class-memaccess -Wno-comment -Wno-int-in-bool-context -Wno-redundant-move -Wno-array-bounds -Wno-maybe-uninitialized -Wno-unused-result -Wno-format-overflow -Wno-strict-aliasing -g -std=gnu++20 -fPIC -fdiagnostics-color=always -fcoroutines -fsized-deallocation -MD -MT _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o -MF _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o.d -o _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o -c /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-build/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_serialization.cpp
/root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-build/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_serialization.cpp:7:10: fatal error: cmake-build-debug/_deps/velox-src/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_custom_protocol.h: No such file or directory
7 | #include "cmake-build-debug/_deps/velox-src/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_custom_protocol.h"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
While the generated header is under `cmake-build-debug/_deps/velox-build/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_custom_protocol.h`.
### The Fix
The PR is a general fix for the issue by turning `CMAKE_SOURCE_DIR` / `CMAKE_BINARY_DIR` to `PROJECT_SOURCE_DIR` / `PROJECT_BINARY_DIR`, to make the generated sources portable for any parent CMake projects' use.
This fixes Velox bug facebookincubator/velox#17853.
X-link: facebook/fbthrift#701
Reviewed By: hchokshi
Differential Revision: D109468864
Pulled By: createdbysk
fbshipit-source-id: c4b54a9e63cb7064748831be463fc1a5a2c8c918
meta-codesync Bot
pushed a commit
to facebook/wangle
that referenced
this pull request
Jun 23, 2026
…_BINARY_DIR
Summary:
### The Bug
When the CMake project A, which is using `add_fbthrift_cpp_library`, is imported by another parent CMake project B by `FetchContent`, project B may not build because the generated CPP sources refer to header files that don't exist.
E.g.,
```
[488/1435] Building CXX object _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o
FAILED: [code=1] _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o
/usr/bin/ccache /usr/bin/c++ -DBOOST_ATOMIC_DYN_LINK -DBOOST_ATOMIC_NO_LIB -DBOOST_CONTEXT_DYN_LINK -DBOOST_CONTEXT_NO_LIB -DBOOST_FILESYSTEM_DYN_LINK -DBOOST_FILESYSTEM_NO_LIB -DBOOST_PROGRAM_OPTIONS_DYN_LINK -DBOOST_PROGRAM_OPTIONS_NO_LIB -DBOOST_REGEX_DYN_LINK -DBOOST_REGEX_NO_LIB -DBOOST_THREAD_DYN_LINK -DBOOST_THREAD_NO_LIB -DFOLLY_HAS_COROUTINES=1 -DGFLAGS_IS_A_DLL=0 -DVELOX_ENABLE_PARQUET -I/root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/. -I/root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/velox/external/xxhash -I/root/Public/code/velox4j/src/main/cpp/cmake-build-debug -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/velox -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/velox/external -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/folly-src -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/folly-build -isystem /usr/include/libdwarf -mavx2 -mfma -mavx -mf16c -mlzcnt -mbmi2 -DUSE_VELOX_COMMON_BASE -DHAS_UNCAUGHT_EXCEPTIONS -Wall -Wextra -Wno-unused -Wno-unused-parameter -Wno-sign-compare -Wno-ignored-qualifiers -Wno-implicit-fallthrough -Wno-class-memaccess -Wno-comment -Wno-int-in-bool-context -Wno-redundant-move -Wno-array-bounds -Wno-maybe-uninitialized -Wno-unused-result -Wno-format-overflow -Wno-strict-aliasing -g -std=gnu++20 -fPIC -fdiagnostics-color=always -fcoroutines -fsized-deallocation -MD -MT _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o -MF _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o.d -o _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o -c /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-build/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_serialization.cpp
/root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-build/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_serialization.cpp:7:10: fatal error: cmake-build-debug/_deps/velox-src/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_custom_protocol.h: No such file or directory
7 | #include "cmake-build-debug/_deps/velox-src/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_custom_protocol.h"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
While the generated header is under `cmake-build-debug/_deps/velox-build/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_custom_protocol.h`.
### The Fix
The PR is a general fix for the issue by turning `CMAKE_SOURCE_DIR` / `CMAKE_BINARY_DIR` to `PROJECT_SOURCE_DIR` / `PROJECT_BINARY_DIR`, to make the generated sources portable for any parent CMake projects' use.
This fixes Velox bug facebookincubator/velox#17853.
X-link: facebook/fbthrift#701
Reviewed By: hchokshi
Differential Revision: D109468864
Pulled By: createdbysk
fbshipit-source-id: c4b54a9e63cb7064748831be463fc1a5a2c8c918
meta-codesync Bot
pushed a commit
to facebook/watchman
that referenced
this pull request
Jun 23, 2026
…_BINARY_DIR
Summary:
### The Bug
When the CMake project A, which is using `add_fbthrift_cpp_library`, is imported by another parent CMake project B by `FetchContent`, project B may not build because the generated CPP sources refer to header files that don't exist.
E.g.,
```
[488/1435] Building CXX object _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o
FAILED: [code=1] _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o
/usr/bin/ccache /usr/bin/c++ -DBOOST_ATOMIC_DYN_LINK -DBOOST_ATOMIC_NO_LIB -DBOOST_CONTEXT_DYN_LINK -DBOOST_CONTEXT_NO_LIB -DBOOST_FILESYSTEM_DYN_LINK -DBOOST_FILESYSTEM_NO_LIB -DBOOST_PROGRAM_OPTIONS_DYN_LINK -DBOOST_PROGRAM_OPTIONS_NO_LIB -DBOOST_REGEX_DYN_LINK -DBOOST_REGEX_NO_LIB -DBOOST_THREAD_DYN_LINK -DBOOST_THREAD_NO_LIB -DFOLLY_HAS_COROUTINES=1 -DGFLAGS_IS_A_DLL=0 -DVELOX_ENABLE_PARQUET -I/root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/. -I/root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/velox/external/xxhash -I/root/Public/code/velox4j/src/main/cpp/cmake-build-debug -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/velox -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/velox/external -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/folly-src -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/folly-build -isystem /usr/include/libdwarf -mavx2 -mfma -mavx -mf16c -mlzcnt -mbmi2 -DUSE_VELOX_COMMON_BASE -DHAS_UNCAUGHT_EXCEPTIONS -Wall -Wextra -Wno-unused -Wno-unused-parameter -Wno-sign-compare -Wno-ignored-qualifiers -Wno-implicit-fallthrough -Wno-class-memaccess -Wno-comment -Wno-int-in-bool-context -Wno-redundant-move -Wno-array-bounds -Wno-maybe-uninitialized -Wno-unused-result -Wno-format-overflow -Wno-strict-aliasing -g -std=gnu++20 -fPIC -fdiagnostics-color=always -fcoroutines -fsized-deallocation -MD -MT _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o -MF _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o.d -o _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o -c /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-build/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_serialization.cpp
/root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-build/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_serialization.cpp:7:10: fatal error: cmake-build-debug/_deps/velox-src/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_custom_protocol.h: No such file or directory
7 | #include "cmake-build-debug/_deps/velox-src/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_custom_protocol.h"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
While the generated header is under `cmake-build-debug/_deps/velox-build/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_custom_protocol.h`.
### The Fix
The PR is a general fix for the issue by turning `CMAKE_SOURCE_DIR` / `CMAKE_BINARY_DIR` to `PROJECT_SOURCE_DIR` / `PROJECT_BINARY_DIR`, to make the generated sources portable for any parent CMake projects' use.
This fixes Velox bug facebookincubator/velox#17853.
X-link: facebook/fbthrift#701
Reviewed By: hchokshi
Differential Revision: D109468864
Pulled By: createdbysk
fbshipit-source-id: c4b54a9e63cb7064748831be463fc1a5a2c8c918
meta-codesync Bot
pushed a commit
to facebook/rebalancer
that referenced
this pull request
Jun 25, 2026
…_BINARY_DIR
Summary:
### The Bug
When the CMake project A, which is using `add_fbthrift_cpp_library`, is imported by another parent CMake project B by `FetchContent`, project B may not build because the generated CPP sources refer to header files that don't exist.
E.g.,
```
[488/1435] Building CXX object _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o
FAILED: [code=1] _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o
/usr/bin/ccache /usr/bin/c++ -DBOOST_ATOMIC_DYN_LINK -DBOOST_ATOMIC_NO_LIB -DBOOST_CONTEXT_DYN_LINK -DBOOST_CONTEXT_NO_LIB -DBOOST_FILESYSTEM_DYN_LINK -DBOOST_FILESYSTEM_NO_LIB -DBOOST_PROGRAM_OPTIONS_DYN_LINK -DBOOST_PROGRAM_OPTIONS_NO_LIB -DBOOST_REGEX_DYN_LINK -DBOOST_REGEX_NO_LIB -DBOOST_THREAD_DYN_LINK -DBOOST_THREAD_NO_LIB -DFOLLY_HAS_COROUTINES=1 -DGFLAGS_IS_A_DLL=0 -DVELOX_ENABLE_PARQUET -I/root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/. -I/root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/velox/external/xxhash -I/root/Public/code/velox4j/src/main/cpp/cmake-build-debug -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/velox -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-src/velox/external -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/folly-src -isystem /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/folly-build -isystem /usr/include/libdwarf -mavx2 -mfma -mavx -mf16c -mlzcnt -mbmi2 -DUSE_VELOX_COMMON_BASE -DHAS_UNCAUGHT_EXCEPTIONS -Wall -Wextra -Wno-unused -Wno-unused-parameter -Wno-sign-compare -Wno-ignored-qualifiers -Wno-implicit-fallthrough -Wno-class-memaccess -Wno-comment -Wno-int-in-bool-context -Wno-redundant-move -Wno-array-bounds -Wno-maybe-uninitialized -Wno-unused-result -Wno-format-overflow -Wno-strict-aliasing -g -std=gnu++20 -fPIC -fdiagnostics-color=always -fcoroutines -fsized-deallocation -MD -MT _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o -MF _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o.d -o _deps/velox-build/velox/dwio/parquet/thrift/CMakeFiles/velox_dwio_parquet_thrift_raw.dir/gen-cpp2/parquet_types_serialization.cpp.o -c /root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-build/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_serialization.cpp
/root/Public/code/velox4j/src/main/cpp/cmake-build-debug/_deps/velox-build/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_serialization.cpp:7:10: fatal error: cmake-build-debug/_deps/velox-src/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_custom_protocol.h: No such file or directory
7 | #include "cmake-build-debug/_deps/velox-src/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_custom_protocol.h"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
While the generated header is under `cmake-build-debug/_deps/velox-build/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_custom_protocol.h`.
### The Fix
The PR is a general fix for the issue by turning `CMAKE_SOURCE_DIR` / `CMAKE_BINARY_DIR` to `PROJECT_SOURCE_DIR` / `PROJECT_BINARY_DIR`, to make the generated sources portable for any parent CMake projects' use.
This fixes Velox bug facebookincubator/velox#17853.
X-link: facebook/fbthrift#701
Reviewed By: hchokshi
Differential Revision: D109468864
Pulled By: createdbysk
fbshipit-source-id: c4b54a9e63cb7064748831be463fc1a5a2c8c918
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The Bug
When the CMake project A, which is using
add_fbthrift_cpp_library, is imported by another parent CMake project B byFetchContent, project B may not build because the generated CPP sources refer to header files that don't exist.E.g.,
While the generated header is under
cmake-build-debug/_deps/velox-build/velox/dwio/parquet/thrift/gen-cpp2/parquet_types_custom_protocol.h.The Fix
The PR is a general fix for the issue by turning
CMAKE_SOURCE_DIR/CMAKE_BINARY_DIRtoPROJECT_SOURCE_DIR/PROJECT_BINARY_DIR, to make the generated sources portable for any parent CMake projects' use.This fixes Velox bug facebookincubator/velox#17853.