You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Cheng Chen (JIRA)" <ji...@apache.org> on 2017/11/29 06:23:00 UTC

[jira] [Created] (THRIFT-4394) Incorrect CMake build tree when thrift is added by add_subdirectory

Cheng Chen created THRIFT-4394:
----------------------------------

             Summary: Incorrect CMake build tree when thrift is added by add_subdirectory
                 Key: THRIFT-4394
                 URL: https://issues.apache.org/jira/browse/THRIFT-4394
             Project: Thrift
          Issue Type: Bug
          Components: C++ - Library
         Environment: Ubuntu 16.04, CMake 3.1
            Reporter: Cheng Chen


My project uses thrift as a third-party git submodule, and build it using CMake.  I have a few other third-party submodules, so I added my CMakeLists.txt to build them together, here is my project tree:

{code:java}
-myproj
    -build (where out-of-source build happens)
    -src
        -CMakeLists.txt (to build my project sources)
    -thirdparty
        -thrift (using branch 0.11.0 as git submodule)
        -foo (another git submodule)
        -CMakeLists.txt (to build all third-party components)
{code}

To build all third-party components:

{code:java}
        myproj/build$ cmake ../thirdparty
        sudo make install
{code}

From the output of "make install" there is 

{code:java}
-- Installing: /usr/local/include/thrift/thrift/config.h
{code}

The expected result is "/usr/local/include/thrift/config.h".

This is because [thrift/lib/cpp/CMakeLists.txt|https://github.com/apache/thrift/blob/0.11.0/lib/cpp/CMakeLists.txt] line 212 uses ${CMAKE_BINARY_DIR}, which your expect is the root binary directory of thrift, but now is changed because I defined a "wrapper" CMakeLists.txt, hence "thrift/thrift/config.h", then compile error occurs. Maybe CMAKE_CURRENT_BINARY_DIR is a better option here?











--
This message was sent by Atlassian JIRA
(v6.4.14#64029)