CMAKE_MINIMUM_REQUIRED(VERSION 3.3.2) INCLUDE(CheckFunctionExists) CHECK_FUNCTION_EXISTS(snprintf HAVE_SNPRINTF) IF(NOT HAVE_SNPRINTF) CHECK_FUNCTION_EXISTS(_snprintf HAVE__SNPRINTF) IF(NOT HAVE__SNPRINTF) MESSAGE(FATAL_ERROR "No snprintf function found, please report!") ENDIF() ADD_DEFINITIONS(-Dsnprintf=_snprintf) ENDIF()