[PATCH] D42490: [cmake] Set cmake policy CMP0068 to suppress warnings on OSX

Don Hinton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 31 17:37:03 PST 2018


hintonda added a comment.

In https://reviews.llvm.org/D42490#994154, @beanz wrote:

> 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.


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 https://reviews.llvm.org/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 https://reviews.llvm.org/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.


Repository:
  rC Clang

https://reviews.llvm.org/D42490





More information about the cfe-commits mailing list