diff options
author | Patrick Gansterer <paroga@paroga.com> | 2012-11-20 12:37:50 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2012-11-27 13:31:19 (GMT) |
commit | 40c36c9f7bd101185b06ddf2aee079ccbe7634d3 (patch) | |
tree | ec739b73730ab2beb87e5e438b890ce4cb440648 | |
parent | 038df9e49e6fcb54d6f6a1bcfb09f6a0e5ec0c2e (diff) | |
download | CMake-40c36c9f7bd101185b06ddf2aee079ccbe7634d3.zip CMake-40c36c9f7bd101185b06ddf2aee079ccbe7634d3.tar.gz CMake-40c36c9f7bd101185b06ddf2aee079ccbe7634d3.tar.bz2 |
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.
-rw-r--r-- | Modules/CMakeCCompilerId.c.in | 4 | ||||
-rw-r--r-- | Modules/CMakeCXXCompilerId.cpp.in | 4 | ||||
-rw-r--r-- | Modules/CMakeDetermineCompilerId.cmake | 3 | ||||
-rw-r--r-- | Modules/CMakeDetermineSystem.cmake | 6 | ||||
-rw-r--r-- | Modules/CompilerId/VS-7.vcproj.in | 2 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio8Generator.cxx | 6 |
6 files changed, 24 insertions, 1 deletions
diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in index 2d76c7a..3d1380c 100644 --- a/Modules/CMakeCCompilerId.c.in +++ b/Modules/CMakeCCompilerId.c.in @@ -228,3 +228,7 @@ int main(int argc, char* argv[]) return require; } #endif + +#ifdef ADD_MAINCRTSTARTUP +void mainCRTStartup() {} +#endif diff --git a/Modules/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in index 5e70a41..142a5c5 100644 --- a/Modules/CMakeCXXCompilerId.cpp.in +++ b/Modules/CMakeCXXCompilerId.cpp.in @@ -210,3 +210,7 @@ int main(int argc, char* argv[]) (void)argv; return require; } + +#ifdef ADD_MAINCRTSTARTUP +extern "C" void mainCRTStartup() {} +#endif diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 05430a6..43469ea 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -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]") diff --git a/Modules/CMakeDetermineSystem.cmake b/Modules/CMakeDetermineSystem.cmake index cd33447..c7f9c32 100644 --- a/Modules/CMakeDetermineSystem.cmake +++ b/Modules/CMakeDetermineSystem.cmake @@ -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}") diff --git a/Modules/CompilerId/VS-7.vcproj.in b/Modules/CompilerId/VS-7.vcproj.in index bcb18a5..b1449e4 100644 --- a/Modules/CompilerId/VS-7.vcproj.in +++ b/Modules/CompilerId/VS-7.vcproj.in @@ -24,7 +24,7 @@ <Tool Name="VCCLCompilerTool" Optimization="0" - PreprocessorDefinitions="" + PreprocessorDefinitions="@id_definitions@" MinimalRebuild="false" BasicRuntimeChecks="3" RuntimeLibrary="3" diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index a482d46..21c82b7 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -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()); + } } //---------------------------------------------------------------------------- |