1project(${RunCMake_TEST} LANGUAGES C) 2check_ipo_supported(RESULT result OUTPUT output) 3 4string(COMPARE EQUAL "${result}" "" is_empty) 5if(is_empty) 6 message(FATAL_ERROR "Result variable is empty") 7endif() 8 9string(COMPARE EQUAL "${result}" "YES" is_yes) 10string(COMPARE EQUAL "${result}" "NO" is_no) 11 12if(is_yes) 13 # Compiler supports IPO 14elseif(is_no) 15 # Compiler doesn't support IPO, output should not be empty. 16 string(COMPARE EQUAL "${output}" "" is_empty) 17 if(is_empty) 18 message(FATAL_ERROR "Output is empty") 19 endif() 20else() 21 message(FATAL_ERROR "Unexpected result: ${result}") 22endif() 23