title: How does CMake check for IPO support?
body: <p>I'm trying to use CMake 3.10 to build a C++ application with IPO, I have the following in my <code>CMakeLists.txt</code>:</p>
  
  <pre><code>include(CheckIPOSupported)
  check_ipo_supported(RESULT ipo_supported)
  if(ipo_supported)
      message("-- IPO is supported!")
      set_property(TARGET target PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
  else()
      message(WARNING "IPO is not supported!")
  endif()
  </code></pre>
  
  <p>I'm using GCC 7.2 configured with IPO enabled (default) on a CentOS 4 machine, and I am able to compile a simple test program with the <code>-flto</code> flag. Yet CMake reports IPO is not supported. On multiple other machines the same CMake script reports IPO is supported.</p>
  
  <p>It would help me to understand what the problem is if I knew how CMake checks for IPO support. How does the CMake's module <a href="https://cmake.org/cmake/help/v3.9/module/CheckIPOSupported.html" rel="nofollow noreferrer"><code>CheckIPOSupported</code></a> work?</p>