VS: Make DetermineCompilerId working with WinCE too

Add a dummy mainCRTStartup() function, since the linker searches for
it instead of main() and set the CMAKE_SYSTEM_* variables depending
on the MSVC_C_ARCHITECTURE_ID and CMAKE_VS_WINCE_VERSION variables.
This commit is contained in:
Patrick Gansterer 2012-11-20 13:37:50 +01:00 committed by Brad King
parent 038df9e49e
commit 40c36c9f7b
6 changed files with 24 additions and 1 deletions

View File

@ -228,3 +228,7 @@ int main(int argc, char* argv[])
return require;
}
#endif
#ifdef ADD_MAINCRTSTARTUP
void mainCRTStartup() {}
#endif

View File

@ -210,3 +210,7 @@ int main(int argc, char* argv[])
(void)argv;
return require;
}
#ifdef ADD_MAINCRTSTARTUP
extern "C" void mainCRTStartup() {}
#endif

View File

@ -140,6 +140,9 @@ Id flags: ${testflags}
else()
set(id_toolset "")
endif()
if(CMAKE_VS_WINCE_VERSION)
set(id_definitions "ADD_MAINCRTSTARTUP")
endif()
if("${CMAKE_MAKE_PROGRAM}" MATCHES "[Mm][Ss][Bb][Uu][Ii][Ll][Dd]")
set(build /p:Configuration=Debug /p:Platform=@id_arch@ /p:VisualStudioVersion=${vs_version}.0)
elseif("${CMAKE_MAKE_PROGRAM}" MATCHES "[Mm][Ss][Dd][Ee][Vv]")

View File

@ -106,6 +106,12 @@ if(CMAKE_SYSTEM_NAME)
set(CMAKE_CROSSCOMPILING TRUE)
endif()
set(PRESET_CMAKE_SYSTEM_NAME TRUE)
elseif(CMAKE_VS_WINCE_VERSION)
set(CMAKE_SYSTEM_NAME "WindowsCE")
set(CMAKE_SYSTEM_VERSION "${CMAKE_VS_WINCE_VERSION}")
set(CMAKE_SYSTEM_PROCESSOR "${MSVC_C_ARCHITECTURE_ID}")
set(CMAKE_CROSSCOMPILING TRUE)
set(PRESET_CMAKE_SYSTEM_NAME TRUE)
else()
set(CMAKE_SYSTEM_NAME "${CMAKE_HOST_SYSTEM_NAME}")
set(CMAKE_SYSTEM_VERSION "${CMAKE_HOST_SYSTEM_VERSION}")

View File

@ -24,7 +24,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions=""
PreprocessorDefinitions="@id_definitions@"
MinimalRebuild="false"
BasicRuntimeChecks="3"
RuntimeLibrary="3"

View File

@ -143,6 +143,12 @@ void cmGlobalVisualStudio8Generator::AddPlatformDefinitions(cmMakefile* mf)
{
cmGlobalVisualStudio71Generator::AddPlatformDefinitions(mf);
mf->AddDefinition("CMAKE_VS_PLATFORM_NAME", this->GetPlatformName());
if(this->TargetsWindowsCE())
{
mf->AddDefinition("CMAKE_VS_WINCE_VERSION",
this->WindowsCEVersion.c_str());
}
}
//----------------------------------------------------------------------------