Skip to content

Instantly share code, notes, and snippets.

View likema's full-sized avatar

Like Ma likema

View GitHub Profile
@likema
likema / CheckCCompiles.cmake
Last active October 22, 2019 13:35
CMake macro to check if given C source file compiles and links into an executable
# - Check if given C source file compiles and links into an executable
# CHECK_C_COMPILES(<file> <var> [FAIL_REGEX <fail-regex>])
#
# <file> - source file to try to compile, must define 'main'
# <var> - variable to store whether the source code compiled
# Will be created as an internal cache variable.
# <fail-regex> - fail if test output matches this regex
#
# The following variables may be set before calling this macro to modify
# the way the check is run:
@likema
likema / CheckStdCHeaders.cmake
Last active October 22, 2019 13:34
CMake macro to check ANSI C header files
# - 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)