Closed ghost closed 5 years ago
Clone into sub-directory import and use add_subdirectory (import/cucumber-cpp). Build fails:
import
add_subdirectory (import/cucumber-cpp)
... 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
project/include
project/import/cucumber-cpp/include
Change this:
https://github.com/cucumber/cucumber-cpp/blob/f79990879a3c2eea288de6efeefc4008937300cc/src/CMakeLists.txt#L75
to this:
$<BUILD_INTERFACE:${CUKE_INCLUDE_DIR}>
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 ()
Steps to Reproduce
Clone into sub-directory
import
and useadd_subdirectory (import/cucumber-cpp)
. Build fails:Cucumber C++ Include directory resolved as
project/include
But it should beproject/import/cucumber-cpp/include
Possible Solution
Change this:
https://github.com/cucumber/cucumber-cpp/blob/f79990879a3c2eea288de6efeefc4008937300cc/src/CMakeLists.txt#L75
to this:
Use case
CMakeLists.txt