From fa339ced67d14bb608b2a71c37c3b99d90941d47 Mon Sep 17 00:00:00 2001 From: Zsolt Parragi Date: Fri, 22 Feb 2019 19:22:28 +0100 Subject: CMakeVersion.rc: Avoid preprocessor definitions to support llvm-rc `llvm-rc` does not support them as of version 8. --- Source/CMakeVersion.rc.in | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/Source/CMakeVersion.rc.in b/Source/CMakeVersion.rc.in index 22b4a36..762d9bb 100644 --- a/Source/CMakeVersion.rc.in +++ b/Source/CMakeVersion.rc.in @@ -1,25 +1,16 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#define VER_FILEVERSION @CMake_RCVERSION@ -#define VER_FILEVERSION_STR "@CMake_RCVERSION_STR@\0" - -#define VER_PRODUCTVERSION @CMake_RCVERSION@ -#define VER_PRODUCTVERSION_STR "@CMake_RCVERSION_STR@\0" - -/* Version-information resource identifier. */ -#define VS_VERSION_INFO 1 - -VS_VERSION_INFO VERSIONINFO -FILEVERSION VER_FILEVERSION -PRODUCTVERSION VER_PRODUCTVERSION +1 VERSIONINFO +FILEVERSION @CMake_RCVERSION@ +PRODUCTVERSION @CMake_RCVERSION@ BEGIN BLOCK "StringFileInfo" BEGIN BLOCK "040904E4" BEGIN - VALUE "FileVersion", VER_FILEVERSION_STR - VALUE "ProductVersion", VER_PRODUCTVERSION_STR + VALUE "FileVersion", "@CMake_RCVERSION_STR@\0" + VALUE "ProductVersion", "@CMake_RCVERSION_STR@\0" END END -- cgit v0.12 From 1a281a1acdcce3d6ce5a2a37fc4e0f6ab77ff0c3 Mon Sep 17 00:00:00 2001 From: Zsolt Parragi Date: Thu, 21 Feb 2019 20:00:38 +0100 Subject: RC: Pass output file in a way that llvm-rc 7 and below understand Prior to LLVM 8.0, `llvm-rc` does not recognize `/fo` without a space after it. Add the space unconditionally because MS `rc` accepts it too. Issue: #18957 --- Modules/CMakeRCInformation.cmake | 2 +- Source/cmcldeps.cxx | 2 +- Source/cmcmd.cxx | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Modules/CMakeRCInformation.cmake b/Modules/CMakeRCInformation.cmake index 1227fdf..7bf6567 100644 --- a/Modules/CMakeRCInformation.cmake +++ b/Modules/CMakeRCInformation.cmake @@ -32,7 +32,7 @@ set(CMAKE_INCLUDE_FLAG_RC "-I") # compile a Resource file into an object file if(NOT CMAKE_RC_COMPILE_OBJECT) set(CMAKE_RC_COMPILE_OBJECT - " /fo ") + " /fo ") endif() # set this variable so we can avoid loading this more than once. diff --git a/Source/cmcldeps.cxx b/Source/cmcldeps.cxx index 1a10666..19d0d38 100644 --- a/Source/cmcldeps.cxx +++ b/Source/cmcldeps.cxx @@ -276,7 +276,7 @@ int main() std::string clrest = rest; // rc: /fo x.dir\x.rc.res -> cl: /out:x.dir\x.rc.res.dep.obj - clrest = replace(clrest, "/fo", "/out:"); + clrest = replace(clrest, "/fo ", "/out:"); clrest = replace(clrest, objfile, objfile + ".dep.obj "); cl = "\"" + cl + "\" /P /DRC_INVOKED /TC "; diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index adfce37..28f5e08 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -1830,7 +1830,8 @@ int cmVSLink::LinkIncremental() // Compile the resource file. std::vector rcCommand; rcCommand.push_back(this->RcPath.empty() ? "rc" : this->RcPath); - rcCommand.push_back("/fo" + this->ManifestFileRes); + rcCommand.emplace_back("/fo"); + rcCommand.push_back(this->ManifestFileRes); rcCommand.push_back(this->ManifestFileRC); if (!RunCommand("RC Pass 1", rcCommand, this->Verbose, FORMAT_DECIMAL)) { return -1; -- cgit v0.12 From e53a968ed582e28522b65c0f4ca00741294425b8 Mon Sep 17 00:00:00 2001 From: Zsolt Parragi Date: Fri, 1 Mar 2019 14:11:01 +0100 Subject: MSVC: Use -D instead of /D in RC_FLAGS llvm-rc can't handle definitions given with /D and without a space. --- Modules/Platform/Windows-MSVC.cmake | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake index 2daf313..0e11790 100644 --- a/Modules/Platform/Windows-MSVC.cmake +++ b/Modules/Platform/Windows-MSVC.cmake @@ -374,10 +374,12 @@ macro(__windows_compiler_msvc_enable_rc flags) set(CMAKE_RC_COMPILER_INIT rc) endif() if(NOT CMAKE_RC_FLAGS_INIT) - string(APPEND CMAKE_RC_FLAGS_INIT " ${flags}") + # llvm-rc fails when flags are specified with /D and no space after + string(REPLACE " /D" " -D" fixed_flags " ${flags}") + string(APPEND CMAKE_RC_FLAGS_INIT " ${fixed_flags}") endif() if(NOT CMAKE_RC_FLAGS_DEBUG_INIT) - string(APPEND CMAKE_RC_FLAGS_DEBUG_INIT " /D_DEBUG") + string(APPEND CMAKE_RC_FLAGS_DEBUG_INIT " -D_DEBUG") endif() enable_language(RC) -- cgit v0.12