The flags /SUBSYSTEM and /ENTRY are set by Windows-MSVC.cmake depending on the system. Howver these values never ended up in the resulting VS solution.
This is fixed by reading the values of CMAKE_CREATE_WIN32_EXE and CMAKE_CREATE_CONSOLE_EXE and propagates theses to the resulting XML. --- Source/cmVS11LinkFlagTable.h | 2 ++ Source/cmVS12LinkFlagTable.h | 2 ++ Source/cmVS14LinkFlagTable.h | 2 ++ Source/cmVisualStudio10TargetGenerator.cxx | 19 ++++++++++--------- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/Source/cmVS11LinkFlagTable.h b/Source/cmVS11LinkFlagTable.h index 0f641e4..765dbcf 100644 --- a/Source/cmVS11LinkFlagTable.h +++ b/Source/cmVS11LinkFlagTable.h @@ -56,6 +56,8 @@ static cmVS7FlagTable cmVS11LinkFlagTable[] = "EFI ROM", "EFI ROM", 0}, {"SubSystem", "SUBSYSTEM:EFI_RUNTIME_DRIVER", "EFI Runtime", "EFI Runtime", 0}, + {"SubSystem", "SUBSYSTEM:WINDOWSCE", + "WindowsCE", "WindowsCE", 0}, {"SubSystem", "SUBSYSTEM:POSIX", "POSIX", "POSIX", 0}, diff --git a/Source/cmVS12LinkFlagTable.h b/Source/cmVS12LinkFlagTable.h index e5a570e..ca68c7e 100644 --- a/Source/cmVS12LinkFlagTable.h +++ b/Source/cmVS12LinkFlagTable.h @@ -56,6 +56,8 @@ static cmVS7FlagTable cmVS12LinkFlagTable[] = "EFI ROM", "EFI ROM", 0}, {"SubSystem", "SUBSYSTEM:EFI_RUNTIME_DRIVER", "EFI Runtime", "EFI Runtime", 0}, + {"SubSystem", "SUBSYSTEM:WINDOWSCE", + "WindowsCE", "WindowsCE", 0}, {"SubSystem", "SUBSYSTEM:POSIX", "POSIX", "POSIX", 0}, diff --git a/Source/cmVS14LinkFlagTable.h b/Source/cmVS14LinkFlagTable.h index 6d81d12..67ddbe3 100644 --- a/Source/cmVS14LinkFlagTable.h +++ b/Source/cmVS14LinkFlagTable.h @@ -56,6 +56,8 @@ static cmVS7FlagTable cmVS14LinkFlagTable[] = "EFI ROM", "EFI ROM", 0}, {"SubSystem", "SUBSYSTEM:EFI_RUNTIME_DRIVER", "EFI Runtime", "EFI Runtime", 0}, + {"SubSystem", "SUBSYSTEM:WINDOWSCE", + "WindowsCE", "WindowsCE", 0}, {"SubSystem", "SUBSYSTEM:POSIX", "POSIX", "POSIX", 0}, diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index c525b7c..1c2a7be 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -2041,6 +2041,16 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config) flags += " "; flags += flagsConfig; } + if (this->Target->GetPropertyAsBool("WIN32_EXECUTABLE")) + { + flags += " "; + flags += this->Target->GetMakefile()->GetSafeDefinition("CMAKE_CREATE_WIN32_EXE"); + } + else + { + flags += " "; + flags += this->Target->GetMakefile()->GetSafeDefinition("CMAKE_CREATE_CONSOLE_EXE"); + } std::string standardLibsVar = "CMAKE_"; standardLibsVar += linkLanguage; standardLibsVar += "_STANDARD_LIBRARIES"; @@ -2113,15 +2123,6 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config) { linkOptions.AddFlag("Version", ""); - if ( this->Target->GetPropertyAsBool("WIN32_EXECUTABLE") ) - { - linkOptions.AddFlag("SubSystem", "Windows"); - } - else - { - linkOptions.AddFlag("SubSystem", "Console"); - } - if(const char* stackVal = this->Makefile->GetDefinition("CMAKE_"+linkLanguage+"_STACK_SIZE")) { -- 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