[cmake-developers] [patch] handle RC files as resources

Tim Blechmann tim at klingt.org
Fri Jun 6 09:48:44 EDT 2014


>> i've came across, that .rc files are treated as windows resources, but
>> not upper-case .RC files. attached patch tries to correct this. it is a
>> functional change, though it brings the implementation in line with
>> Modules/CMakeCXXCompiler.cmake.in and the like.
>>
>> would be great if someone could review and/or commit it.
> 
> The cmSystemTools::GetFileFormat is supposed to have been replaced
> by cmSourceFile::GetLanguage and cmGeneratorTarget source classification
> logic that uses the tables like that in CMakeCXXCompiler.
> 
> The only cmSystemTools::GetFileFormat call site I see left is in
> cmQtAutoGenerators::SetupSourceFiles, and that does not care about
> RESOURCE_FILE_FORMAT.  In what context does your patch affect anything?

hmmm, then this probably got shadowed in my project when setting the
source file language directly :/

does this look better? (cannot test atm, as i'm on a different machine)

thx,
tim

-------------- next part --------------
>From e42b5ee3979c0b2e9b72d737c858830a865174ca Mon Sep 17 00:00:00 2001
From: Tim Blechmann <tim at klingt.org>
Date: Fri, 6 Jun 2014 15:47:29 +0200
Subject: [PATCH] CMakeRCCompiler: handle RC as resource file format extension

.RC files are not recorgnized as resource files by GetFileFormat, though
the CMakeLangCompiler.cmake.in files list this file extension:

Modules/CMakeCXXCompiler.cmake.in:
set(CMAKE_CXX_IGNORE_EXTENSIONS inl;h;hpp;HPP;H;o;O;obj;OBJ;def;DEF;rc;RC)

this patch resolve this inconsistency

Signed-off-by: Tim Blechmann <tim at klingt.org>
---
 Modules/CMakeRCCompiler.cmake.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Modules/CMakeRCCompiler.cmake.in b/Modules/CMakeRCCompiler.cmake.in
index 0fc3142..8257cd6 100644
--- a/Modules/CMakeRCCompiler.cmake.in
+++ b/Modules/CMakeRCCompiler.cmake.in
@@ -1,6 +1,6 @@
 set(CMAKE_RC_COMPILER "@CMAKE_RC_COMPILER@")
 set(CMAKE_RC_COMPILER_ARG1 "@CMAKE_RC_COMPILER_ARG1@")
 set(CMAKE_RC_COMPILER_LOADED 1)
-set(CMAKE_RC_SOURCE_FILE_EXTENSIONS rc)
+set(CMAKE_RC_SOURCE_FILE_EXTENSIONS rc;RC)
 set(CMAKE_RC_OUTPUT_EXTENSION @CMAKE_RC_OUTPUT_EXTENSION@)
 set(CMAKE_RC_COMPILER_ENV_VAR "RC")
-- 
2.0.0



More information about the cmake-developers mailing list