[CMake] Detecting Mac OS X Version

James Bigler bigler at cs.utah.edu
Wed Oct 31 09:35:43 EDT 2007


This is what one of our developers did:

# -- Determine the version of OSX
# -- 8 and less are OSX 10.0 - 10.4
# -- 9 is 10.5 (LEOPARD)
IF (APPLE)
   EXEC_PROGRAM(uname ARGS -v  OUTPUT_VARIABLE DARWIN_VERSION)
   STRING(REGEX MATCH "[0-9]+" DARWIN_VERSION ${DARWIN_VERSION})
   MESSAGE(STATUS "DARWIN_VERSION=${DARWIN_VERSION}")
   IF (DARWIN_VERSION GREATER 8)
     SET(APPLE_LEOPARD 1 INTERNAL)
     ADD_DEFINITIONS(-DAPPLE_LEOPARD)
   ENDIF (DARWIN_VERSION GREATER 8)
ENDIF(APPLE)

On Oct 31, 2007, at 7:31 AM, Mike Jackson wrote:

> Would someone have an example of detecting the specific version of  
> OS X that cmake is running on? I would like add values based on OS  
> X version.
>
> IF (OS_X_VERSION matches "10.5")
>   ......
> ENDIF (OS_X_VERSION matches "10.5")
>
> or something to that effect..
>
>
> Thanks
> --
> Mike Jackson
> imikejackson & gmail * com
>
>
>
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake



More information about the CMake mailing list