View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
0014933 | CMake | (No Category) | public | 2014-05-24 15:29 | 2014-11-03 08:38 | ||||
Reporter | Mathäus Mendel | ||||||||
Assigned To | |||||||||
Priority | normal | Severity | minor | Reproducibility | always | ||||
Status | closed | Resolution | no change required | ||||||
Platform | Visual Studio (NMake) | OS | Windows | OS Version | Any | ||||
Product Version | CMake 2.8.12.2 | ||||||||
Target Version | Fixed in Version | ||||||||
Summary | 0014933: 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>. | ||||||||
Tags | No tags attached. | ||||||||
Attached Files | ![]() | ||||||||
Relationships | |
Relationships |
Notes | |
(0035927) Mathäus Mendel (reporter) 2014-05-24 15:46 |
The bug is also reproducible with CMake 3.0rc6. |
(0035942) Brad King (manager) 2014-05-27 10:06 |
We have a filter for flags added to rc invocations. See CMAKE_RC_FLAG_REGEX here: http://cmake.org/gitweb?p=cmake.git;a=blob;f=Modules/CMakeRCInformation.cmake;hb=v3.0.0-rc6#l36 [^] However, it looks like the filter is not enforced for the add_definitions command, perhaps because that was intended for preprocessor definitions. The filter works on the COMPILE_FLAGS target property. CMake 2.8.12 and above have a COMPILE_OPTIONS target property that also obeys the filter. One can use the add_compile_options command instead: cmake_minimum_required(VERSION 2.8.12) project(cmake-rc-bug) add_compile_options(-WX) add_executable(${PROJECT_NAME} main.cpp bug.rc) |
(0035950) Mathäus Mendel (reporter) 2014-05-27 18:47 |
Well, it seems there is no easy way to avoid this issue when using add_definitions to pass flags directly to the compiler. I think this issue can be closed. Thanks for helping. :) |
(0037144) Robert Maynard (manager) 2014-11-03 08:38 |
Closing resolved issues that have not been updated in more than 4 months. |
Notes |
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 | |
2014-05-24 15:46 | Mathäus Mendel | Note Added: 0035927 | |
2014-05-27 10:06 | Brad King | Note Added: 0035942 | |
2014-05-27 18:47 | Mathäus Mendel | Note Added: 0035950 | |
2014-05-28 08:32 | Brad King | Status | new => resolved |
2014-05-28 08:32 | Brad King | Resolution | open => no change required |
2014-11-03 08:38 | Robert Maynard | Note Added: 0037144 | |
2014-11-03 08:38 | Robert Maynard | Status | resolved => closed |
Issue History |
Copyright © 2000 - 2018 MantisBT Team |