View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0015404CMakeCMakepublic2015-02-12 05:172015-07-08 08:57
ReporterGunnar Roth 
Assigned ToBrad King 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
Platformwindows ceOSwindows ceOS Versionall
Product VersionCMake 3.1.2 
Target VersionCMake 3.3Fixed in VersionCMake 3.3 
Summary0015404: cmake dos not set CMAKE_RC_FLAGS to include the platform defines like WIN32_WCE UNDER_CE etc.
Descriptionwhen people use things like
#idef UNDER_CE in the .rc files it is not recognised as being defined
because cmake dos not set CMAKE_RC_FLAGS to include the platform defines like WIN32_WCE UNDER_CE etc.


my proposal is to patch windows-msvc.cmake like this:
   set(_RTC1 "")
   set(_FLAGS_CXX " /GR /EHsc")
   set(CMAKE_C_STANDARD_LIBRARIES_INIT "coredll.lib ole32.lib oleaut32.lib uuid.lib commctrl.lib")
   set(CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} /NODEFAULTLIB:libc.lib /NODEFAULTLIB:oldnames.lib")
-
+ set(CMAKE_RC_FLAGS "${_PLATFORM_DEFINES} ${_PLATFORM_DEFINES_C}")
+
   if (MSVC_VERSION LESS 1600)
     set(CMAKE_C_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT} corelibc.lib")
   endif ()


i had the task to report this issue on my list for a very long time now.
finally done.
TagsNo tags attached.
Attached Files

 Relationships
related to 0014552closedBrad King testCCompiler for WinCE ARMV4I and NMake generator fails with linker error 

  Notes
(0037960)
Brad King (manager)
2015-02-12 13:07

Good catch. Unfortunately this may be a symptom of a larger problem. The CMAKE_<LANG>_FLAGS variables are supposed to be cache entries that the user can set locally. Platform information modules are supposed to initialize them by setting CMAKE_<LANG>_FLAGS_INIT. This is done for C and CXX with the platform definitions. However, the enable_language(RC) call appears before C or CXX is fully enabled or the platform definitions are computed, so CMAKE_RC_FLAGS_INIT has already been used to initialize CMAKE_RC_FLAGS.

Fixing this will require reorganizing the way RC gets auto-enabled by C or CXX to be delayed until after the platform definitions are known.
(0037961)
Brad King (manager)
2015-02-12 13:11

Re 0015404:0037960: Meanwhile you can work around the problem locally by setting CMAKE_RC_FLAGS in your cache to contain the proper definitions.
(0037962)
Gunnar Roth (reporter)
2015-02-12 13:25

hi brad,
setting this myself would be cumbersome because of many cmake base projects. i also do not want to know the correct values to set, this is cmake task ;-)

actually patching windows-msvc.cmake does the trick, we have cmake icheckin n our scs, and use this to build all the projects, so we can easily maintain patches to cmake module.

i now remember that tried CMAKE_RC_FLAGS_INIT as a natural way to solve the probem, but that did not work for the reason you wrote.

in a wide context this
+ set(CMAKE_RC_FLAGS "${_PLATFORM_DEFINES} ${_PLATFORM_DEFINES_C}")
maybe a hack, instead it should be
+ set(CMAKE_RC_FLAGS_INIT "${_PLATFORM_DEFINES} ${_PLATFORM_DEFINES_C}")
but i see n harm in doing it like that as it makes cmake unusable for wince because windows ce rc headers for mfc already use the #ifdef UNDER_CE , so get an error compiling rc files saying this is not for the desktop version of windows. when i make a workaround in one project this does not help other user of cmake. they will have some hard hours to figure the problem.

ok so maybe never use cmake with ce and mfc projects besides us...
(0038068)
Brad King (manager)
2015-02-25 11:40

I've re-ordered things so that CMAKE_RC_FLAGS_INIT can be set properly:

 RC: Drop unused CMAKE_COMPILE_RESOURCE variable setting
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1de4a0fb [^]

 RC: Enable language after C, CXX, or Fortran is enabled
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4300de3e [^]

 RC: Add platform-specific preprocessor definitions
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=772eae44 [^]
(0039064)
Robert Maynard (manager)
2015-07-08 08:57

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

 Issue History
Date Modified Username Field Change
2015-02-12 05:17 Gunnar Roth New Issue
2015-02-12 13:07 Brad King Note Added: 0037960
2015-02-12 13:11 Brad King Note Added: 0037961
2015-02-12 13:25 Gunnar Roth Note Added: 0037962
2015-02-13 09:47 Brad King Relationship added related to 0014552
2015-02-25 11:40 Brad King Note Added: 0038068
2015-02-25 11:41 Brad King Assigned To => Brad King
2015-02-25 11:41 Brad King Status new => resolved
2015-02-25 11:41 Brad King Resolution open => fixed
2015-02-25 11:41 Brad King Fixed in Version => CMake 3.3
2015-02-25 11:41 Brad King Target Version => CMake 3.3
2015-07-08 08:57 Robert Maynard Note Added: 0039064
2015-07-08 08:57 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team