Open traversaro opened 7 months ago
Hi! This is the friendly automated conda-forge-linting service.
I just wanted to let you know that I linted all conda-recipes in your PR (recipe
) and found it was in an excellent condition.
@conda-forge-admin, please rerender
Hi! This is the friendly automated conda-forge-webservice.
I tried to rerender for you, but it looks like there was nothing to do.
This message was generated by GitHub actions workflow run https://github.com/conda-forge/cmake-feedstock/actions/runs/8382827218.
wouldnt it be easier to add this to the other flags generated by conda-build like CXXFLAGS, CMAKE_ARGS, etc ... rather than this specific feedstock ?
wouldnt it be easier to add this to the other flags generated by conda-build like CXXFLAGS, CMAKE_ARGS, etc ... rather than this specific feedstock ?
My rationale is that those variables are set in the compiler activation scripts, while you can use CMake projects also without any compiler, for example if you have a project that only install config files or CMake files. Those kind of packages tipically have LANGUAGES NONE
passed to their project
invocation exactly not to required any kind of compiler (by default CMake enables C
and CXX
languages).
I don't think it is a good idea to do this automatically. There are issues like https://github.com/conda-forge/ctng-compiler-activation-feedstock/issues/77 which came up because CMAKE_ARGS was used automatically by scikit-build.
I don't think it is a good idea to do this automatically. There are issues like conda-forge/ctng-compiler-activation-feedstock#77 which came up because CMAKE_ARGS was used automatically by scikit-build.
This proposal only changes the default value of CMAKE_INSTALL_PREFIX
, that is currently set to /usr/local
. This value can be safely overriden by passing the -DCMAKE_INSTALL_PREFIX=
argument to the command line. If this PR is merged, assuming that CMake >= 3.29 is used indeed we could solve conda-forge/ctng-compiler-activation-feedstock#77 by removing -DCMAKE_INSTALL_PREFIX
from CMAKE_ARGS
, so that users can just override the default value naturally by passing -DCMAKE_INSTALL_PREFIX=<..>
to the CMake command line, as opposed to overriding the CMAKE_INSTAL_PREFIX
set in CMAKE_ARGS
that requires editing the CMAKE_ARGS
environment value.
CMake 3.29 added support for specifying the default for
CMAKE_INSTALL_PREFIX
via an environment variable, calledCMAKE_INSTALL_PREFIX
(see https://gitlab.kitware.com/cmake/cmake/-/issues/25023 and https://gitlab.kitware.com/cmake/cmake/-/merge_requests/9200).Without setting the
CMAKE_INSTALL_PREFIX
env variable, the default install prefix is/usr/local
on *nix or some path based onC:\Program Files\
on Windows. In any case, this default values do not make sense w.r.t. to the CONDA_PREFIX .This PR adds activation scripts to the cmake package to set the
CMAKE_INSTALL_PREFIX
env variable (and hence the default value ofCMAKE_INSTALL_PREFIX
to a useful value, according to the following logic:CMAKE_INSTALL_PREFIX
to$CONDA_PREFIX
, or$PREFIX
when underconda-build
CMAKE_INSTALL_PREFIX
to%CONDA_PREFIX%\Library
, or%PREFIX%\Library
when underconda-build
The main advantage of this is that now downloading and installing a project via
git clone https://github.com/someorg/someproj && cmake -Bbuild -Ssomeproj && cmake --build ./build && cmake --install ./build
while automatically installs the cmake project in the environment, a bit like on Pythongit clone https://github.com/someorg/someproj && pip install --no-deps -e ./someproj
installs the Python package in the environment.If
CMAKE_INSTALL_PREFIX
is set via command line, the value specified via command line take the precedence over the default value set via theCMAKE_INSTALL_PREFIX
environment variable, so this modification should be backward compatible with all conda recipes or any other cmake use that setsCMAKE_INSTALL_PREFIX
either via$CMAKE_ARGS
or explicitly.Checklist
0
(if the version changed)conda-smithy
(Use the phrase code>@<space/conda-forge-admin, please rerender in a comment in this PR for automated rerendering)