Skip to content

Commit 58b00c6

Browse files
committed
Don't write temporary files just to satisfy CMake
Instead tell CMake that it's a generated source file so that it accepts their absence at generation time.
1 parent b59cf0c commit 58b00c6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,9 @@ else()
193193
set(CUKE_DYNAMIC_CPP_STEPS "${CUKE_TEST_FEATURES_DIR}/step_definitions/cpp_steps.cpp")
194194
string(REPLACE "/tmp" "${CMAKE_FILES_DIRECTORY}/e2e-steps.dir/tmp" CUKE_DYNAMIC_CPP_STEPS_OBJ "${CUKE_DYNAMIC_CPP_STEPS}${CMAKE_CXX_OUTPUT_EXTENSION}")
195195

196-
file(WRITE ${CUKE_DYNAMIC_CPP_STEPS})
197196
add_executable(e2e-steps EXCLUDE_FROM_ALL ${CUKE_DYNAMIC_CPP_STEPS})
197+
# Mark this file as generated so it isn't required at CMake generation time (it is necessary when the target gets built though)
198+
set_source_files_properties(${CUKE_DYNAMIC_CPP_STEPS} PROPERTIES GENERATED TRUE)
198199
target_link_libraries(e2e-steps ${CUKE_LIBRARIES})
199200

200201
set(CUKE_COMPILE_DYNAMIC_CPP_STEPS '"${CMAKE_COMMAND}" --build "${CMAKE_BINARY_DIR}" --target e2e-steps')

0 commit comments

Comments
 (0)