chore(cpp): remove STRINGIFY macro

This commit is contained in:
Patryk Osmaczko 2022-06-30 19:24:31 +02:00 committed by Stefan Dunca
parent 9f9d0a4e87
commit 1cfc9dfd1e
3 changed files with 8 additions and 13 deletions

View File

@ -28,10 +28,10 @@ qt6_add_qml_module(${PROJECT_NAME}
)
# Compile time definitions required by the project
target_compile_definitions(${PROJECT_NAME} PRIVATE BUILD_PROJECT_NAME=${PROJECT_NAME})
target_compile_definitions(${PROJECT_NAME} PRIVATE BUILD_PROJECT_ORGANIZATION_DOMAIN=${PROJECT_ORGANIZATION_DOMAIN})
target_compile_definitions(${PROJECT_NAME} PRIVATE BUILD_PROJECT_ORGANIZATION_NAME=${PROJECT_ORGANIZATION_NAME})
target_compile_definitions(${PROJECT_NAME} PRIVATE BUILD_PROJECT_APPLICATION_NAME=${PROJECT_APPLICATION_NAME})
target_compile_definitions(${PROJECT_NAME} PRIVATE BUILD_PROJECT_NAME="${PROJECT_NAME}")
target_compile_definitions(${PROJECT_NAME} PRIVATE BUILD_PROJECT_ORGANIZATION_DOMAIN="${PROJECT_ORGANIZATION_DOMAIN}")
target_compile_definitions(${PROJECT_NAME} PRIVATE BUILD_PROJECT_ORGANIZATION_NAME="${PROJECT_ORGANIZATION_NAME}")
target_compile_definitions(${PROJECT_NAME} PRIVATE BUILD_PROJECT_APPLICATION_NAME="${PROJECT_APPLICATION_NAME}")
target_compile_definitions(${PROJECT_NAME} PRIVATE BUILD_BINARY_DIR=${CMAKE_BINARY_DIR})
target_compile_definitions(${PROJECT_NAME} PRIVATE BUILD_SOURCE_DIR=${CMAKE_SOURCE_DIR})

View File

@ -25,7 +25,7 @@ int main(int argc, char *argv[])
QTranslator translator;
const QStringList uiLanguages = QLocale::system().uiLanguages();
for (const QString &locale : uiLanguages) {
const QString baseName = STRINGIFY(BUILD_PROJECT_NAME) + QLocale(locale).name();
const QString baseName = BUILD_PROJECT_NAME + QLocale(locale).name();
if (translator.load(":/i18n/" + baseName)) {
app.installTranslator(&translator);
break;
@ -49,13 +49,13 @@ void setApplicationInformation(QGuiApplication& app) {
#if !defined BUILD_PROJECT_ORGANIZATION_NAME
static_assert(false, "Compile-time define missing: BUILD_PROJECT_ORGANIZATION_NAME")
#endif
app.setOrganizationName(STRINGIFY(BUILD_PROJECT_ORGANIZATION_NAME));
app.setOrganizationName(BUILD_PROJECT_ORGANIZATION_NAME);
#if !defined BUILD_PROJECT_ORGANIZATION_DOMAIN
static_assert(false, "Compile-time define missing: BUILD_PROJECT_ORGANIZATION_DOMAIN")
#endif
app.setOrganizationDomain(STRINGIFY(BUILD_PROJECT_ORGANIZATION_DOMAIN));
app.setOrganizationDomain(BUILD_PROJECT_ORGANIZATION_DOMAIN);
#if !defined BUILD_PROJECT_APPLICATION_NAME
static_assert(false, "Compile-time define missing: BUILD_PROJECT_APPLICATION_NAME")
#endif
app.setApplicationName(STRINGIFY(BUILD_PROJECT_APPLICATION_NAME));
app.setApplicationName(BUILD_PROJECT_APPLICATION_NAME);
}

View File

@ -12,8 +12,3 @@ constexpr bool isDebugBuild()
}
}
#if !defined STRINGIFY
#define STRINGIFY(X) STRIFY(X)
#define STRIFY(X) #X
#endif