MACRO (FINDSTRTOLD)
  GET_PROPERTY(source_dir_set GLOBAL PROPERTY MYPACKAGE_SOURCE_DIR SET)
  IF (NOT ${source_dir_set})
    MESSAGE (WARNING "Cannot check strtold, property MYPACKAGE_SOURCE_DIR is not set")
  ELSE ()
    IF (NOT C_STRTOLD_SINGLETON)
      GET_PROPERTY(source_dir GLOBAL PROPERTY MYPACKAGE_SOURCE_DIR)
      SET (_C_STRTOLD_FOUND FALSE)
      #
      # Test
      #
      FOREACH (KEYWORD "strtold" "_strtold" "__strtold")
        MESSAGE(STATUS "Looking for ${KEYWORD}")
        TRY_COMPILE (C_HAS_${KEYWORD} ${CMAKE_CURRENT_BINARY_DIR}
          ${source_dir}/strtold.c
          COMPILE_DEFINITIONS -DC_STRTOLD=${KEYWORD})
        IF (C_HAS_${KEYWORD})
          MESSAGE(STATUS "Looking for ${KEYWORD} - found")
          SET (_C_STRTOLD ${KEYWORD})
          SET (_C_STRTOLD_FOUND TRUE)
          BREAK ()
        ENDIF ()
      ENDFOREACH ()
    ENDIF ()
    IF (_C_STRTOLD_FOUND)
      SET (C_STRTOLD "${_C_STRTOLD}" CACHE STRING "C strtold implementation")
      MARK_AS_ADVANCED (C_STRTOLD)
    ENDIF ()
    SET (C_STRTOLD_SINGLETON TRUE CACHE BOOL "C strtold check singleton")
    MARK_AS_ADVANCED (C_STRTOLD_SINGLETON)
  ENDIF ()
ENDMACRO()
