This is an archive of the discontinued LLVM Phabricator instance.

[cmake] Always respect existing CMAKE_REQUIRED_FLAGS when adding additional ones.
ClosedPublic

Authored by hintonda on Dec 24 2017, 1:09 PM.

Details

Summary

Always respect existing CMAKE_REQUIRED_FLAGS when adding
additional ones. This is important when cross compiling where
--sysroot and -target were already added.

In particular, this is needed when cross compiling from Darwin to
Linux, since --sysroot is required to find headers and libraries.

Cmake has a similar bug in check_include_file[_cxx] where
CMAKE_REQUIRED_LIBRARIES isn't passed, which causes
try_compile to fail.
(please see https://gitlab.kitware.com/cmake/cmake/merge_requests/1620)

Event Timeline

hintonda created this revision.Dec 24 2017, 1:09 PM
compnerd accepted this revision.Dec 24 2017, 3:11 PM
compnerd added inline comments.
cmake/modules/CheckAtomic.cmake
11

I really wish that we could reuse the language properties instead.

This revision is now accepted and ready to land.Dec 24 2017, 3:11 PM
This revision was automatically updated to reflect the committed changes.