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 <[email protected]>
---
 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

Reply via email to