diff --git a/.gitignore b/.gitignore index 35fb673a..11c86845 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,4 @@ vcpkg_installed/ .DS_Store *.db CMakeUserPresets.json +cmake/windows.rc \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 1c009a13..2779e876 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,6 +39,12 @@ string(REGEX MATCH "#define GVIEW_VERSION \"([0-9]+.[0-9]+.[0-9]+)\"" _ ${GView_ set(GVIEW_VERSION ${CMAKE_MATCH_1}) message("${PROJECT_NAME} version: ${GVIEW_VERSION}") +if (MSVC) + set(GVIEW_RESOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/cmake/windows.rc") + message("Setting version to ${GVIEW_RESOURCE_FILES}") + configure_file("cmake/windows.rc.in" ${GVIEW_RESOURCE_FILES} @ONLY) +endif() + set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_CURRENT_SOURCE_DIR}/cmake") include(core_testing) diff --git a/GView/CMakeLists.txt b/GView/CMakeLists.txt index c49674b9..7fe82900 100644 --- a/GView/CMakeLists.txt +++ b/GView/CMakeLists.txt @@ -32,3 +32,8 @@ if (APPLE) RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/../bin/${CMAKE_BUILD_TYPE}") endif() endif() + +if(DEFINED GVIEW_RESOURCE_FILES) + message("Adding resource files to project: ${PROJECT_NAME}") + target_sources(${PROJECT_NAME} PRIVATE ${GVIEW_RESOURCE_FILES}) +endif() \ No newline at end of file diff --git a/GViewCore/CMakeLists.txt b/GViewCore/CMakeLists.txt index 8313e215..27a7c1ca 100644 --- a/GViewCore/CMakeLists.txt +++ b/GViewCore/CMakeLists.txt @@ -125,3 +125,8 @@ if (APPLE) RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/../bin/${CMAKE_BUILD_TYPE}") endif() endif() + +if(DEFINED GVIEW_RESOURCE_FILES) + message("Adding resource files to project: ${PROJECT_NAME}") + target_sources(${PROJECT_NAME} PRIVATE ${GVIEW_RESOURCE_FILES}) +endif() \ No newline at end of file diff --git a/cmake/windows.rc.in b/cmake/windows.rc.in new file mode 100644 index 00000000..aefcd3b0 --- /dev/null +++ b/cmake/windows.rc.in @@ -0,0 +1,30 @@ +VS_VERSION_INFO VERSIONINFO + FILEVERSION 0,0,0,0 + PRODUCTVERSION 0,0,0,0 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x2L + FILESUBTYPE 0x0L +{ + BLOCK "StringFileInfo" + { + BLOCK "040904E4" + { + VALUE "CompanyName", "GView Group (2021-2024)" + VALUE "FileDescription", "GView Framework library" + VALUE "FileVersion", "@GVIEW_VERSION@" + VALUE "ProductVersion", "@GVIEW_VERSION@" + VALUE "LegalCopyright", "Copyright various authors. Released under the MIT License." + VALUE "ProductName", "GView" + } + } + BLOCK "VarFileInfo" + { + VALUE "Translation", 0x0409, 1252 + } +} \ No newline at end of file