Add CMAKE_INSTALL_PREFIX environment variable to set default value of CMAKE_INSTALL_PREFIX CMake variable
I was thinking to propose a MR to add an environment variable called CMAKE_INSTALL_PREFIX
to specify the default value used to initialize the CMAKE_INSTALL_PREFIX
CMake variable, similar to the existing CMAKE_BUILD_TYPE
or CMAKE_TOOLCHAIN_FILE
environment variables. Before working on an MR, I wanted to check if this is would be an idea welcome by CMake's mantainers, or for any reason another approach would be preferred. I searched for past discussion on this, but I could not find anything.
Rationale
As part of my work in a research institution, we commonly develop CMake/C++ projects inside a conda environment. When developing as part of a conda environment, most dependencies and tools used by the C++ development projects are installed in a non-system installation prefix (that is $CONDA_PREFIX
for non-Windows and %CONDA_PREFIX%\Library
for Windows). For this reason, it does not make sense that the default installation prefix when working in a conda environment is /usr/local
, as installing a C++ library and/or executable that depends on the libraries preset in the conda environment in /usr/local
will result in a non-working installation.