From 08d49cfee69e16383373af4ddcc03a82afe250d2 Mon Sep 17 00:00:00 2001 From: Orkun Tokdemir <ilhanorkuntokdemir@gmail.com> Date: Fri, 19 May 2023 16:26:41 +0200 Subject: Autogen: Add AUTOMOC test /w file(Generate) Fixes: #20382 --- .../QtAutogen/AutoMocGeneratedFile/CMakeLists.txt | 23 ++++++++++++++++++++++ Tests/QtAutogen/AutoMocGeneratedFile/main.cpp | 7 +++++++ Tests/QtAutogen/Tests.cmake | 1 + 3 files changed, 31 insertions(+) create mode 100644 Tests/QtAutogen/AutoMocGeneratedFile/CMakeLists.txt create mode 100644 Tests/QtAutogen/AutoMocGeneratedFile/main.cpp 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) -- cgit v0.12