summaryrefslogtreecommitdiffstats
path: root/Tests/QtAutogen
diff options
context:
space:
mode:
authorOrkun Tokdemir <ilhanorkuntokdemir@gmail.com>2023-05-19 14:26:41 (GMT)
committerOrkun Tokdemir <ilhanorkuntokdemir@gmail.com>2023-05-19 14:28:51 (GMT)
commit08d49cfee69e16383373af4ddcc03a82afe250d2 (patch)
treeee68302f2c9f32a93769223de11ec960f1a7f4ee /Tests/QtAutogen
parent9a7ce875c83779b7eb1a047d353c40e83d7e13c8 (diff)
downloadCMake-08d49cfee69e16383373af4ddcc03a82afe250d2.zip
CMake-08d49cfee69e16383373af4ddcc03a82afe250d2.tar.gz
CMake-08d49cfee69e16383373af4ddcc03a82afe250d2.tar.bz2
Autogen: Add AUTOMOC test /w file(Generate)
Fixes: #20382
Diffstat (limited to 'Tests/QtAutogen')
-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)