Skip to content

Unable to add_subdirectory (cucumber-cpp) because include directory is not setup properly #210

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ghost opened this issue Dec 24, 2018 · 0 comments
Labels

Comments

@ghost
Copy link

ghost commented Dec 24, 2018

Steps to Reproduce

Clone into sub-directory import and use add_subdirectory (import/cucumber-cpp). Build fails:

...

Scanning dependencies of target cucumber-cpp-nomain
[ 14%] Building CXX object import/cucumber-cpp/src/CMakeFiles/cucumber-cpp-nomain.dir/drivers/GenericDriver.cpp.o
/home/sbon/Code/project/import/cucumber-cpp/src/drivers/GenericDriver.cpp:1:10: fatal error: 'cucumber-cpp/internal/drivers/GenericDriver.hpp' file not found
#include "cucumber-cpp/internal/drivers/GenericDriver.hpp"
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
make[2]: *** [import/cucumber-cpp/src/CMakeFiles/cucumber-cpp-nomain.dir/build.make:67: import/cucumber-cpp/src/CMakeFiles/cucumber-cpp-nomain.dir/drivers/GenericDriver.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:1294: import/cucumber-cpp/src/CMakeFiles/cucumber-cpp-nomain.dir/all] Error 2
make: *** [Makefile:141: all] Error 2

Cucumber C++ Include directory resolved as project/include
But it should be project/import/cucumber-cpp/include

Possible Solution

Change this:

$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include>

to this:

        $<BUILD_INTERFACE:${CUKE_INCLUDE_DIR}>

Use case

CMakeLists.txt

FetchContent_Declare (cucumber_cpp
    GIT_REPOSITORY https://github.com./cucumber/cucumber-cpp.git
    GIT_TAG        v0.5
)

FetchContent_GetProperties (cucumber_cpp)
if (NOT cucumber_cpp_POPULATED)

    FetchContent_Populate (cucumber_cpp)

    set (CUKE_DISABLE_GTEST         ON CACHE BOOL "Don't build Google Test")
    set (CUKE_DISABLE_QT            ON CACHE BOOL "Don't build Qt")
    set (CUDE_DISABLE_UNIT_TESTS    ON CACHE BOOL "Don't build unit tests")
    set (CUKE_DISABLE_E2E_TESTS     ON CACHE BOOL "Don't build end-to-end tests")

    add_subdirectory (
        ${cucumber_cpp_SOURCE_DIR}
        ${cucumber_cpp_BINARY_DIR}
    )

endif ()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

0 participants