mesonbuild/meson

CMake Wrapper Always Generates a Configure Command for CMake project

Open

#14,584 opened on 2025年5月9日

GitHub で見る
 (4 comments) (0 reactions) (0 assignees)Python (4,978 stars) (1,465 forks)batch import
dependency:cmakehelp wanted

説明

Describe the bug I am trying to wrap the Apache ORC project, which uses CMake. The CMake configuration at some point has code like:

ExternalProject_Add (orc-format_ep
  URL ${ORC_FORMAT_SOURCE_URL}
  URL_HASH SHA256=d4a7ac76c5442abf7119e2cb84e71b677e075aff53518aa866055e2ead0450d7
  CONFIGURE_COMMAND ""
  BUILD_COMMAND     ""
  INSTALL_COMMAND     ""
  TEST_COMMAND     ""
)

ORC is trying to add the ExternalProject orc-format, which itself is not a CMake project, so the ORC configuration sets the CONFIGURE_COMMAND to an empty string (see the CMake docs on the intent)

However, the corresponding Meson wrapper will still auto-generate a configure command:

custom_tgt_10 = custom_target(
  'custom_tgt_10',
  input : [custom_tgt_8],
  output : ['orc-format_ep-configure'],
    command : [],
    '/usr/bin/meson',
    '--internal',
    'cmake_run_ctgt',
    '-o',
    '@OUTPUT@',
    '-O',
    '/home/willayd/clones/arrow/cpp/builddir/subprojects/orc-2.1.2/__CMake_build/orc-format_ep-prefix/src/orc-format_ep-stamp/orc-format_ep-configure',
    '-d',
    '/home/willayd/clones/arrow/cpp/builddir/subprojects/orc-2.1.2/__CMake_build/orc-format_ep-prefix/src/orc-format_ep-build',
    '/usr/bin/cmake',
    '-GNinja',
    '-S',
    '/home/willayd/clones/arrow/cpp/builddir/subprojects/orc-2.1.2/__CMake_build/orc-format_ep-prefix/src/orc-format_ep',
    '-B',
    '/home/willayd/clones/arrow/cpp/builddir/subprojects/orc-2.1.2/__CMake_build/orc-format_ep-prefix/src/orc-format_ep-build',
    ';;;',
    '/usr/bin/cmake',
    '-E',
    'touch',
    '/home/willayd/clones/arrow/cpp/builddir/subprojects/orc-2.1.2/__CMake_build/orc-format_ep-prefix/src/orc-format_ep-stamp/orc-format_ep-configure',
    ';;;'
  ],
  depends : []
)

Which fails to compile:

FAILED: subprojects/orc-2.1.2/orc-format_ep-configure 
/usr/bin/meson --internal cmake_run_ctgt -o subprojects/orc-2.1.2/orc-format_ep-configure -O /home/willayd/clones/arrow/cpp/builddir/subprojects/orc-2.1.2/__CMake_build/orc-format_ep-prefix/src/orc-format_ep-stamp/orc-format_ep-configure -d /home/willayd/clones/arrow/cpp/builddir/subprojects/orc-2.1.2/__CMake_build/orc-format_ep-prefix/src/orc-format_ep-build /usr/bin/cmake -GNinja -S /home/willayd/clones/arrow/cpp/builddir/subprojects/orc-2.1.2/__CMake_build/orc-format_ep-prefix/src/orc-format_ep -B /home/willayd/clones/arrow/cpp/builddir/subprojects/orc-2.1.2/__CMake_build/orc-format_ep-prefix/src/orc-format_ep-build ';;;' /usr/bin/cmake -E touch /home/willayd/clones/arrow/cpp/builddir/subprojects/orc-2.1.2/__CMake_build/orc-format_ep-prefix/src/orc-format_ep-stamp/orc-format_ep-configure ';;;'
CMake Error: The source directory "/home/willayd/clones/arrow/cpp/builddir/subprojects/orc-2.1.2/__CMake_build/orc-format_ep-prefix/src/orc-format_ep" does not appear to contain CMakeLists.txt.

To Reproduce It is unfortunately difficult to produce an MRE as this behavior is deeply nested within CMake subprojects...but this is the wrap file I am using for ORC:

[wrap-file]
source_url = https://www.apache.org/dyn/closer.lua/orc/orc-2.1.2/orc-2.1.2.tar.gz?action=download
source_fallback_url = https://dlcdn.apache.org/orc/orc-2.1.2/orc-2.1.2.tar.gz
source_filename = orc-2.1.2.tar.gz
source_hash = 55451e65dea6ed42afb39fe33a88f9dcea8928dca0a0c9c23ef5545587810b4c
directory = orc-2.1.2
method = cmake

[provide]
orc = orc_dep

Expected behavior Meson should not auto-generate a configure target for CMake ExternalProject calls when the configure command is set to an empty string

system parameters

  • Is this a cross build or just a plain native build (for the same computer)? Plain native build
  • what operating system (e.g. MacOS Catalina, Windows 10, CentOS 8.0, Ubuntu 18.04, etc.) Ubuntu 24.04
  • what Python version are you using e.g. 3.8.0 3.12.3
  • what meson --version 1.8.0
  • what ninja --version if it's a Ninja build 1.12.1

コントリビューターガイド