Set cmake policy CMP0068=NEW, if available -- depends on D42463 which
also adds target property "BUILD_WITH_INSTALL_NAME_DIR On" to maintain
current behavior.
This is needed to suppress warnings on OSX starting with cmake version
3.9.6.
Differential D42490
[cmake] Set cmake policy CMP0068 to suppress warnings on OSX hintonda on Jan 24 2018, 8:59 AM. Authored by
Details
Diff Detail
Event TimelineComment Actions It turns out that policies don't survive a call to cmake_minimum_required(), so we need to rethink how llvm, et al, handles policies, e.g.:
Comment Actions Historically we've duplicated cmake_policy calls on a per-project basis which we needed to support standalone builds. That said, it would be nice if we had LLVM vend some CMake modules that encapsulated this stuff better. In general I think that cleanup would be ideal to do after we move LLVM to the GitHub mono-repo because then we can create a cmake/modules folder at the root of the mono-repo that has common modules useable by all sub-projects. As-is, this patch is the right way to go. Comment Actions This patch isn't completely OBE, but in order maintain backward compatibility, it should also set CMAKE_BUILD_WITH_INSTALL_NAME_DIR=ON, e.g., when doing out-of-tree builds that don't get CMAKE_BUILD_WITH_INSTALL_NAME_DIR=ON from llvm. I ultimately updated D42463 to set both CMP0068 and CMAKE_BUILD_WITH_INSTALL_NAME_DIR=ON in llvm/CMakeLists.txt. This was needed for in-tree builds since cache variables survive calls to cmake_minimum_required(), and policies don't. Perhaps a better option for this policy would be to move the fix from D42463 to llvm/cmake/AddLLVM.cmake so llvm_setup_rpath() always does the right thing, even when called by sub-projects for both in and out-of-tree builds. Thus obviating the need for this patch. |