Operating system decisions

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Operating system decisions

Jason Todd Slack-Moehrle
Hi All,

I am looking at the 2.6 documentation for a property or variable that  
I can use platform depending. I dont see one, so I am sure that I am  
looking int the wrong place.

Something like:

if (OSX)

if (Win32)

if(Linux)

etc.

I tried googling for 'cmake platform check' and did not find anything  
useful.

Does anyone have a link?

-Jason

_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: Operating system decisions

Tyler Roscoe
On Thu, Aug 06, 2009 at 11:58:53AM -0700, ML wrote:

> I am looking at the 2.6 documentation for a property or variable that  
> I can use platform depending. I dont see one, so I am sure that I am  
> looking int the wrong place.
>
> Something like:
>
> if (OSX)
>
> if (Win32)
>
> if(Linux)

http://www.cmake.org/Wiki/CMake_Useful_Variables/Logging_Useful_Variables

Btw, we're switching to using an extra variable WINDOWS that we define
as having the same value as WIN32. We got a lot of questions from
developers wondering if WIN32 meant just 32-bit Windows. (We have a
different way of determining whether a platform is 32-bit windows or
64-bit windows).

tyler
_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: Operating system decisions

Jason Todd Slack-Moehrle
Tyler,

>> Something like:
>>
>> if (OSX)
>>
>> if (Win32)
>>
>> if(Linux)
>
> http://www.cmake.org/Wiki/CMake_Useful_Variables/Logging_Useful_Variables
>
> Btw, we're switching to using an extra variable WINDOWS that we define
> as having the same value as WIN32. We got a lot of questions from
> developers wondering if WIN32 meant just 32-bit Windows. (We have a
> different way of determining whether a platform is 32-bit windows or
> 64-bit windows).

Thanks Tyler, is this avail in 2.6 (WINDOWS rather than using WIN32)  
or in a future release?

-Jason

_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: Operating system decisions

Tyler Roscoe
On Thu, Aug 06, 2009 at 12:42:44PM -0700, ML wrote:
> Thanks Tyler, is this avail in 2.6 (WINDOWS rather than using WIN32)  
> or in a future release?

It's available if you are working with CMake at my company :). Otherwise
you can do it yourself easily:

    # We want to use WINDOWS instead of the CMake-provided variable
    # WIN32 to prevent confusion about whether WIN32 applies to 64-bit
    # Windows (it does, but that's not obvious).
    if (WIN32)
        set (WINDOWS ${WIN32})
    endif ()

I mentioned it because I was sort of passively hoping that one of the
CMake devs would see it and say, "hey, that's a good idea," and
eventually include it in CMake proper. Until then, I have my
CommonIncludes.cmake :).

tyler
_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: Operating system decisions

Alexander Neundorf-3
On Thursday 06 August 2009, Tyler Roscoe wrote:

> On Thu, Aug 06, 2009 at 12:42:44PM -0700, ML wrote:
> > Thanks Tyler, is this avail in 2.6 (WINDOWS rather than using WIN32)
> > or in a future release?
>
> It's available if you are working with CMake at my company :). Otherwise
> you can do it yourself easily:
>
>     # We want to use WINDOWS instead of the CMake-provided variable
>     # WIN32 to prevent confusion about whether WIN32 applies to 64-bit
>     # Windows (it does, but that's not obvious).
>     if (WIN32)
>         set (WINDOWS ${WIN32})
>     endif ()
>
> I mentioned it because I was sort of passively hoping that one of the
> CMake devs would see it and say, "hey, that's a good idea," and
> eventually include it in CMake proper. Until then, I have my
> CommonIncludes.cmake :).

You can also test CMAKE_SYSTEM_NAME:

if(${CMAKE_SYSTEM_NAME MATCHES} Windows)
...

etc.

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