View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0015088CMakeCMakepublic2014-08-14 17:452016-06-10 14:31
ReporterFrank Miller 
Assigned ToKitware Robot 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionmoved 
PlatformOSWindowsOS Version7
Product VersionCMake 3.0.1 
Target VersionFixed in Version 
Summary0015088: Ninja generator makes an invalid RC_COMPILER rule
DescriptionWhen the project() command is used without C language support as in project(myproj CXX), the ninja generator will create a rules.ninja file with an empty string where cmcldeps.exe should be. Something like the following:

    rule RC_COMPILER
      depfile = $DEP_FILE
      deps = gcc
      command = "" RC $in "$DEP_FILE" $out "Note: including file: " "c:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/cl.exe" c:\PROGRA~2\WI3CF2~1\8.1\bin\x86\rc.exe $FLAGS $DEFINES /fo$out $in
      description = Building RC object $out

Steps To ReproduceThe following patch will cause the MFC test to fail

diff --git a/Tests/MFC/CMakeLists.txt.in b/Tests/MFC/CMakeLists.txt.in
index e6bfabd..c1d0754 100644
--- a/Tests/MFC/CMakeLists.txt.in
+++ b/Tests/MFC/CMakeLists.txt.in
@@ -1,5 +1,5 @@
 cmake_minimum_required(VERSION 2.8)
-project(mfc1)
+project(mfc1 CXX)

 macro(replace_flags var these those)
   if("${${var}}" MATCHES "${these}")
Additional InformationThis used to work in cmake 2.8.
TagsNo tags attached.
Attached Files

 Relationships
has duplicate 0015711closed Ninja cannot build resource file 

  Notes
(0039329)
A. Klitzing (reporter)
2015-08-26 09:38

I had the same problem...

http://public.kitware.com/Bug/view.php?id=15711 [^]
(0039335)
Brad King (manager)
2015-08-27 09:04

For reference, see 0015711:0039328 in a duplicate of this issue for an explanation.
(0039338)
Brad King (manager)
2015-08-27 10:39

From 0015711:0039328:
> Ok, I found the problem.
>
> http://www.cmake.org/gitweb?p=cmake.git;a=blob_plain;f=Modules/CMakeClDeps.cmake [^]
>
> It will check and use CMAKE_C_COMPILER only. But there is no
> CMAKE_C_COMPILER for a CXX project. If I change it here in
> CMakeClDeps to CMAKE_CXX_COMPILER it works! Of course... it must
> work for both. ;-)

The CMakeClDeps module is included by "Modules/CMakeDetermine{C,CXX}Compiler.cmake" but hard-codes CMAKE_C_COMPILER as you point out. It needs to be refactored to run once for either C or CXX depending on which is enabled first.
(0040593)
Beom Koh (reporter)
2016-03-03 15:30

Is there a plan to address this issue?
(0040594)
Beom Koh (reporter)
2016-03-03 16:00

I just found that my cmcldeps.exe is generating the resource file in the source tree not the binary tree. Also it has a wrong name. (generated resource file is called "FILENAME.RES" but ninja is failing with the following error "LINK : fatal error LNK1181: cannot open input file 'sft\Mod1\utils\CMakeFiles\Moud1UtilGUI.dir\DiagGui\res\FILENAME.rc.res'"

If I copy "FILENAME.RES" manually to the above folder from source tree with renaming it to "FILENAME.rc.res", the build works.
(0040636)
Brad King (manager)
2016-03-07 11:11

The problem described in 0015088:0039338 has been addressed as of CMake 3.4 with changes linked in 0015596:0039440. As of 3.5.0-rc3 the MFC test passes for me even with the hack listed in the description here:

  -project(mfc1)
  +project(mfc1 CXX)

I also see the .res file in the right place.

Re 0015088:0040594: What version of CMake are you running and observing the file in the wrong place?
(0042608)
Kitware Robot (administrator)
2016-06-10 14:29

Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.

 Issue History
Date Modified Username Field Change
2014-08-14 17:45 Frank Miller New Issue
2015-08-26 09:38 A. Klitzing Note Added: 0039329
2015-08-27 09:03 Brad King Relationship added has duplicate 0015711
2015-08-27 09:04 Brad King Note Added: 0039335
2015-08-27 10:39 Brad King Note Added: 0039338
2016-03-03 15:30 Beom Koh Note Added: 0040593
2016-03-03 16:00 Beom Koh Note Added: 0040594
2016-03-07 11:11 Brad King Note Added: 0040636
2016-06-10 14:29 Kitware Robot Note Added: 0042608
2016-06-10 14:29 Kitware Robot Status new => resolved
2016-06-10 14:29 Kitware Robot Resolution open => moved
2016-06-10 14:29 Kitware Robot Assigned To => Kitware Robot
2016-06-10 14:31 Kitware Robot Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team