Re: [cmake-developers] [PATCH] VS, WINCE: Fix entry point for Unicode builds
I think that would be the best approach. If you work on it, please ensure the implementation supports all Windows toolchains on all generators, or at least those combinations that already support WIN32_EXECUTABLE. I had a look trough the code. I found that the VS6 generator also sets the entry point for Windows CE (https://github.com/Kitware/CMake/blob/a11dda1c4883eddf763ba1eb2979b45220886b01/Source/cmLocalVisualStudio7Generator.cxx#L1313) But here it is set to wmain as default if Unicode is active. So for consistency reason I think the VS10 generator should do the same. This is also consistent with the case for Windows NT where the entry point is not set by CMake and wmain is automatically selected by VS if UNICODE is enabled This should be in addition to a WIN32_ENTRYPOINT property that the user can set to override the default. Pascal -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers
Re: [cmake-developers] [PATCH] VS, WINCE: Fix entry point for Unicode builds
Fixed typo in commit message: VS, WINCE: Fix entry point for Unicode builds http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=681cda02 I figured out that the combination /ENTRY:mainCRTStartup is also possible even if UNICODE is enabled. The question is now what should CMake do as default. 1) With the patch applied the behavior is as follows: The default entry points are mainCRTStartup (non Unicode) and mainWCRTStartup (for Unicode). So this means as soon as UNICODE is set the default Visual Studio is looking for wmain instead of main. If the user wants to change back to main he has to do something like this: set(CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS} /ENTRY:mainCRTStartup ) 2) Without my patch: The default entry point is mainCRTStartup (for both non Unicode and Unicode). So if UNICODE is set this doesn't change anything. If the user wants to use wmain he has to do something like this: set(CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS} /ENTRY:mainWCRTStartup ) I'm not sure what is better. I almost think the old behavior was better. The user should then be able to set the entry point independent of the UNICODE setting via a target property. This would be similar to how WIN32_EXECUTABLE selects WinMain as startup. Any thoughts on this? Pascal -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers
Re: [cmake-developers] [PATCH] VS, WINCE: Fix entry point for Unicode builds
On 12/09/2014 09:45 AM, Bach, Pascal wrote: the old behavior was better. The user should then be able to set the entry point independent of the UNICODE setting via a target property. This would be similar to how WIN32_EXECUTABLE selects WinMain as startup. Good catch. They are orthogonal settings. I've reverted the change: Revert VS, WINCE: Fix entry point for Unicode builds http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=df01a380 Unfortunately original change is in the v3.1.0-rc3 tag. This is why I don't like taking non-regression changes after the feature freeze for a release. I took it because I thought it was a bug in the new WinCE support. Now we need to revert it from the release branch too. Still, better than finding this after the release and needing a policy to fix it. Sorry for that. I thought of it as a bug too. Just after a discussion today with a colleague I realized it is not really the case. Is there a place where we could document things like this in the CMake documentation? Something like a platform specific collection of best practice and commonly required tasks. Maybe the Wiki would also be a good place for that. Pascal -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers
Re: [cmake-developers] [PATCH] VS, WINCE: Fix entry point for Unicode builds
On 12/09/2014 10:46 AM, Bach, Pascal wrote: Is there a place where we could document things like this in the CMake documentation? Something like a platform specific collection of best practice and commonly required tasks. The closest place to something like that is here: http://www.cmake.org/cmake/help/v3.1/manual/cmake-toolchains.7.html#cross-compiling-for-windows-ce However, in this case isn't a new target property needed to provide a clean way to set the entry point? That property would at least have the reference documentation. -Brad -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers
Re: [cmake-developers] [PATCH] VS, WINCE: Fix entry point for Unicode builds
On 12/09/2014 10:57 AM, Bach, Pascal wrote: set_target_properties(target PROPERTIES LINK_FLAGS /ENTRY:mainCRTStartup) I prefer to use LINK_FLAGS only as a last resort. For common settings we should provide a first-class setting. For consistency reason there could be something like a WIN32_ENTRYPOINT property. I think that would be the best approach. If you work on it, please ensure the implementation supports all Windows toolchains on all generators, or at least those combinations that already support WIN32_EXECUTABLE. Thanks, -Brad -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers
Re: [cmake-developers] [PATCH] VS, WINCE: Fix entry point for Unicode builds
On 12/02/2014 09:34 AM, Brad King wrote: VS, WINCE: Fix entry point for Unicode builds http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a4962595 Fixed typo in commit message: VS, WINCE: Fix entry point for Unicode builds http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=681cda02 -Brad -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers
[cmake-developers] [PATCH] VS, WINCE: Fix entry point for Unicode builds
When _UNICODE is defined VS uses wmain instead of main as the entry function. To make this correctly work on WindowsCE EntryPointSymbol needs to be set to mainWCRTStartup instead of mainWCRTStartup for console applications and to wWinMainCRTStartup instead of WinMainCRTStartup for GUI applications. Signed-off-by: Pascal Bach pascal.b...@siemens.com --- Source/cmVisualStudio10TargetGenerator.cxx | 18 -- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index f591fc8..f969b91 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -2268,7 +2268,14 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const config) linkOptions.AddFlag(SubSystem, WindowsCE); if (this-Target-GetType() == cmTarget::EXECUTABLE) { - linkOptions.AddFlag(EntryPointSymbol, WinMainCRTStartup); +if (this-ClOptions[config]-UsingUnicode()) +{ + linkOptions.AddFlag(EntryPointSymbol, wWinMainCRTStartup); +} +else +{ + linkOptions.AddFlag(EntryPointSymbol, WinMainCRTStartup); +} } } else @@ -2283,7 +2290,14 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const config) linkOptions.AddFlag(SubSystem, WindowsCE); if (this-Target-GetType() == cmTarget::EXECUTABLE) { - linkOptions.AddFlag(EntryPointSymbol, mainACRTStartup); + if (this-ClOptions[config]-UsingUnicode()) +{ + linkOptions.AddFlag(EntryPointSymbol, mainWCRTStartup); +} +else +{ + linkOptions.AddFlag(EntryPointSymbol, mainACRTStartup); +} } } else -- 1.7.10.4 -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers
Re: [cmake-developers] [PATCH] VS, WINCE: Fix entry point for Unicode builds
On 12/02/2014 07:33 AM, Pascal Bach wrote: When _UNICODE is defined VS uses wmain instead of main as the entry function. To make this correctly work on WindowsCE EntryPointSymbol needs to be set to mainWCRTStartup instead of mainWCRTStartup for console applications and to wWinMainCRTStartup instead of WinMainCRTStartup for GUI applications. Thanks, applied: VS, WINCE: Fix entry point for Unicode builds http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a4962595 -Brad -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers