This is an archive of the discontinued LLVM Phabricator instance.

[CMake] Enable policy CMP0056
Needs RevisionPublic

Authored by phosek on Apr 17 2019, 6:06 PM.

Details

Summary

When this policy is enabled, CMake honors link flags in try_compile().
This is useful when cross-compiling since the CMake checks will use
the value of CMAKE_EXE_LINKER_FLAGS when linking the test executables.

Diff Detail

Repository
rL LLVM

Event Timeline

phosek created this revision.Apr 17 2019, 6:06 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 17 2019, 6:06 PM
smeenai accepted this revision.Apr 17 2019, 6:32 PM

Hmm, I'd done this as part of https://reviews.llvm.org/D39431, but then https://reviews.llvm.org/D50407 erroneously removed it.

This revision is now accepted and ready to land.Apr 17 2019, 6:32 PM
smeenai requested changes to this revision.Apr 17 2019, 6:37 PM
smeenai added a reviewer: steveire.

Actually, this might not be needed? https://cmake.org/cmake/help/v3.4/manual/cmake-policies.7.html says

The cmake_minimum_required() command does more than report an error if a too-old version of CMake is used to build a project. It also sets all policies introduced in that CMake version or earlier to NEW behavior.

This revision now requires changes to proceed.Apr 17 2019, 6:37 PM

Indeed, the cmake_minimum_required command sets policies to new.

It is still possible that there is another use of cmake_minimum_required in the buildsystem somewhere (which would be an error if reachable from this one).

Anyway, it seems that this patch should not be applied.