View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0015013CMakeCMakepublic2014-07-10 12:052016-06-06 16:40
ReporterGunnar Roth 
Assigned ToBrad King 
PriorityurgentSeveritymajorReproducibilityalways
StatusclosedResolutionfixed 
Platformwec2013OSwec2013OS Version8.00
Product VersionCMake 3.0 
Target VersionCMake 3.1Fixed in VersionCMake 3.1 
Summary0015013: subsystem windowsce is not set for dll only for exes, this makes dll not loadable on wec2013 (wince8)
Descriptionthe subsystem switch for the linker is only set for executables but not for dlls.
this was no problem for ce < wec2013. but wec2013 checks for correct subsystem. you can see this informations using depends.exe from dependancywalker.com
Steps To Reproducecompile a project containg a dll with a wec2013 sdk. this dll will not be loaded on wec2013.
Additional Informationthis problem can be fixed with this simple patch:

--- a\share\cmake-3.0\Modules/Platform/Windows-MSVC.cmake
+++ b\share\cmake-3.0\Modules/Platform/Windows-MSVC.cmake
@@ -37,12 +37,13 @@
 endif()
 
 set(WIN32 1)
 
 if(CMAKE_SYSTEM_NAME MATCHES "WindowsCE")
- set(CMAKE_CREATE_WIN32_EXE "/subsystem:windowsce /entry:WinMainCRTStartup")
- set(CMAKE_CREATE_CONSOLE_EXE "/subsystem:windowsce /entry:mainACRTStartup")
+ set(CMAKE_CREATE_WIN32_EXE "/entry:WinMainCRTStartup")
+ set(CMAKE_CREATE_CONSOLE_EXE "/entry:mainACRTStartup")
+ set(CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} /subsystem:windowsce")
   set(WINCE 1)
 else()
   set(CMAKE_CREATE_WIN32_EXE "/subsystem:windows")
   set(CMAKE_CREATE_CONSOLE_EXE "/subsystem:console")
 endif()


CMAKE_EXE_LINKER_FLAGS_INIT is inherited by the dll settings but CMAKE_CREATE_WIN32_EXE or CMAKE_CREATE_CONSOLE_EXE is of course not.
TagsNo tags attached.
Attached Filespatch file icon 0001-MSVC-Fix-linking-of-DLLs-on-WinCE-15013.patch [^] (3,350 bytes) 2014-07-10 15:13 [Show Content]

 Relationships

  Notes
(0036346)
Brad King (manager)
2014-07-10 15:14

Thanks. Placing it in CMAKE_EXE_LINKER_FLAGS will break existing build trees whose cache entry does not already contain it. Since we must pass the flag to all linker calls we should just do so directly. Please try the attached "0001-MSVC-Fix-linking-of-DLLs-on-WinCE-15013.patch".
(0036349)
Gunnar Roth (reporter)
2014-07-10 16:00

OK this should also work.
I did not know cmake needs to support existing build trees when upgrading the cmake version. This is a hard to test feature methinks. Would it not be easier to Check version of the used cake in the build tree and on mismatch, trigger a complete regeneration? That seems more reliable to me.
(0036351)
Brad King (manager)
2014-07-10 16:17

I've applied the patch here:

 MSVC: Fix linking of DLLs on WinCE
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7e1283e4 [^]
(0036352)
Brad King (manager)
2014-07-10 16:19

Re 0015013:0036349: The language init and compiler detection is re-run for each new CMake version. However, we cannot overwrite or wipe out CMakeCache.txt entries that can be user-specified. CMAKE_EXE_LINKER_FLAGS is among those. There is no reason to let users modify/break addition of the subsystem flag for MSVC/WinCE anyway.
(0037583)
Robert Maynard (manager)
2015-01-05 08:39

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

 Issue History
Date Modified Username Field Change
2014-07-10 12:05 Gunnar Roth New Issue
2014-07-10 15:13 Brad King File Added: 0001-MSVC-Fix-linking-of-DLLs-on-WinCE-15013.patch
2014-07-10 15:14 Brad King Note Added: 0036346
2014-07-10 15:14 Brad King Assigned To => Brad King
2014-07-10 15:14 Brad King Status new => assigned
2014-07-10 15:14 Brad King Target Version => CMake 3.1
2014-07-10 16:00 Gunnar Roth Note Added: 0036349
2014-07-10 16:17 Brad King Note Added: 0036351
2014-07-10 16:19 Brad King Note Added: 0036352
2014-07-14 09:40 Brad King Status assigned => resolved
2014-07-14 09:40 Brad King Fixed in Version => CMake 3.1
2015-01-05 08:39 Robert Maynard Note Added: 0037583
2015-01-05 08:39 Robert Maynard Status resolved => closed
2016-06-06 16:40 Brad King Resolution open => fixed


Copyright © 2000 - 2018 MantisBT Team