-
-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set default value for CMAKE_INSTALL_PREFIX #208
base: main
Are you sure you want to change the base?
Conversation
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 ( |
@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 ? |
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 |
a4aab5e
to
782c43c
Compare
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 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@conda-forge-admin, please rerender
in a comment in this PR for automated rerendering)