[CMake] CheckTypeSize and non-standard headers

Michael Jackson mike.jackson at bluequartz.net
Mon Feb 16 15:14:03 EST 2009


SET(CMAKE_REQUIRED_INCLUDES_SAVE ${CMAKE_REQUIRED_INCLUDES})
SET(CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES};/usr/include")

CHECK_SYMBOL_EXISTS(wint_t "runetype.h" HAVE_WINT_T)

SET(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SAVE})

IF (HAVE_WINT_T)
message(STATUS "wint_t is available")
endif()

Also, check the documentation for the CheckSymbolExists macro.

• CheckSymbolExists: Check if the symbol exists in include files
CHECK_SYMBOL_EXISTS(SYMBOL FILES VARIABLE)

SYMBOL - symbol
FILES - include files to check
VARIABLE - variable to return result


The following variables may be set before calling this macro to modify  
the way the check is run:

CMAKE_REQUIRED_FLAGS = string of compile command line flags
CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
CMAKE_REQUIRED_INCLUDES = list of include directories
CMAKE_REQUIRED_LIBRARIES = list of libraries to link
Defined in: /Users/Shared/Toolkits/CMake-CVS/share/cmake-2.7/Modules/ 
CheckSymbolExists.cmake


_________________________________________________________
Mike Jackson                  mike.jackson at bluequartz.net
BlueQuartz Software                    www.bluequartz.net
Principal Software Engineer                  Dayton, Ohio



On Feb 16, 2009, at 2:13 PM, Aaron Turner wrote:

> I'm trying to figure out how to write my CMakeLists.txt file to find
> wint_t under OSX which defines it in /usr/include/runetype.h rather
> then one of the standard headers that CheckTypeSize uses.  I was
> hoping Cmake behaved like autotools where if you first look for the
> header it will automatically include it in future type checks, but
> that doesn't seem to be the case.
>
> Suggestions?
>
> -- 
> Aaron Turner
> http://synfin.net/
> http://tcpreplay.synfin.net/ - Pcap editing and replay tools for  
> Unix & Windows
> Those who would give up essential Liberty, to purchase a little
> temporary Safety,
> deserve neither Liberty nor Safety.
>    -- Benjamin Franklin
> _______________________________________________
> 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



More information about the CMake mailing list