View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0014865CMakeCMakepublic2014-04-07 17:422014-10-06 10:33
ReporterKai Pastor 
Assigned ToBrad King 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionCMake 3.0Fixed in VersionCMake 3.0 
Summary0014865: CMakeDetermineRCCompiler does not detect windres from "i686-w64-mingw32.shared-windres"
DescriptionCMakeDetermineRCCompiler.cmake uses the name without ending for identifying windres:

GET_FILENAME_COMPONENT(CMAKE_BASE_NAME ${CMAKE_RC_COMPILER} NAME_WE)
IF("${CMAKE_BASE_NAME}" MATCHES "windres")
  SET(CMAKE_BASE_NAME "windres")
ENDIF()

This code fails to detect windres when the filename contains the period in the prefix. This is the case e.g. when using a shared-lib cross compilation toolchain from mxe.cc (development version) where windres is named i686-w64-mingw32.shared-windres.

I see that in general the ending needs to be removed from the filename. However, for detecting windres the full filename should be matched.
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0035657)
Brad King (manager)
2014-04-08 13:22

I don't think the extension needs to be stripped at all. It will not interfere with matching "windres" as a regex. Please try:

-GET_FILENAME_COMPONENT(CMAKE_BASE_NAME ${CMAKE_RC_COMPILER} NAME_WE)
+GET_FILENAME_COMPONENT(CMAKE_BASE_NAME ${CMAKE_RC_COMPILER} NAME)
(0035658)
Kai Pastor (reporter)
2014-04-08 15:20

I'm very sorry but I somehow missed the point when I created and named the ticket.

The critical section is in CMakeRCInformation.cmake (which claims to set the basic flags for the Fortran language in CMake, BTW):

get_filename_component(CMAKE_BASE_NAME ${CMAKE_RC_COMPILER} NAME_WE)
if("${CMAKE_BASE_NAME}" MATCHES "windres")
  set(CMAKE_BASE_NAME "windres")
endif()
set(CMAKE_SYSTEM_AND_RC_COMPILER_INFO_FILE
  ${CMAKE_ROOT}/Modules/Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}.cmake)
include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL)

What goes wrong for i686-w64-mingw32.shared-windres is including Platform/Windows-windres.cmake which would set the correct CMAKE_RC_COMPILE_OBJECT.

(The reason why I think you may still want to strip the extension is that there might be some other Platform/Windows-ResourceCompiler.cmake which shall be used for ResourceCompiler.exe CMAKE_RC_COMPILER.)
(0035659)
Brad King (manager)
2014-04-08 15:37

Okay, here is another quick patch (untested):

-get_filename_component(CMAKE_BASE_NAME ${CMAKE_RC_COMPILER} NAME_WE)
-if("${CMAKE_BASE_NAME}" MATCHES "windres")
- set(CMAKE_BASE_NAME "windres")
-endif()
+if(CMAKE_RC_COMPILER MATCHES "windres[^/]*$")
+ set(CMAKE_BASE_NAME "windres")
+else()
+ get_filename_component(CMAKE_BASE_NAME ${CMAKE_RC_COMPILER} NAME_WE)
+endif()
(0035661)
Kai Pastor (reporter)
2014-04-09 16:24

I tested the proposed change to CMakeRCInformation.cmake, and it solves the problem.

(And again, this file's comments reference Fortran...)
(0035665)
Brad King (manager)
2014-04-10 10:21

Patches applied:

 CMakeRCInformation: Do not mention 'Fortran' in documentation
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=96bc9ecb [^]

 CMakeRCInformation: Recognize 'windres' tools with '.' in name (0014865)
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=613666e1 [^]
(0035675)
Brad King (manager)
2014-04-11 09:14

Patches backported on v3.0.0-rc3:

 CMakeRCInformation: Do not mention 'Fortran' in documentation
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=db924e00 [^]

 CMakeRCInformation: Recognize 'windres' tools with '.' in name
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7147ed5c [^]

They will be included in v3.0.0-rc4.
(0036967)
Robert Maynard (manager)
2014-10-06 10:33

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2014-04-07 17:42 Kai Pastor New Issue
2014-04-08 13:22 Brad King Note Added: 0035657
2014-04-08 15:20 Kai Pastor Note Added: 0035658
2014-04-08 15:37 Brad King Note Added: 0035659
2014-04-09 16:24 Kai Pastor Note Added: 0035661
2014-04-10 10:21 Brad King Note Added: 0035665
2014-04-10 10:21 Brad King Assigned To => Brad King
2014-04-10 10:21 Brad King Status new => resolved
2014-04-10 10:21 Brad King Resolution open => fixed
2014-04-10 10:21 Brad King Fixed in Version => CMake 3.1
2014-04-10 10:21 Brad King Target Version => CMake 3.1
2014-04-11 09:14 Brad King Note Added: 0035675
2014-04-11 09:14 Brad King Fixed in Version CMake 3.1 => CMake 3.0
2014-04-11 09:14 Brad King Target Version CMake 3.1 => CMake 3.0
2014-10-06 10:33 Robert Maynard Note Added: 0036967
2014-10-06 10:33 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team