add option in test configuration to output hello_world.txt

This commit is contained in:
Alfi Maulana 2023-01-08 11:47:14 +07:00
parent 835c31b955
commit 1410df2e18
No known key found for this signature in database
GPG Key ID: 2242A64C2A8DF5A4

View File

@ -1,3 +1,13 @@
cmake_minimum_required(VERSION 3.0)
project(test)
option(BUILD_TXT "build hello world txt file" OFF)
add_executable(hello_world hello_world.cpp)
if(BUILD_TXT)
add_custom_target(
hello_world_txt ALL
COMMAND echo "Hello world!" >> ${CMAKE_CURRENT_BINARY_DIR}/hello_world.txt
)
endif()