hdu-sdlzx opened a new pull request, #3427:
URL: https://github.com/apache/thrift/pull/3427

   <!-- Explain the changes in the pull request below: -->
   
   # Problem
   
   Thrift uses boost headers, so we need to add boost header as dependency in 
cmake target.
   If boost is not installed in system directories, users of thrift will 
encounter the following build error
   ```
   [ 50%] Building CXX object CMakeFiles/app.dir/main.cpp.o
   In file included from /home/sdlzx/code/test/main.cpp:1:
   
/home/sdlzx/install/thrift/include/thrift/transport/TTransportException.h:23:10:
 fatal error: boost/numeric/conversion/cast.hpp: No such file or directory
      23 | #include <boost/numeric/conversion/cast.hpp>
         |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   compilation terminated.
   gmake[2]: *** [CMakeFiles/app.dir/build.make:79: 
CMakeFiles/app.dir/main.cpp.o] Error 1
   gmake[1]: *** [CMakeFiles/Makefile2:87: CMakeFiles/app.dir/all] Error 2
   gmake: *** [Makefile:91: all] Error 2
   ```
   
   # Testcase
   
   Tested with boost-1.90.0
   
   CMakeLists.txt
   ```
   cmake_minimum_required(VERSION 3.16)
   
   project(app)
   
   find_package(Thrift REQUIRED)
   add_executable(app main.cpp)
   target_link_libraries(app PRIVATE thrift::thrift)
   ```
   
   main.cpp
   ```
   #include <thrift/transport/TTransportException.h>
   
   int main()
   {
           return 0;
   }
   ```
   
   # Expected result
   
   Boost is found during cmake configure and app is built successfully.
   ```
   -- Found thrift: /home/sdlzx/install/thrift
   -- Found Boost: 
/home/sdlzx/install/boost/lib/cmake/Boost-1.90.0/BoostConfig.cmake (found 
version "1.90.0")
   -- Found ZLIB: /usr/lib64/libz.so (found version "1.3.1")
   -- Configuring done (0.3s)
   -- Generating done (0.0s)
   -- Build files have been written to: /home/sdlzx/code/test/build2
   
   ~/code/test/build2$ cmake --build . -j12
   [ 50%] Building CXX object CMakeFiles/app.dir/main.cpp.o
   [100%] Linking CXX executable app
   [100%] Built target app
   ```
   
   <!-- We recommend you review the checklist/tips before submitting a pull 
request. -->
   
   - [*] Did you create an [Apache 
Jira](https://issues.apache.org/jira/projects/THRIFT/issues/) ticket?  
([Request account here](https://selfserve.apache.org/jira-account.html), not 
required for trivial changes)
   - [*] If a ticket exists: Does your pull request title follow the pattern 
"THRIFT-NNNN: describe my issue"?
   - [*] Did you squash your changes to a single commit?  (not required, but 
preferred)
   - [*] Did you do your best to avoid breaking changes?  If one was needed, 
did you label the Jira ticket with "Breaking-Change"?
   - [ ] If your change does not involve any code, include `[skip ci]` anywhere 
in the commit message to free up build resources.
   
   <!--
     The Contributing Guide at:
     https://github.com/apache/thrift/blob/master/CONTRIBUTING.md
     has more details and tips for committing properly.
   -->
   


-- 
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