Skip to content

Opt in to the default CMake install path #994

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

Merged
merged 3 commits into from
Jul 27, 2023

Conversation

kkloberdanz
Copy link
Contributor

@kkloberdanz kkloberdanz commented Jul 26, 2023

CXX-2703

Allow user to opt in to the default CMake install path by setting -DUSE_DEFAULT_INSTALL_PATH=ON

@kkloberdanz kkloberdanz force-pushed the use-cmake-default-install branch from 4893307 to 48aa1e1 Compare July 26, 2023 20:50
@kkloberdanz kkloberdanz marked this pull request as ready for review July 27, 2023 13:26
message(FATAL_ERROR "You cannot set both CMAKE_INSTALL_PREFIX and USE_DEFAULT_INSTALL_PATH")
endif()
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT AND NOT USE_DEFAULT_INSTALL_PATH)
message(WARNING "the CMake default install path is being overriden. This behavior will not be the default in a future release. Build with -DUSE_DEFAULT_INSTALL_PATH=ON to opt into what will be the default behavior in a future release")
set (CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "default install path" FORCE)
endif()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update the Configure the driver steps in the install documentation to use the USE_DEFAULT_INSTALL_PATH option.

@kkloberdanz kkloberdanz requested a review from kevinAlbs July 27, 2023 16:56
@kkloberdanz kkloberdanz merged commit 6a1716e into mongodb:master Jul 27, 2023
@kkloberdanz kkloberdanz deleted the use-cmake-default-install branch July 27, 2023 18:39
# set it to live under build so we don't inadvertently pollute /usr/local
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
option(USE_DEFAULT_INSTALL_PATH "Override the CMake default installation path" OFF)
if(NOT CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT AND USE_DEFAULT_INSTALL_PATH)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT is only TRUE on the very first execution of configure, so setting USE_DEFAULT_INSTALL_PATH=TRUE will trigger this branch on every subsequent configure, preventing it from succeeding until CMAKE_INSTALL_PREFIX is un-set on the CLI with -U.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants