Installing python bindings from virtual environment is broken
Summary
Installing python bindings does not seem to work when I prepare my own python virtual environment.
How to reproduce
git clone ssh://git@gitlab.dune-project.org:22022/core/dune-common.git
python3 -m venv venv
source venv/bin/activate
cmake -S dune-common -B build --install-prefix ${PWD}/dune
cmake --build build --target install
This will result in a failed installation of the python bindings:
...
Installing python package
CMake Warning at /Users/sospinar/Codes/DUNE_COMMON/dune-common/cmake/modules/DuneExecuteProcess.cmake:76 (message):
python package installation failed - ignored
Run
command:/opt/homebrew/Cellar/cmake/3.29.3/bin/cmake;--build;.;--target;install_python;--config
Return code: 1
Output:
CMake Error: Invalid value used with --config
Usage: cmake --build <dir> [options] [-- [native-options]]
cmake --build --preset <preset> [options] [-- [native-options]]
Options:
<dir> = Project binary directory to be built.
--preset <preset>, --preset=<preset>
= Specify a build preset.
--list-presets[=<type>]
= List available build presets.
--parallel [<jobs>], -j [<jobs>]
= Build in parallel using the given number of jobs.
If <jobs> is omitted the native build tool's
default number is used.
The CMAKE_BUILD_PARALLEL_LEVEL environment variable
specifies a default parallel level when this option
is not given.
-t <tgt>..., --target <tgt>...
= Build <tgt> instead of default targets.
--config <cfg> = For multi-configuration tools, choose <cfg>.
--clean-first = Build target 'clean' first, then build.
(To clean only, use --target 'clean'.)
--resolve-package-references={on|only|off}
= Restore/resolve package references during build.
-v, --verbose = Enable verbose output - if supported - including
the build commands to be executed.
-- = Pass remaining options to the native tool.
Call Stack (most recent call first):
python/cmake_install.cmake:50 (dune_execute_process)
cmake_install.cmake:84 (include)
Installing wheel for python package at /Users/sospinar/Codes/DUNE_COMMON/build/python/. into /Users/sospinar/Codes/DUNE_COMMON/dune/share/dune/wheelhouse...
The problem seems to be that the generator expression $<CONFIG>
in the installation command does not expand to anything and leaves the argument of --config
empty. If I remove the --config $<CONFIG>
everything works fine. I don't understand why it does not expand since install(CODE ...)
should in theory accept CMake generator expressions.