[cmake-developers] [PATCH] WINCE, VS: Make the Visual Studio 10+ generator Windows CE

Brad King brad.king at kitware.com
Fri Sep 12 09:36:59 EDT 2014


On 09/12/2014 08:47 AM, Pascal Bach wrote:
> - If Windows CE is targeted set the Subsystem and EntryPointSymbol accordingly
> - For Windows CE 2013 (8.0) set the toolset to C800 by default

Great, thanks.

> +bool cmGlobalVisualStudio10Generator::InitializeWindowsCE(cmMakefile* mf)
> +  {

Here please add this check:

  if(this->DefaultPlatformName != "Win32")
    {
    cmOStringStream e;
    e << "CMAKE_SYSTEM_NAME is 'WindowsCE' but CMAKE_GENERATOR "
      << "specifies a platform too: '" << this->GetName() << "'";
    mf->IssueMessage(cmake::FATAL_ERROR, e.str());
    return false;
    }

This code should no longer be called multiple times so it is safe to
check here now.

> +  // To preserve the old behaviour just keep the DefaultPlatformToolset
> +  // for unknown Windows CE versions, in the worst case the user has to set
> +  // CMAKE_GENERATOR_TOOLSET manually. In that case warn the user.
> +  std::string platformToolset = this->SelectWindowsCEToolset();
> +  if (!platformToolset.empty())
> +    {
> +    this->DefaultPlatformToolset = platformToolset;
> +    }
> +  else
> +    {
> +    cmOStringStream e;
> +    e << this->GetName() << " Windows CE version '" << this->SystemVersion
> +      << "' might require CMAKE_GENERATOR_TOOLSET to be set.";
> +    mf->IssueMessage(cmake::WARNING, e.str());
> +    }

I think this will always warn when CMAKE_SYSTEM_VERSION != 8.0
even if the user has set a CMAKE_GENERATOR_TOOLSET.  Instead,
cmGlobalVisualStudio10Generator::SetGeneratorToolset should
implement the warning:

* Have InitializeWindowsCE always do
  this->DefaultPlatformToolset = this->SelectWindowsCEToolset()
  even when it is empty.

* Teach SetGeneratorToolset to check for SystemIsWindowsCE *and*
  ts.empty() *and* DefaultPlatformToolset.empty().  If this is
  all true, then generate an error asking the user to specify
  the toolset, or perhaps just a warning if the toolset is not
  always required.

Thanks,
-Brad



More information about the cmake-developers mailing list