Commit 6873e984 authored by Brad King's avatar Brad King Committed by Kitware Robot

Merge topic 'llvm-rc'

e53a968e MSVC: Use -D instead of /D in RC_FLAGS
1a281a1a RC: Pass output file in a way that llvm-rc 7 and below understand
fa339ced CMakeVersion.rc: Avoid preprocessor definitions to support llvm-rc
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Merge-request: !3007
parents 80898a49 e53a968e
...@@ -32,7 +32,7 @@ set(CMAKE_INCLUDE_FLAG_RC "-I") ...@@ -32,7 +32,7 @@ set(CMAKE_INCLUDE_FLAG_RC "-I")
# compile a Resource file into an object file # compile a Resource file into an object file
if(NOT CMAKE_RC_COMPILE_OBJECT) if(NOT CMAKE_RC_COMPILE_OBJECT)
set(CMAKE_RC_COMPILE_OBJECT set(CMAKE_RC_COMPILE_OBJECT
"<CMAKE_RC_COMPILER> <DEFINES> <INCLUDES> <FLAGS> /fo<OBJECT> <SOURCE>") "<CMAKE_RC_COMPILER> <DEFINES> <INCLUDES> <FLAGS> /fo <OBJECT> <SOURCE>")
endif() endif()
# set this variable so we can avoid loading this more than once. # set this variable so we can avoid loading this more than once.
......
...@@ -374,10 +374,12 @@ macro(__windows_compiler_msvc_enable_rc flags) ...@@ -374,10 +374,12 @@ macro(__windows_compiler_msvc_enable_rc flags)
set(CMAKE_RC_COMPILER_INIT rc) set(CMAKE_RC_COMPILER_INIT rc)
endif() endif()
if(NOT CMAKE_RC_FLAGS_INIT) 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() endif()
if(NOT CMAKE_RC_FLAGS_DEBUG_INIT) 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() endif()
enable_language(RC) enable_language(RC)
......
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */ file Copyright.txt or https://cmake.org/licensing for details. */
#define VER_FILEVERSION @CMake_RCVERSION@ 1 VERSIONINFO
#define VER_FILEVERSION_STR "@CMake_RCVERSION_STR@\0" FILEVERSION @CMake_RCVERSION@
PRODUCTVERSION @CMake_RCVERSION@
#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
BEGIN BEGIN
BLOCK "StringFileInfo" BLOCK "StringFileInfo"
BEGIN BEGIN
BLOCK "040904E4" BLOCK "040904E4"
BEGIN BEGIN
VALUE "FileVersion", VER_FILEVERSION_STR VALUE "FileVersion", "@CMake_RCVERSION_STR@\0"
VALUE "ProductVersion", VER_PRODUCTVERSION_STR VALUE "ProductVersion", "@CMake_RCVERSION_STR@\0"
END END
END END
......
...@@ -276,7 +276,7 @@ int main() ...@@ -276,7 +276,7 @@ int main()
std::string clrest = rest; std::string clrest = rest;
// rc: /fo x.dir\x.rc.res -> cl: /out:x.dir\x.rc.res.dep.obj // 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 "); clrest = replace(clrest, objfile, objfile + ".dep.obj ");
cl = "\"" + cl + "\" /P /DRC_INVOKED /TC "; cl = "\"" + cl + "\" /P /DRC_INVOKED /TC ";
......
...@@ -1831,7 +1831,8 @@ int cmVSLink::LinkIncremental() ...@@ -1831,7 +1831,8 @@ int cmVSLink::LinkIncremental()
// Compile the resource file. // Compile the resource file.
std::vector<std::string> rcCommand; std::vector<std::string> rcCommand;
rcCommand.push_back(this->RcPath.empty() ? "rc" : this->RcPath); 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); rcCommand.push_back(this->ManifestFileRC);
if (!RunCommand("RC Pass 1", rcCommand, this->Verbose, FORMAT_DECIMAL)) { if (!RunCommand("RC Pass 1", rcCommand, this->Verbose, FORMAT_DECIMAL)) {
return -1; return -1;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment