MACRO (FINDC99MODIFIERS)
  GET_PROPERTY(source_dir_set GLOBAL PROPERTY MYPACKAGE_SOURCE_DIR SET)
  IF (NOT ${source_dir_set})
    MESSAGE (WARNING "Cannot check C99 modifiers, property MYPACKAGE_SOURCE_DIR is not set")
  ELSE ()
    IF (NOT C_C99MODIFIERS_SINGLETON)
      GET_PROPERTY(source_dir GLOBAL PROPERTY MYPACKAGE_SOURCE_DIR)
      SET (_C_C99MODIFIERS_FOUND FALSE)
      #
      # Test - Inspired by https://github.com/kanzure/brlcad/blob/master/misc/CMake/BRLCAD_CheckFunctions.cmake
      #
      INCLUDE(CheckIncludeFile)
      CHECK_INCLUDE_FILE(stddef.h HAVE_STDDEF_H)
      CHECK_INCLUDE_FILE(stdint.h HAVE_STDINT_H)
      CHECK_INCLUDE_FILE(sys/stdint.h HAVE_SYS_STDINT_H)
      IF (HAVE_STDDEF_H)
        SET (_HAVE_STDDEF_H 1)
      ELSE ()
        SET (_HAVE_STDDEF_H 0)
      ENDIF ()
      IF (HAVE_STDINT_H)
        SET (_HAVE_STDINT_H 1)
      ELSE ()
        SET (_HAVE_STDINT_H 0)
      ENDIF ()
      IF (HAVE_SYS_STDINT_H)
        SET (_HAVE_SYS_STDINT_H 1)
      ELSE ()
        SET (_HAVE_SYS_STDINT_H 0)
      ENDIF ()
      MESSAGE(STATUS "Looking for C99 modifiers")
      TRY_RUN(C_C99MODIFIERS_RUN_RESULT
        C_C99MODIFIERS_COMPILE_RESULT
        ${CMAKE_CURRENT_BINARY_DIR}
        ${source_dir}/c99modifiers.c
        COMPILE_DEFINITIONS -DHAVE_STDINT_H=${_HAVE_STDINT_H} -DHAVE_STDDEF_H=${_HAVE_STDDEF_H} -DHAVE_SYS_STDINT_H=${_HAVE_SYS_STDINT_H})
      IF (C_C99MODIFIERS_COMPILE_RESULT AND (C_C99MODIFIERS_RUN_RESULT EQUAL 0))
        MESSAGE(STATUS "Looking for c99 modifiers - found")
        SET (_C_C99MODIFIERS_FOUND TRUE)
      ENDIF ()
      IF (_C_C99MODIFIERS_FOUND)
        SET (HAVE_C99MODIFIERS TRUE CACHE BOOL "C C99 modifiers")
        MARK_AS_ADVANCED (HAVE_C99MODIFIERS)
      ENDIF ()
      SET (C_C99MODIFIERS_SINGLETON TRUE CACHE BOOL "C C99 modifiers singleton")
      MARK_AS_ADVANCED (C_C99MODIFIERS_SINGLETON)
    ENDIF ()
  ENDIF ()
ENDMACRO()
