cucumber/cucumber-cpp

Better integration with CMake 3.13

Closed this issue · 0 comments

Use case

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

FetchContent_GetProperties (cucumber_cpp)
if (NOT cucumber_cpp_POPULATED)

    FetchContent_Populate (cucumber_cpp)

    set (CUKE_DISABLE_GTEST ON)
    add_subdirectory (
        ${cucumber_cpp_SOURCE_DIR}
        ${cucumber_cpp_BINARY_DIR}
    )

endif ()

Prints the following warning:

CMake Warning (dev) at build/_deps/cucumber_cpp-src/CMakeLists.txt:14 (option):
  Policy CMP0077 is not set: option() honors normal variables.  Run "cmake
  --help-policy CMP0077" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

  For compatibility with older versions of CMake, option is clearing the
  normal variable 'CUKE_DISABLE_GTEST'.
This warning is for project developers.  Use -Wno-dev to suppress it.

Possible solutions

  • Use set(... CACHE ...) or option(). Requires docstring duplication (in practice removal).
  • If CMAKE_VERSION is 3.13 or above then set policy CMP0077: option() honors normal variables. This must be done in cucumber-cpp/CMakeLists.txt.