From 6f38af3722eb9062729506679884d0f0831ff104 Mon Sep 17 00:00:00 2001 From: Julia Dark <24235303+jp-dark@users.noreply.github.com> Date: Thu, 19 Dec 2024 14:59:52 -0500 Subject: [PATCH] Set overriding user provided prefix to be off by default (#3463) It is surprising to override standard input variables. This requires the user to actively opt-in to overriding the standard CMake behavior. --- libtiledbsoma/CMakeLists.txt | 4 ++-- scripts/bld | 2 ++ scripts/bld.ps1 | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/libtiledbsoma/CMakeLists.txt b/libtiledbsoma/CMakeLists.txt index 8ac2acb30a..09ad494ccd 100644 --- a/libtiledbsoma/CMakeLists.txt +++ b/libtiledbsoma/CMakeLists.txt @@ -68,7 +68,7 @@ option(TILEDB_WERROR "Enables the -Werror flag during compilation." OFF) option(TILEDB_REMOVE_DEPRECATIONS "If true, do not build deprecated APIs." OFF) option(TILEDB_SERIALIZATION "If true, enables building with support for query serialization" ON) option(TILEDB_VERBOSE "If true, sets default logging to verbose for TileDB" OFF) -option(OVERRIDE_INSTALL_PREFIX "Ignores the setting of CMAKE_INSTALL_PREFIX and sets a default prefix" ON) +option(OVERRIDE_INSTALL_PREFIX "Ignores the setting of CMAKE_INSTALL_PREFIX and sets a default prefix" OFF) option(ENABLE_ARROW_EXPORT "Installs an extra header for exporting in-memory results with Apache Arrow" ON) option(TILEDB_LOG_OUTPUT_ON_FAILURE "If true, print error logs if dependency sub-project build fails" ON) option(TILEDB_SANITIZER "Sanitizer to use in TILEDB. ") @@ -122,7 +122,7 @@ endif() #set(CMAKE_CXX_VISIBILITY_PRESET hidden) # Root directory default installation prefix -if(OVERRIDE_INSTALL_PREFIX) +if(OVERRIDE_INSTALL_PREFIX OR NOT CMAKE_INSTALL_PREFIX) set(PREFIX_REL_PATH "${CMAKE_SOURCE_DIR}/../dist") get_filename_component(DEFAULT_PREFIX "${PREFIX_REL_PATH}" ABSOLUTE) set(CMAKE_INSTALL_PREFIX "${DEFAULT_PREFIX}" CACHE PATH "Default install prefix" FORCE) diff --git a/scripts/bld b/scripts/bld index 3d6bc9e0d1..52d8da5702 100755 --- a/scripts/bld +++ b/scripts/bld @@ -78,6 +78,8 @@ fi # set installation path if [ -n "${prefix}" ]; then extra_opts+=" -DCMAKE_INSTALL_PREFIX=${prefix} -DOVERRIDE_INSTALL_PREFIX=OFF" +else + extra_opts+=" -DOVERRIDE_INSTALL_PREFIX=ON" fi # build with custom tiledb diff --git a/scripts/bld.ps1 b/scripts/bld.ps1 index 11cfa0f0db..e4aabad726 100644 --- a/scripts/bld.ps1 +++ b/scripts/bld.ps1 @@ -47,6 +47,8 @@ if ($Configuration -eq 'Debug' -and $TileDBLocation -ne '') { if ($Prefix -ne '') { $ExtraOpts += " -DCMAKE_INSTALL_PREFIX=$Prefix -DOVERRIDE_INSTALL_PREFIX=OFF" +} else { + $ExtraOpts += " -DOVERRIDE_INSTALL_PREFIX=ON" } if ($TileDBLocation -ne '') {