Re: [CMake] MSVC variable doesn't work without project() call first

2011-11-01 Thread Robert Dailey
On Tue, Nov 1, 2011 at 10:43 AM, David Cole  wrote:

> On Tue, Nov 1, 2011 at 11:22 AM, Alexander Neundorf
>  wrote:
> > On Tuesday 01 November 2011, Robert Dailey wrote:
> >> For some reason the built in variable like MSVC_VERSION and MSVC do not
> >> have any value unless the project() command is called first. Can someone
> >> explain why?
> >
> > Without checking...
> > IIRC, the project() call enables by default the C and the CXX languages
> (if
> > that hasn't been done before explicitely).
> > During enabling the languages the compilers are detected, and with them
> those
> > variables are set.
> > So, before that no languages are known to cmake, so these variables are
> not
> > set.
> >
> > Alex
> > --
> >
> > Powered by www.kitware.com
> >
> > Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
> >
> > Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
> >
> > Follow this link to subscribe/unsubscribe:
> > http://www.cmake.org/mailman/listinfo/cmake
> >
>
> Alex is right.
>
> If you need the value of MSVC *before* calling the project command for
> some reason, then you can call enable_language(C) (or CXX) instead...


I don't need MSVC checking before project() in my case, they just seemed
unrelated so I wanted to check for educational purposes :)

Thanks guys.
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] MSVC variable doesn't work without project() call first

2011-11-01 Thread David Cole
On Tue, Nov 1, 2011 at 11:22 AM, Alexander Neundorf
 wrote:
> On Tuesday 01 November 2011, Robert Dailey wrote:
>> For some reason the built in variable like MSVC_VERSION and MSVC do not
>> have any value unless the project() command is called first. Can someone
>> explain why?
>
> Without checking...
> IIRC, the project() call enables by default the C and the CXX languages (if
> that hasn't been done before explicitely).
> During enabling the languages the compilers are detected, and with them those
> variables are set.
> So, before that no languages are known to cmake, so these variables are not
> set.
>
> Alex
> --
>
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at 
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at: 
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>

Alex is right.

If you need the value of MSVC *before* calling the project command for
some reason, then you can call enable_language(C) (or CXX) instead...
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] MSVC variable doesn't work without project() call first

2011-11-01 Thread Alexander Neundorf
On Tuesday 01 November 2011, Robert Dailey wrote:
> For some reason the built in variable like MSVC_VERSION and MSVC do not
> have any value unless the project() command is called first. Can someone
> explain why?

Without checking...
IIRC, the project() call enables by default the C and the CXX languages (if 
that hasn't been done before explicitely).
During enabling the languages the compilers are detected, and with them those 
variables are set.
So, before that no languages are known to cmake, so these variables are not 
set.

Alex
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake