Skip to content

Commit b59cf0c

Browse files
committed
CMake/Ninja: give 'features' target direct terminal access
This will cause the output to be displayed while cucumber executes our features instead of when it's finished. Additionally, because it has direct terminal access, we can rely on cucumber's auto detection to enable color instead.
1 parent 2a9fa6c commit b59cf0c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,9 +200,16 @@ else()
200200
set(CUKE_COMPILE_DYNAMIC_CPP_STEPS '"${CMAKE_COMMAND}" --build "${CMAKE_BINARY_DIR}" --target e2e-steps')
201201

202202
function(add_feature_target TARGET_NAME)
203+
# Ensure we get colored output from cucumber and give it direct terminal access if
204+
# possible. Direct terminal access would cause the output to be displayed as it's being
205+
# produced instead of when cucumber is finished.
203206
if(CMAKE_GENERATOR STREQUAL "Ninja")
204207
list(APPEND ARGN --color)
205208
endif()
209+
set(USES_TERMINAL)
210+
if(NOT CMAKE_VERSION VERSION_LESS 3.2)
211+
set(USES_TERMINAL USES_TERMINAL)
212+
endif()
206213
add_custom_target(${TARGET_NAME}
207214
COMMAND ${CUCUMBER_RUBY}
208215
TEST_FEATURES_DIR=${CUKE_TEST_FEATURES_DIR}
@@ -215,6 +222,7 @@ else()
215222
${ARGN}
216223
${CUKE_FEATURES_DIR}
217224
DEPENDS cucumber-cpp
225+
${USES_TERMINAL}
218226
)
219227
endfunction(add_feature_target)
220228

0 commit comments

Comments
 (0)