[all-commits] [llvm/llvm-project] 128e1e: [CMake] Prefer multi-target variables over generic...

James Nagurne via All-commits all-commits at lists.llvm.org
Fri Jan 17 15:18:38 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 128e1ebd931027c58065f0c0dc83c0b6a1c53a83
      https://github.com/llvm/llvm-project/commit/128e1ebd931027c58065f0c0dc83c0b6a1c53a83
  Author: James Nagurne <j-nagurne at ti.com>
  Date:   2020-01-17 (Fri, 17 Jan 2020)

  Changed paths:
    M llvm/runtimes/CMakeLists.txt

  Log Message:
  -----------
  [CMake] Prefer multi-target variables over generic target variables in runtimes build

Runtimes variables in a multi-target environment are defined like:

RUNTIMES_target_VARIABLE_NAME
RUNTIMES_target+multi_VARIABLE_NAME

In my case, I have a downstream runtimes cache that does the following:

set(RUNTIMES_${target}+except_LIBCXXABI_ENABLE_EXCEPTIONS ON CACHE BOOL "")
set(RUNTIMES_${target}_LIBCXX_ENABLE_EXCEPTIONS OFF CACHE BOOL "")

I found that I was always getting the 'target' variable value (OFF) in
my 'target+except' build, which was unexpected.  This behavior was
caused by the loop in llvm/runtimes/CMakeLists.txt that runs through all
variable names, adding '-DVARIABLE_NAME=' options to the subsequent
external project's cmake command.

The issue is that the loop does a single pass, such that if the 'target'
value appears in the cache after the 'target+except' value, the 'target'
value will take precedence. I suggest in my change here that the more
specific 'target+except' value should take precedence always, without
relying on CMake cache ordering.

Differential Revision: https://reviews.llvm.org/D71570

Patch By: JamesNagurne




More information about the All-commits mailing list