[all-commits] [llvm/llvm-project] 7f5fe3: [cmake] Only set deps for an ExternalProject if th...

Nathan Lanza via All-commits all-commits at lists.llvm.org
Wed Apr 1 20:32:11 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 7f5fe30a150e7e87d3fbe4da4ab0e76ec38b40b9
      https://github.com/llvm/llvm-project/commit/7f5fe30a150e7e87d3fbe4da4ab0e76ec38b40b9
  Author: Nathan Lanza <nathan at lanza.io>
  Date:   2020-04-01 (Wed, 01 Apr 2020)

  Changed paths:
    M llvm/cmake/modules/LLVMExternalProjectUtils.cmake

  Log Message:
  -----------
  [cmake] Only set deps for an ExternalProject if the type is executable or library

Summary:
cmake fails with an error when attempting to evaluate $<TARGET_FILE:tgt>
where `tgt` is defined via an `add_custom_target` and thus the `TYPE`
is `UTILITY`. Requesting a TARGET_FILE only works on an `EXECUTABLE`
or one of a few differetnt types of `X_LIBRARY` (e.g. added via
`add_library` or `add_executable`). The logic as implemented in cmake
is below:

  enum TargetType
  {
    EXECUTABLE,
    STATIC_LIBRARY,
    SHARED_LIBRARY,
    MODULE_LIBRARY,
    OBJECT_LIBRARY,
    UTILITY,
    GLOBAL_TARGET,
    INTERFACE_LIBRARY,
    UNKNOWN_LIBRARY
  };

  if (target->GetType() >= cmStateEnums::OBJECT_LIBRARY &&
      target->GetType() != cmStateEnums::UNKNOWN_LIBRARY) {
    ::reportError(context, content->GetOriginalExpression(),
                  "Target \"" + name +
                    "\" is not an executable or library.");
    return nullptr;
  }

This has always been the case back to at least 3.12 (furthest I
checked) but this is causing a new failure in cmake 3.17 while
evaluating ExternalProjectAdd.

Subscribers: mgorny, llvm-commits

Tags: #llvm

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




More information about the All-commits mailing list