From 1410df2e180fb32193f9d937d8fc77c855409797 Mon Sep 17 00:00:00 2001 From: Alfi Maulana Date: Sun, 8 Jan 2023 11:47:14 +0700 Subject: [PATCH] add option in test configuration to output `hello_world.txt` --- test/CMakeLists.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 71bf957..135aa7f 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -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()