summaryrefslogtreecommitdiffstats
path: root/test cases/cmake/8 custom command/subprojects/cmMod
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-29 04:41:38 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-29 04:41:38 +0000
commit7b6e527f440cd7e6f8be2b07cee320ee6ca18786 (patch)
tree4a2738d69fa2814659fdadddf5826282e73d81f4 /test cases/cmake/8 custom command/subprojects/cmMod
parentInitial commit. (diff)
downloadmeson-upstream.tar.xz
meson-upstream.zip
Adding upstream version 1.0.1.upstream/1.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test cases/cmake/8 custom command/subprojects/cmMod')
-rw-r--r--test cases/cmake/8 custom command/subprojects/cmMod/CMakeLists.txt163
-rw-r--r--test cases/cmake/8 custom command/subprojects/cmMod/args_test.cpp18
-rw-r--r--test cases/cmake/8 custom command/subprojects/cmMod/cmMod.cpp24
-rw-r--r--test cases/cmake/8 custom command/subprojects/cmMod/cmMod.hpp14
-rw-r--r--test cases/cmake/8 custom command/subprojects/cmMod/cp.cpp22
-rw-r--r--test cases/cmake/8 custom command/subprojects/cmMod/cpyBase.cpp.am5
-rw-r--r--test cases/cmake/8 custom command/subprojects/cmMod/cpyBase.hpp.am5
-rw-r--r--test cases/cmake/8 custom command/subprojects/cmMod/cpyInc.hpp.am3
-rw-r--r--test cases/cmake/8 custom command/subprojects/cmMod/cpyNext.cpp.am5
-rw-r--r--test cases/cmake/8 custom command/subprojects/cmMod/cpyNext.hpp.am5
-rw-r--r--test cases/cmake/8 custom command/subprojects/cmMod/cpyTest.cpp9
-rw-r--r--test cases/cmake/8 custom command/subprojects/cmMod/cpyTest/CMakeLists.txt7
-rw-r--r--test cases/cmake/8 custom command/subprojects/cmMod/cpyTest/cpyTest.hpp5
-rw-r--r--test cases/cmake/8 custom command/subprojects/cmMod/cpyTest/cpyTest2.hpp3
-rw-r--r--test cases/cmake/8 custom command/subprojects/cmMod/cpyTest/cpyTest3.hpp3
-rw-r--r--test cases/cmake/8 custom command/subprojects/cmMod/cpyTest/cpyTest4.hpp3
-rw-r--r--test cases/cmake/8 custom command/subprojects/cmMod/cpyTest/cpyTest5.hpp3
-rw-r--r--test cases/cmake/8 custom command/subprojects/cmMod/genMain.cpp40
-rw-r--r--test cases/cmake/8 custom command/subprojects/cmMod/macro_name.cpp20
-rw-r--r--test cases/cmake/8 custom command/subprojects/cmMod/mycpy/.gitkeep1
20 files changed, 358 insertions, 0 deletions
diff --git a/test cases/cmake/8 custom command/subprojects/cmMod/CMakeLists.txt b/test cases/cmake/8 custom command/subprojects/cmMod/CMakeLists.txt
new file mode 100644
index 0000000..0185ddc
--- /dev/null
+++ b/test cases/cmake/8 custom command/subprojects/cmMod/CMakeLists.txt
@@ -0,0 +1,163 @@
+cmake_minimum_required(VERSION 3.5)
+
+project(cmMod)
+set (CMAKE_CXX_STANDARD 14)
+set (CMAKE_CXX_STANDARD_REQUIRED ON)
+
+include_directories(${CMAKE_CURRENT_BINARY_DIR})
+add_definitions("-DDO_NOTHING_JUST_A_FLAG=1")
+
+add_executable(genMain genMain.cpp)
+add_custom_command(OUTPUT main.cpp COMMAND genMain > main.cpp)
+
+add_executable(gen main.cpp)
+add_executable(mycpy cp.cpp)
+
+# cpyBase
+add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/genTest.cpp" "${CMAKE_CURRENT_BINARY_DIR}/genTest.hpp"
+ COMMAND gen ARGS genTest
+)
+
+set(CMD_PART)
+list(APPEND CMD_PART COMMAND mycpy cpyBase.cpp.in cpyBase.cpp.in.gen)
+list(APPEND CMD_PART COMMAND mycpy cpyBase.cpp.in.gen cpyBase.cpp.out)
+list(APPEND CMD_PART COMMAND mycpy cpyBase.cpp.out cpyBase.cpp.something)
+
+add_custom_command(
+ OUTPUT cpyBase.cpp
+ COMMAND mycpy "${CMAKE_CURRENT_SOURCE_DIR}/cpyBase.cpp.am" cpyBase.cpp.in
+ ${CMD_PART}
+ COMMAND mycpy cpyBase.cpp.in cpyBase.cpp.something
+ COMMAND mycpy cpyBase.cpp.something cpyBase.cpp.IAmRunningOutOfIdeas
+ COMMAND mycpy cpyBase.cpp.IAmRunningOutOfIdeas cpyBase.cpp
+ DEPENDS cpyBase.cpp.am;gen
+)
+
+add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/cpyBase.hpp.in"
+ COMMAND mycpy "${CMAKE_CURRENT_SOURCE_DIR}/cpyBase.hpp.am" cpyBase.hpp.in
+ DEPENDS cpyBase.hpp.am
+)
+
+add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/cpyBase.hpp.something"
+ COMMAND mycpy cpyBase.hpp.in cpyBase.hpp.something
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/cpyBase.hpp.in"
+)
+
+add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/cpyBase.hpp"
+ COMMAND mycpy cpyBase.hpp.something cpyBase.hpp
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/cpyBase.hpp.something"
+)
+
+# cpyNext (out of order is on purpose)
+# -- first copy round
+add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/s1_a_hpp/file.txt"
+ COMMAND mycpy "${CMAKE_CURRENT_SOURCE_DIR}/cpyNext.hpp.am" file.txt
+ DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/cpyNext.hpp.am"
+ WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/s1_a_hpp"
+)
+
+add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/s1_b_cpp/file.txt"
+ COMMAND mycpy "${CMAKE_CURRENT_SOURCE_DIR}/cpyNext.cpp.am" file.txt
+ DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/cpyNext.cpp.am"
+ WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/s1_b_cpp"
+)
+
+# -- final cpy round
+add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/cpyNext.hpp"
+ COMMAND mycpy "${CMAKE_CURRENT_BINARY_DIR}/s2_b_hpp/file.txt" cpyNext.hpp
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/s2_b_hpp/file.txt"
+ WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
+)
+
+add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/cpyNext.cpp"
+ COMMAND mycpy "${CMAKE_CURRENT_BINARY_DIR}/s2_a_cpp/file.txt" cpyNext.cpp
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/s2_a_cpp/file.txt"
+ WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
+)
+
+# -- second copy round
+add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/s2_b_hpp/file.txt"
+ COMMAND mycpy "${CMAKE_CURRENT_BINARY_DIR}/s1_a_hpp/file.txt" file.txt
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/s1_a_hpp/file.txt"
+ WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/s2_b_hpp"
+)
+
+add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/s2_a_cpp/file.txt"
+ COMMAND mycpy "${CMAKE_CURRENT_BINARY_DIR}/s1_b_cpp/file.txt" file.txt
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/s1_b_cpp/file.txt"
+ WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/s2_a_cpp"
+)
+
+# cpyTest (copy file without renaming)
+add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/cpyTest.hpp"
+ COMMAND mycpy "${CMAKE_CURRENT_SOURCE_DIR}/cpyTest/cpyTest.hpp" "${CMAKE_CURRENT_BINARY_DIR}/cpyTest.hpp"
+ DEPENDS "cpyTest/cpyTest.hpp"
+)
+
+add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/cpyTest2.hpp"
+ COMMAND mycpy "${CMAKE_CURRENT_SOURCE_DIR}/cpyTest/cpyTest2.hpp" "${CMAKE_CURRENT_BINARY_DIR}/cpyTest2.hpp"
+ DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/cpyTest/cpyTest2.hpp"
+)
+
+add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/cpyTest3.hpp"
+ COMMAND mycpy cpyTest3.hpp "${CMAKE_CURRENT_BINARY_DIR}/cpyTest3.hpp"
+ DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/cpyTest/cpyTest3.hpp"
+ WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/cpyTest"
+)
+
+add_subdirectory(cpyTest ccppyyTTeesstt)
+
+add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/cpyTest/some/directory/cpyTest5.hpp"
+ COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/cpyTest/cpyTest5.hpp" "${CMAKE_CURRENT_BINARY_DIR}/cpyTest/some/directory/cpyTest5.hpp"
+ DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/cpyTest/cpyTest5.hpp"
+)
+include_directories("${CMAKE_CURRENT_BINARY_DIR}/cpyTest/some")
+
+add_library(cmModLib SHARED cmMod.cpp genTest.cpp cpyBase.cpp cpyBase.hpp cpyNext.cpp cpyNext.hpp cpyTest.cpp cpyTest.hpp cpyTest2.hpp cpyTest3.hpp cpyTest/some/directory/cpyTest5.hpp)
+include(GenerateExportHeader)
+generate_export_header(cmModLib)
+
+set(ARGS_TEST arg1)
+set(ARGS_TEST ${ARGS_TEST} arg2)
+
+add_executable(macro_name macro_name.cpp)
+add_executable(args_test args_test.cpp)
+add_custom_target(args_test_cmd
+ COMMAND args_test ${ARGS_TEST}
+)
+add_custom_target(macro_name_cmd COMMAND macro_name)
+
+if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
+ message(STATUS "Running the -include test case on macro_name")
+ add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/cpyInc.hpp"
+ COMMAND mycpy "${CMAKE_CURRENT_SOURCE_DIR}/cpyInc.hpp.am" "${CMAKE_CURRENT_BINARY_DIR}/cpyInc.hpp"
+ DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/cpyInc.hpp.am"
+ )
+ target_compile_options(macro_name PUBLIC -DTEST_CMD_INCLUDE -include "${CMAKE_CURRENT_BINARY_DIR}/cpyInc.hpp")
+endif()
+
+# Only executable targets are replaced in the command
+# all other target names are kept as is
+add_custom_target(clang-format COMMAND clang-format -i cmMod.cpp)
+
+add_dependencies(cmModLib args_test_cmd tgtCpyTest4)
+add_dependencies(args_test_cmd macro_name_cmd;gen;mycpy)
+
+# Reproduce https://github.com/mesonbuild/meson/issues/10244
+add_custom_target(mycpy.all)
+add_dependencies(mycpy.all mycpy)
diff --git a/test cases/cmake/8 custom command/subprojects/cmMod/args_test.cpp b/test cases/cmake/8 custom command/subprojects/cmMod/args_test.cpp
new file mode 100644
index 0000000..abb8a42
--- /dev/null
+++ b/test cases/cmake/8 custom command/subprojects/cmMod/args_test.cpp
@@ -0,0 +1,18 @@
+#include <iostream>
+#include <fstream>
+
+using namespace std;
+
+int main(int argc, const char *argv[]) {
+ if(argc != 3 || string(argv[1]) != "arg1" || string(argv[2]) != "arg2") {
+ cerr << argv[0] << " requires 2 args" << endl;
+ return 1;
+ }
+
+ ifstream in1("macro_name.txt");
+ ofstream out1("cmModLib.hpp");
+ out1 << "#define " << in1.rdbuf() << " = \"plop\"";
+
+
+ return 0;
+}
diff --git a/test cases/cmake/8 custom command/subprojects/cmMod/cmMod.cpp b/test cases/cmake/8 custom command/subprojects/cmMod/cmMod.cpp
new file mode 100644
index 0000000..a466399
--- /dev/null
+++ b/test cases/cmake/8 custom command/subprojects/cmMod/cmMod.cpp
@@ -0,0 +1,24 @@
+#include "cmMod.hpp"
+#include "genTest.hpp"
+#include "cpyBase.hpp"
+#include "cpyNext.hpp"
+#include "cpyTest.hpp"
+#include "cmModLib.hpp"
+
+#ifndef FOO
+#error FOO not declared
+#endif
+
+using namespace std;
+
+cmModClass::cmModClass(string foo) {
+ str = foo + " World";
+}
+
+string cmModClass::getStr() const {
+ return str;
+}
+
+string cmModClass::getOther() const {
+ return "Strings:\n - " + getStrCpy() + "\n - " + getStrNext() + "\n - " + getStrCpyTest();
+}
diff --git a/test cases/cmake/8 custom command/subprojects/cmMod/cmMod.hpp b/test cases/cmake/8 custom command/subprojects/cmMod/cmMod.hpp
new file mode 100644
index 0000000..cfdbe88
--- /dev/null
+++ b/test cases/cmake/8 custom command/subprojects/cmMod/cmMod.hpp
@@ -0,0 +1,14 @@
+#pragma once
+
+#include <string>
+#include "cmmodlib_export.h"
+
+class CMMODLIB_EXPORT cmModClass {
+ private:
+ std::string str;
+ public:
+ cmModClass(std::string foo);
+
+ std::string getStr() const;
+ std::string getOther() const;
+};
diff --git a/test cases/cmake/8 custom command/subprojects/cmMod/cp.cpp b/test cases/cmake/8 custom command/subprojects/cmMod/cp.cpp
new file mode 100644
index 0000000..09433f2
--- /dev/null
+++ b/test cases/cmake/8 custom command/subprojects/cmMod/cp.cpp
@@ -0,0 +1,22 @@
+#include <iostream>
+#include <fstream>
+
+using namespace std;
+
+int main(int argc, char *argv[]) {
+ if(argc < 3) {
+ cerr << argv[0] << " requires an input and an output file!" << endl;
+ return 1;
+ }
+
+ ifstream src(argv[1]);
+ ofstream dst(argv[2]);
+
+ if(!src.is_open()) {
+ cerr << "Failed to open " << argv[1] << endl;
+ return 2;
+ }
+
+ dst << src.rdbuf();
+ return 0;
+}
diff --git a/test cases/cmake/8 custom command/subprojects/cmMod/cpyBase.cpp.am b/test cases/cmake/8 custom command/subprojects/cmMod/cpyBase.cpp.am
new file mode 100644
index 0000000..98dd09c
--- /dev/null
+++ b/test cases/cmake/8 custom command/subprojects/cmMod/cpyBase.cpp.am
@@ -0,0 +1,5 @@
+#include "cpyBase.hpp"
+
+std::string getStrCpy() {
+ return "Hello Copied File";
+}
diff --git a/test cases/cmake/8 custom command/subprojects/cmMod/cpyBase.hpp.am b/test cases/cmake/8 custom command/subprojects/cmMod/cpyBase.hpp.am
new file mode 100644
index 0000000..c255fb1
--- /dev/null
+++ b/test cases/cmake/8 custom command/subprojects/cmMod/cpyBase.hpp.am
@@ -0,0 +1,5 @@
+#pragma once
+
+#include <string>
+
+std::string getStrCpy();
diff --git a/test cases/cmake/8 custom command/subprojects/cmMod/cpyInc.hpp.am b/test cases/cmake/8 custom command/subprojects/cmMod/cpyInc.hpp.am
new file mode 100644
index 0000000..07c8ff7
--- /dev/null
+++ b/test cases/cmake/8 custom command/subprojects/cmMod/cpyInc.hpp.am
@@ -0,0 +1,3 @@
+#pragma once
+
+#define CPY_INC_WAS_INCLUDED 1
diff --git a/test cases/cmake/8 custom command/subprojects/cmMod/cpyNext.cpp.am b/test cases/cmake/8 custom command/subprojects/cmMod/cpyNext.cpp.am
new file mode 100644
index 0000000..20a8815
--- /dev/null
+++ b/test cases/cmake/8 custom command/subprojects/cmMod/cpyNext.cpp.am
@@ -0,0 +1,5 @@
+#include "cpyNext.hpp"
+
+std::string getStrNext() {
+ return "Hello Copied File -- now even more convoluted!";
+}
diff --git a/test cases/cmake/8 custom command/subprojects/cmMod/cpyNext.hpp.am b/test cases/cmake/8 custom command/subprojects/cmMod/cpyNext.hpp.am
new file mode 100644
index 0000000..41919d8
--- /dev/null
+++ b/test cases/cmake/8 custom command/subprojects/cmMod/cpyNext.hpp.am
@@ -0,0 +1,5 @@
+#pragma once
+
+#include <string>
+
+std::string getStrNext();
diff --git a/test cases/cmake/8 custom command/subprojects/cmMod/cpyTest.cpp b/test cases/cmake/8 custom command/subprojects/cmMod/cpyTest.cpp
new file mode 100644
index 0000000..627b8f9
--- /dev/null
+++ b/test cases/cmake/8 custom command/subprojects/cmMod/cpyTest.cpp
@@ -0,0 +1,9 @@
+#include "cpyTest.hpp"
+#include "cpyTest2.hpp"
+#include "cpyTest3.hpp"
+#include "ccppyyTTeesstt/cpyTest4.hpp"
+#include "directory/cpyTest5.hpp"
+
+std::string getStrCpyTest() {
+ return CPY_TEST_STR_2 CPY_TEST_STR_3 CPY_TEST_STR_4 CPY_TEST_STR_5;
+}
diff --git a/test cases/cmake/8 custom command/subprojects/cmMod/cpyTest/CMakeLists.txt b/test cases/cmake/8 custom command/subprojects/cmMod/cpyTest/CMakeLists.txt
new file mode 100644
index 0000000..f577dcf
--- /dev/null
+++ b/test cases/cmake/8 custom command/subprojects/cmMod/cpyTest/CMakeLists.txt
@@ -0,0 +1,7 @@
+add_custom_command(
+ OUTPUT cpyTest4.hpp
+ COMMAND mycpy "${CMAKE_CURRENT_SOURCE_DIR}/cpyTest4.hpp" cpyTest4.hpp
+ DEPENDS cpyTest4.hpp
+)
+
+add_custom_target(tgtCpyTest4 DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/cpyTest4.hpp")
diff --git a/test cases/cmake/8 custom command/subprojects/cmMod/cpyTest/cpyTest.hpp b/test cases/cmake/8 custom command/subprojects/cmMod/cpyTest/cpyTest.hpp
new file mode 100644
index 0000000..e8dec13
--- /dev/null
+++ b/test cases/cmake/8 custom command/subprojects/cmMod/cpyTest/cpyTest.hpp
@@ -0,0 +1,5 @@
+#pragma once
+
+#include <string>
+
+std::string getStrCpyTest();
diff --git a/test cases/cmake/8 custom command/subprojects/cmMod/cpyTest/cpyTest2.hpp b/test cases/cmake/8 custom command/subprojects/cmMod/cpyTest/cpyTest2.hpp
new file mode 100644
index 0000000..bdbcc56
--- /dev/null
+++ b/test cases/cmake/8 custom command/subprojects/cmMod/cpyTest/cpyTest2.hpp
@@ -0,0 +1,3 @@
+#pragma once
+
+#define CPY_TEST_STR_2 "Hello "
diff --git a/test cases/cmake/8 custom command/subprojects/cmMod/cpyTest/cpyTest3.hpp b/test cases/cmake/8 custom command/subprojects/cmMod/cpyTest/cpyTest3.hpp
new file mode 100644
index 0000000..2d13376
--- /dev/null
+++ b/test cases/cmake/8 custom command/subprojects/cmMod/cpyTest/cpyTest3.hpp
@@ -0,0 +1,3 @@
+#pragma once
+
+#define CPY_TEST_STR_3 "CopyFile"
diff --git a/test cases/cmake/8 custom command/subprojects/cmMod/cpyTest/cpyTest4.hpp b/test cases/cmake/8 custom command/subprojects/cmMod/cpyTest/cpyTest4.hpp
new file mode 100644
index 0000000..4124c43
--- /dev/null
+++ b/test cases/cmake/8 custom command/subprojects/cmMod/cpyTest/cpyTest4.hpp
@@ -0,0 +1,3 @@
+#pragma once
+
+#define CPY_TEST_STR_4 " test"
diff --git a/test cases/cmake/8 custom command/subprojects/cmMod/cpyTest/cpyTest5.hpp b/test cases/cmake/8 custom command/subprojects/cmMod/cpyTest/cpyTest5.hpp
new file mode 100644
index 0000000..3669f00
--- /dev/null
+++ b/test cases/cmake/8 custom command/subprojects/cmMod/cpyTest/cpyTest5.hpp
@@ -0,0 +1,3 @@
+#pragma once
+
+#define CPY_TEST_STR_5 " test"
diff --git a/test cases/cmake/8 custom command/subprojects/cmMod/genMain.cpp b/test cases/cmake/8 custom command/subprojects/cmMod/genMain.cpp
new file mode 100644
index 0000000..33f0201
--- /dev/null
+++ b/test cases/cmake/8 custom command/subprojects/cmMod/genMain.cpp
@@ -0,0 +1,40 @@
+#include <iostream>
+
+using namespace std;
+
+int main() {
+ cout << R"asd(
+#include <iostream>
+#include <fstream>
+
+using namespace std;
+
+int main(int argc, const char *argv[]) {
+ if(argc < 2) {
+ cerr << argv[0] << " requires an output file!" << endl;
+ return 1;
+ }
+ ofstream out1(string(argv[1]) + ".hpp");
+ ofstream out2(string(argv[1]) + ".cpp");
+ out1 << R"(
+#pragma once
+
+#include <string>
+
+std::string getStr();
+)";
+
+ out2 << R"(
+#include ")" << argv[1] << R"(.hpp"
+
+std::string getStr() {
+ return "Hello World";
+}
+)";
+
+ return 0;
+}
+)asd";
+
+ return 0;
+}
diff --git a/test cases/cmake/8 custom command/subprojects/cmMod/macro_name.cpp b/test cases/cmake/8 custom command/subprojects/cmMod/macro_name.cpp
new file mode 100644
index 0000000..964062f
--- /dev/null
+++ b/test cases/cmake/8 custom command/subprojects/cmMod/macro_name.cpp
@@ -0,0 +1,20 @@
+#include <iostream>
+#include <fstream>
+#include <chrono>
+#include <thread>
+
+using namespace std;
+
+#ifdef TEST_CMD_INCLUDE
+#if CPY_INC_WAS_INCLUDED != 1
+#error "cpyInc.hpp was not included"
+#endif
+#endif
+
+int main() {
+ this_thread::sleep_for(chrono::seconds(1));
+ ofstream out1("macro_name.txt");
+ out1 << "FOO";
+
+ return 0;
+}
diff --git a/test cases/cmake/8 custom command/subprojects/cmMod/mycpy/.gitkeep b/test cases/cmake/8 custom command/subprojects/cmMod/mycpy/.gitkeep
new file mode 100644
index 0000000..22c19ce
--- /dev/null
+++ b/test cases/cmake/8 custom command/subprojects/cmMod/mycpy/.gitkeep
@@ -0,0 +1 @@
+# Required to reproduce https://github.com/mesonbuild/meson/issues/10244