Files
cmake/Tests/QtAutogen/RccObjectLibrary/main.cpp
T
Joerg Bornemann d05bb5e3c7 Autogen: Fix AUTOGEN_BETTER_GRAPH_MULTI_CONFIG with VS generators
Use config-specific filenames instead of subdirectories to avoid object
file path mismatches in Visual Studio OBJECT libraries. The new paths
are consistent with how AUTOMOC generates .cpp files.

Add QtAutogen test RccObjectLibrary that fails without this patch.

Adjust the GlobalAutogenTarget test to the new paths.

Fixes: #26977
2026-01-29 08:30:57 +01:00

39 lines
919 B
C++

#include <iostream>
#include <QCoreApplication>
#include <QFile>
#include "rcc_obj.h"
int main(int argc, char* argv[])
{
QCoreApplication app(argc, argv);
// Test that the resource from the OBJECT library is accessible
QString resourcePath = RccObj::resourceContent();
if (!QFile::exists(resourcePath)) {
std::cerr << "Resource not found: " << resourcePath.toStdString()
<< std::endl;
return 1;
}
QFile file(resourcePath);
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
std::cerr << "Failed to open resource: " << resourcePath.toStdString()
<< std::endl;
return 1;
}
QString content = file.readAll();
if (content.isEmpty()) {
std::cerr << "Resource content is empty" << std::endl;
return 1;
}
std::cout << "Resource content: " << content.toStdString() << std::endl;
std::cout << "Test passed!" << std::endl;
return 0;
}