cmake: Fix generated version resource file

This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2020-06-11 22:35:44 +02:00
parent 917a74e75e
commit 96d270ba73
2 changed files with 16 additions and 12 deletions

View file

@ -258,11 +258,11 @@ set(${PropertyPrefix}ENABLE_CLANG TRUE CACHE BOOL "Enable Clang integration for
# Configure Version Header # Configure Version Header
configure_file( configure_file(
"cmake/version.hpp.in" "cmake/version.hpp.in"
"${PROJECT_BINARY_DIR}/source/version.hpp" "${PROJECT_BINARY_DIR}/generated/version.hpp"
) )
configure_file( configure_file(
"cmake/module.cpp.in" "cmake/module.cpp.in"
"${PROJECT_BINARY_DIR}/source/module.cpp" "${PROJECT_BINARY_DIR}/generated/module.cpp"
) )
# Packaging # Packaging
@ -296,7 +296,7 @@ if(WIN32)
configure_file( configure_file(
"cmake/version.rc.in" "cmake/version.rc.in"
"${PROJECT_BINARY_DIR}/cmake/version.rc" "${PROJECT_BINARY_DIR}/generated/version.rc"
@ONLY @ONLY
) )
endif() endif()
@ -494,8 +494,8 @@ list(APPEND PROJECT_PRIVATE_SOURCE
"source/obs/obs-tools.cpp" "source/obs/obs-tools.cpp"
) )
list(APPEND PROJECT_PRIVATE_GENERATED list(APPEND PROJECT_PRIVATE_GENERATED
"${PROJECT_BINARY_DIR}/source/module.cpp" "${PROJECT_BINARY_DIR}/generated/module.cpp"
"${PROJECT_BINARY_DIR}/source/version.hpp" "${PROJECT_BINARY_DIR}/generated/version.hpp"
) )
if(WIN32) if(WIN32)
list(APPEND PROJECT_TEMPLATES list(APPEND PROJECT_TEMPLATES
@ -505,6 +505,9 @@ if(WIN32)
list(APPEND PROJECT_PRIVATE_SOURCE list(APPEND PROJECT_PRIVATE_SOURCE
"source/windll.cpp" "source/windll.cpp"
) )
list(APPEND PROJECT_PRIVATE_GENERATED
"${PROJECT_BINARY_DIR}/generated/version.rc"
)
endif() endif()
if((CMAKE_C_COMPILER_ID STREQUAL "GNU") if((CMAKE_C_COMPILER_ID STREQUAL "GNU")
OR (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") OR (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
@ -863,7 +866,7 @@ set(PROJECT_PRIVATE
source_group(TREE "${PROJECT_SOURCE_DIR}/data" PREFIX "Data Files" FILES ${PROJECT_DATA}) source_group(TREE "${PROJECT_SOURCE_DIR}/data" PREFIX "Data Files" FILES ${PROJECT_DATA})
source_group(TREE "${PROJECT_SOURCE_DIR}/source" PREFIX "Code Files" FILES ${PROJECT_PRIVATE_SOURCE}) source_group(TREE "${PROJECT_SOURCE_DIR}/source" PREFIX "Code Files" FILES ${PROJECT_PRIVATE_SOURCE})
source_group(TREE "${PROJECT_BINARY_DIR}/source" PREFIX "Generated Files" FILES ${PROJECT_PRIVATE_GENERATED}) source_group(TREE "${PROJECT_BINARY_DIR}/generated" PREFIX "Generated Files" FILES ${PROJECT_PRIVATE_GENERATED})
source_group(TREE "${PROJECT_SOURCE_DIR}/cmake" PREFIX "Template Files" FILES ${PROJECT_TEMPLATES}) source_group(TREE "${PROJECT_SOURCE_DIR}/cmake" PREFIX "Template Files" FILES ${PROJECT_TEMPLATES})
source_group(TREE "${PROJECT_SOURCE_DIR}/ui" PREFIX "User Interface Files" FILES ${PROJECT_UI}) source_group(TREE "${PROJECT_SOURCE_DIR}/ui" PREFIX "User Interface Files" FILES ${PROJECT_UI})
@ -886,7 +889,7 @@ set_target_properties(${PROJECT_NAME}
target_include_directories(${PROJECT_NAME} target_include_directories(${PROJECT_NAME}
PUBLIC PUBLIC
PRIVATE PRIVATE
"${PROJECT_BINARY_DIR}/source" "${PROJECT_BINARY_DIR}/generated"
"${PROJECT_SOURCE_DIR}/source" "${PROJECT_SOURCE_DIR}/source"
${PROJECT_INCLUDE_DIRS} ${PROJECT_INCLUDE_DIRS}
) )
@ -1004,7 +1007,7 @@ if(HAVE_OBS_FRONTEND)
AUTOUIC_SEARCH_PATHS "${PROJECT_SOURCE_DIR};${PROJECT_SOURCE_DIR}/ui" AUTOUIC_SEARCH_PATHS "${PROJECT_SOURCE_DIR};${PROJECT_SOURCE_DIR}/ui"
AUTOMOC TRUE AUTOMOC TRUE
AUTORCC TRUE AUTORCC TRUE
AUTOGEN_BUILD_DIR "${PROJECT_BINARY_DIR}/source" AUTOGEN_BUILD_DIR "${PROJECT_BINARY_DIR}/generated"
AUTOGEN_SOURCE_GROUP "Qt Files" AUTOGEN_SOURCE_GROUP "Qt Files"
) )
endif() endif()

View file

@ -1,12 +1,13 @@
#pragma code_page(65001) #pragma code_page(65001)
#include <windows.h> #include <windows.h>
#include <winver.h> #include <winver.h>
#define VER_FILEVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,@PROJECT_VERSION_PATCH@,@PROJECT_VERSION_TWEAK@ #define VER_FILEVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,@PROJECT_VERSION_PATCH@,@PROJECT_VERSION_TWEAK@
#define VER_FILEVERSION_STR "@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@.@PROJECT_VERSION_TWEAK@\0" #define VER_FILEVERSION_STR "@VERSION_STRING@\0"
#define VER_PRODUCTVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,@PROJECT_VERSION_PATCH@,@PROJECT_VERSION_TWEAK@ #define VER_PRODUCTVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,@PROJECT_VERSION_PATCH@,@PROJECT_VERSION_TWEAK@
#define VER_PRODUCTVERSION_STR "@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@.@PROJECT_VERSION_TWEAK@\0" #define VER_PRODUCTVERSION_STR "@VERSION_STRING@\0"
#ifndef DEBUG #ifndef DEBUG
#define VER_DEBUG 0 #define VER_DEBUG 0