[cmake-developers] [CMake 0014933]: CMake set wrong flags to RC compiler

Mantis Bug Tracker mantis at public.kitware.com
Sat May 24 15:29:03 EDT 2014


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=14933 
====================================================================== 
Reported By:                Mathäus Mendel
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   14933
Category:                   (No Category)
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2014-05-24 15:29 EDT
Last Modified:              2014-05-24 15:29 EDT
====================================================================== 
Summary:                    CMake set wrong flags to RC compiler
Description: 
The Microsoft Resource Compiler fails to compile any resource file that have an
#include directive. Generating the following error:

fatal error RC1015: cannot open include file '<filename>.h'.

Where <filename> is any file you may include.

Steps to Reproduce: 
On the CMakeLists.txt, add the following instruction:

add_definitions(-WX) # treat warnings as errors.

And create a target with a .rc file on it's source list.

Additional Information: 
CMake is passing the CXX/C compiler flags to the Resource Compiler, which it
should not.

On Modules/Platform/Windows-MSVC.cmake:59 

# make sure to enable languages after setting configuration types
enable_language(RC)
set(CMAKE_COMPILE_RESOURCE "rc <FLAGS> /fo<OBJECT> <SOURCE>")

The MSVC compiler flag -WX will tell the Resource compiler to "ignore the
INCLUDE env variable and warn on invalid code page", thus, breaking the build.

My recommendation is to remove the <FLAGS> from the directive, since all the
compiler flags are meaningless to the Resource compiler, and/or create a new one
that will directly reflect the user intention to change the RC compiler
behavior, like <RC_FLAGS>.
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2014-05-24 15:29 Mathäus Mendel New Issue                                    
2014-05-24 15:29 Mathäus Mendel File Added: cmake-rc-bug.zip                   

======================================================================



More information about the cmake-developers mailing list