project(check_function_exists) cmake_minimum_required(VERSION 2.8) include(CheckFunctionExists) CHECK_FUNCTION_EXISTS(printf HAVE_PRINTF) CHECK_FUNCTION_EXISTS(non_existing_printf HAVE_NON_EXISTING_PRINTF) CHECK_FUNCTION_EXISTS(fprintf HAVE_FPRINTF) IF(HAVE_NON_EXISTING_PRINTF) MESSAGE(FATAL_ERROR "Found non_existing_printf") ENDIF()