summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-05-22 16:38:24 (GMT)
committerKitware Robot <kwrobot@kitware.com>2023-05-22 16:38:33 (GMT)
commit8ce4e76dbf068779c2664c28142eead093f29edf (patch)
treef007ede08c3bcc96709c34a2622e21deee666ce0 /Tests
parent970716e232de344cbf519d88955e58b3c925f877 (diff)
parent08d49cfee69e16383373af4ddcc03a82afe250d2 (diff)
downloadCMake-8ce4e76dbf068779c2664c28142eead093f29edf.zip
CMake-8ce4e76dbf068779c2664c28142eead093f29edf.tar.gz
CMake-8ce4e76dbf068779c2664c28142eead093f29edf.tar.bz2
Merge topic 'autogen-test-file-generate'
08d49cfee6 Autogen: Add AUTOMOC test /w file(Generate) Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !8496
Diffstat (limited to 'Tests')
-rw-r--r--Tests/QtAutogen/AutoMocGeneratedFile/CMakeLists.txt23
-rw-r--r--Tests/QtAutogen/AutoMocGeneratedFile/main.cpp7
-rw-r--r--Tests/QtAutogen/Tests.cmake1
3 files changed, 31 insertions, 0 deletions
diff --git a/Tests/QtAutogen/AutoMocGeneratedFile/CMakeLists.txt b/Tests/QtAutogen/AutoMocGeneratedFile/CMakeLists.txt
new file mode 100644
index 0000000..ce129a9
--- /dev/null
+++ b/Tests/QtAutogen/AutoMocGeneratedFile/CMakeLists.txt
@@ -0,0 +1,23 @@
+cmake_minimum_required(VERSION 3.26)
+project(AutoMocGeneratedFile)
+
+include("../AutogenCoreTest.cmake")
+
+file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/myConfig.h
+ CONTENT
+ "
+#ifndef MYCONFIG_H
+#define MYCONFIG_H
+
+inline void foo() {}
+
+#endif
+
+"
+)
+
+add_executable(testTarget
+ main.cpp
+ ${CMAKE_CURRENT_BINARY_DIR}/myConfig.h)
+target_include_directories(testTarget PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
+set_property(TARGET testTarget PROPERTY AUTOMOC ON)
diff --git a/Tests/QtAutogen/AutoMocGeneratedFile/main.cpp b/Tests/QtAutogen/AutoMocGeneratedFile/main.cpp
new file mode 100644
index 0000000..e30d889
--- /dev/null
+++ b/Tests/QtAutogen/AutoMocGeneratedFile/main.cpp
@@ -0,0 +1,7 @@
+#include "myConfig.h"
+
+int main()
+{
+ foo();
+ return 0;
+}
diff --git a/Tests/QtAutogen/Tests.cmake b/Tests/QtAutogen/Tests.cmake
index 3e4f04d..7dd9c84 100644
--- a/Tests/QtAutogen/Tests.cmake
+++ b/Tests/QtAutogen/Tests.cmake
@@ -2,6 +2,7 @@
ADD_AUTOGEN_TEST(AutogenOriginDependsOff autogenOriginDependsOff)
ADD_AUTOGEN_TEST(AutogenOriginDependsOn)
ADD_AUTOGEN_TEST(AutogenTargetDepends)
+ADD_AUTOGEN_TEST(AutoMocGeneratedFile)
ADD_AUTOGEN_TEST(Complex QtAutogen)
ADD_AUTOGEN_TEST(GlobalAutogenSystemUseInclude)
ADD_AUTOGEN_TEST(GlobalAutogenTarget)