Last active
October 22, 2019 13:34
-
-
Save likema/97841d77e5f384fbdb46629c5b429013 to your computer and use it in GitHub Desktop.
CMake macro to check ANSI C header files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# - Check ANSI C headers | |
# CHECK_STDC_HEADERS () | |
# | |
# Once done it will define STDC_HEADERS, HAVE_STDLIB_H, HAVE_STDARG_H, | |
# HAVE_STRING_H and HAVE_FLOAT_H, if they exist | |
# | |
MACRO (CHECK_STDC_HEADERS) | |
IF (NOT CMAKE_REQUIRED_QUIET) | |
MESSAGE (STATUS "Checking whether system has ANSI C header files") | |
ENDIF (NOT CMAKE_REQUIRED_QUIET) | |
CHECK_INCLUDE_FILES ("stdlib.h;stdarg.h;string.h;float.h" STDC_HEADERS) | |
IF (STDC_HEADERS) | |
MESSAGE (STATUS "ANSI C header files - found") | |
SET (STDC_HEADERS 1 CACHE INTERNAL "System has ANSI C header files") | |
SET (HAVE_STDLIB_H 1 CACHE INTERNAL "Have include stdlib.h") | |
SET (HAVE_STDARG_H 1 CACHE INTERNAL "Have include stdarg.h") | |
SET (HAVE_STRING_H 1 CACHE INTERNAL "Have include string.h")) | |
SET (HAVE_FLOAT_H 1 CACHE INTERNAL "Have include float.h"))) | |
ELSE (STDC_HEADERS) | |
MESSAGE (STATUS "ANSI C header files - not found") | |
SET (STDC_HEADERS 0 CACHE INTERNAL "System has ANSI C header files") | |
ENDIF (STDC_HEADERS) | |
ENDMACRO (CHECK_STDC_HEADERS) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment