[cmake-developers] Specifying VS target platform

Brad King brad.king at kitware.com
Fri Sep 14 08:11:29 EDT 2012


On 9/14/2012 6:47 AM, Patrick Gansterer wrote:
> I've pushed a new version to the ce branch again. Maybe you find time 
> to give me some feedback. I'll test it in the meantime.

Great start!

Good catch on the duplicated local generator implementations.  IIRC
the methods were originally different but became the same after
some recent refactoring.  I'm glad to see that enabled even more
cleanup.

The idea of a "generator platform" is not generic among all generators.
Rather than the general CMAKE_GENERATOR_PLATFORM infrastructure I'd
generator-specific handling.  The value of -GP should be passed to the
global generator created from -G.  If the generator does not support
platform specification in this way then -GP should be an error (all
generators except VS >= 8).  If the generator does support -GP then it
should do its own thing to save the value.  For VS save it in a cache
entry like "CMAKE_VS_PLATFORM" (we have "CMAKE_VS_PLATFORM_TOOLSET"
already for the VS 10 toolchain in some cases).

I realized that existing projects may test ${CMAKE_GENERATOR} to look
for things like "Win64".  For compatibility we need to make sure that

 -G "Visual Studio 10" -GP x64

results in CMAKE_GENERATOR being set to

 -G "Visual Studio 10 Win64"

while processing CMake code even if it is not used that way
internally.  Of course for future VS versions the generator names
will not need to work this way, only the existing ones.

In the compiler id sources, you add this:

+#ifdef ADD_MAINCRTSTARTUP
+void mainCRTStartup() {}
+#endif

It should be compiled with the actual compiler for the platform.  Is
there a predefined macro that could be used instead?  Does it have
to be conditional?  I do not think they would hurt anything on other
platforms (just use "(void)" instead of "()" in the declaration).

In the "Remove TargetMachine for linker" change does that work for
VS 10 too?  Currently the change only affects VS 7-9.

Thanks!
-Brad


More information about the cmake-developers mailing list