Skip to content

Commit

Permalink
Add option to strip conda from PATH
Browse files Browse the repository at this point in the history
  • Loading branch information
daljit46 committed Oct 18, 2023
1 parent f522cd5 commit 93d96e4
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ option(MRTRIX_USE_QT6 "Use Qt6 to build" OFF)
option(MRTRIX_WARNINGS_AS_ERRORS "Compiler warnings result in compilation errors" OFF)
option(MRTRIX_STL_DEBUGGING "Enable STL debug mode" OFF)
option(MRTRIX_BUILD_TESTS "Build tests executables" OFF)
option(MRTRIX_STRIP_CONDA "Strip ananconda/mininconda from PATH to avoid conflicts" ON)

if(MRTRIX_BUILD_TESTS)
if(CMAKE_VERSION VERSION_GREATER 3.17)
Expand Down Expand Up @@ -93,6 +94,17 @@ if(MRTRIX_WARNINGS_AS_ERRORS)
endif()


if(MRTRIX_STRIP_CONDA AND DEFINED ENV{CONDA_PREFIX})
message(WARNING "CONDA_PREFIX is set to ${CONDA_PREFIX}, adding conda diretories to CMAKE_IGNORE_PATH to avoid conflicts.\n"
"To disable this behaviour, configure CMake with -DMRTRIX_STRIP_CONDA=OFF")
set(mrtrix_ignore_path_conda
$ENV{CONDA_PREFIX}/bin $ENV{CONDA_PREFIX}/lib $ENV{CONDA_PREFIX}/include
$ENV{CONDA_PREFIX} $ENV{CONDA_PREFIX}/Library $ENV{CONDA_PREFIX}/Scripts $ENV{CONDA_PREFIX}/condabin
$ENV{CONDA_PREFIX}/Library/bin $ENV{CONDA_PREFIX}/Library/lib $ENV{CONDA_PREFIX}/Library/include
)
set(CMAKE_IGNORE_PATH "${mrtrix_ignore_path_conda};${CMAKE_IGNORE_PATH}" CACHE STRING "")
endif()

# Check if a compiler or linker shipped with FSL is used
get_filename_component(COMPILER_PATH ${CMAKE_CXX_COMPILER} REALPATH)
get_filename_component(LINKER_PATH ${CMAKE_LINKER} REALPATH)
Expand Down

0 comments on commit 93d96e4

Please sign in to comment.