[CMake] Concern with 2.6.3

Pau Garcia i Quiles pgquiles at elpauer.org
Mon Mar 9 19:09:00 EDT 2009


On Mon, Mar 9, 2009 at 5:31 PM, Bill Hoffman <bill.hoffman at kitware.com> wrote:

>> By the way, is there any way to set an internal global variable in a
>> VC++ project? Currently, CMake-generated Qt projects may show a wrong
>> version in the property browser if the default (in the registry) Qt
>> version is not the same as the Qt version you told in CMake (i. e. the
>> qmake). What's required is adding something like this in the .vcproj :
>>
>> <Globals>
>> ...
>> <Global
>> Name="QtVersion"
>> Value="4.4.3"
>> />
>>
>> (where the Qt version would be what FindQt4.cmake has found)
>>
>> Would something like SET_TARGET_PROPERTIES ( thetarget PROPERTIES
>> VS_GLOBAL "property" "value" ) be accepted if I provide a patch?
>>
> Sure, there are already some examples of this:
>  ("VS_KEYWORD", cmProperty::TARGET,
>     "Visual Studio project keyword.",
>     "Can be set to change the visual studio keyword, for example "
>     "QT integration works better if this is set to Qt4VSv1.0. ");
>  cm->DefineProperty
>    ("VS_SCC_PROVIDER", cmProperty::TARGET,
>     "Visual Studio Source Code Control Provider.",
>     "Can be set to change the visual studio source code control "
>     "provider property.");
>  cm->DefineProperty
>    ("VS_SCC_LOCALPATH", cmProperty::TARGET,
>     "Visual Studio Source Code Control Provider.",
>     "Can be set to change the visual studio source code control "
>     "local path property.");
>  cm->DefineProperty
>    ("VS_SCC_PROJECTNAME", cmProperty::TARGET,
>     "Visual Studio Source Code Control Project.",
>     "Can be set to change the visual studio source code control "
>     "project name property.");

I have created issue #8707 in the bugtracker and attached the patch
there. It's modelled after XCODE_ATTRIBUTE_<an-attribute>.

The patch adds support for:

 SET_TARGET_PROPERTIES( thetarget PROPERTIES VS_GLOBAL_<variable> value )

For instance:

SET_TARGET_PROPERTIES( thetarget PROPERTIES VS_GLOBAL_QtVersion ${QTVERSION} )

creates this section in the .vcproj:

<Global
  Name="QtVersion"
  Value="4.5.0"
/>

If I have understood correctly the XSD schema for vcproj files (
http://msdn.microsoft.com/en-us/library/y4sy8216.aspx ), global
variables with an empty name are allowed (it would probably be more
correct to say they are not prohibited), so this patch allows them
although I think that's just a mistake in the XSD and CMake should not
create something like:

SET_TARGET_PROPERTIES( thetarget PROPERTIES VS_GLOBAL_ "blah" )

<Global
  Name=""
  Value="blah"
/>

-- 
Pau Garcia i Quiles
http://www.elpauer.org
(Due to my workload, I may need 10 days to answer)


More information about the CMake mailing list