[PATCH] D72947: [CMake] llvm/runtimes: Do not override LLVM_* variables with just-built LLVM configurations

James Nagurne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 20 11:27:57 PDT 2020


JamesNagurne added a comment.

In D72947#2047140 <https://reviews.llvm.org/D72947#2047140>, @beanz wrote:

> Sorry for being late to the party on this.
>
> There's really only a handful of variables in LLVMConfig.cmake that can actually be different between LLVM and the project using LLVM. Might it make sense to just handle those as special? We already do handle `LLVM_PTHREAD_LIB` specially for exactly the same reason you describe in the description.


I agree that it's probably the best general solution. I missed LLVM_PTHREAD_LIB, but are you talking about LLVMConfig.cmake.in? That's where I can see the variable being set differently than the others.

  if (NOT "@LLVM_PTHREAD_LIB@" STREQUAL "")
    set(LLVM_PTHREAD_LIB "@LLVM_PTHREAD_LIB@")
  endif()

However, if LLVM_PTHREAD_LIB is set by the LLVM configuration (the just-built compiler), then the 'if' condition will always be true and we'd always override whatever configuration the runtimes build would want to do.
Indeed, if I set my runtimes cache to have "RUNTIMES_LLVM_PTHREAD_LIB=THISISANERROR", then it gets overridden by find_package(LLVM ...) in llvm/runtimes/CMakeLists.txt to be '-lpthread'.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72947/new/

https://reviews.llvm.org/D72947





More information about the llvm-commits mailing list