CMake: fix compiler feature detection
authorAlp Toker <alp@nuanti.com>
Wed, 9 Jul 2014 03:38:19 +0000 (03:38 +0000)
committerAlp Toker <alp@nuanti.com>
Wed, 9 Jul 2014 03:38:19 +0000 (03:38 +0000)
commitb1d6b8ea7d647e80360c7574713609f60a164a70
tree177f76b833967bc9464ba459d70f8791fe5b87b2
parentd0de9868a6ee6769939fa01d9ad9f723f3f484ec
CMake: fix compiler feature detection

add_flag_if_supported() and add_flag_or_print_warning() were effectively
no-ops, just returning the value of the first result (usually
'-fno-omit-frame-pointer') for all subsequent checks for different flags.

Due to the way CMake caches feature detection results, we need to provide
symbolic variable names which will persist the cached results. This commit
fixes feature detection using these two macros.

The feature checks now run and get stored correctly, and the correct output can
be observed in configure logs:

  -- Performing Test C_SUPPORTS_FPIC
  -- Performing Test C_SUPPORTS_FPIC - Success
  -- Performing Test CXX_SUPPORTS_FPIC
  -- Performing Test CXX_SUPPORTS_FPIC - Success

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212586 91177308-0d34-0410-b5e6-96231b3b80d8
cmake/modules/HandleLLVMOptions.cmake