summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/CheckIPOSupported/save-to-result.cmake
blob: f76db724d00f0e5f4a49eaa64820de1a6518b1cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
project(${RunCMake_TEST} LANGUAGES C)
check_ipo_supported(RESULT result OUTPUT output)

string(COMPARE EQUAL "${result}" "" is_empty)
if(is_empty)
  message(FATAL_ERROR "Result variable is empty")
endif()

string(COMPARE EQUAL "${result}" "YES" is_yes)
string(COMPARE EQUAL "${result}" "NO" is_no)

if(is_yes)
  # Compiler supports IPO
elseif(is_no)
  # Compiler doesn't support IPO, output should not be empty.
  string(COMPARE EQUAL "${output}" "" is_empty)
  if(is_empty)
    message(FATAL_ERROR "Output is empty")
  endif()
else()
  message(FATAL_ERROR "Unexpected result: ${result}")
endif()