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)
commit0068397f34e10b444a8b6b63b372fcc4ccbe5985
tree53288d344b6fe7e67bb23ac60e351c9749a8d8fe
parented412dac652c1bbe5f28706ef0f31e0c5d379a27
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

llvm-svn: 212586
llvm/cmake/modules/HandleLLVMOptions.cmake