@@ -57,19 +57,26 @@ set(DIR_PERMISSIONS DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE G
57
57
# Before setting ROOTSYS, make sure that the environment isn't polluted by a different
58
58
# ROOT build. This is significant e,g. for roottest, which will otherwise have libraries
59
59
# of a different ROOT build available / visible / reachable.
60
- if (NOT $ENV{ROOTSYS} STREQUAL "" )
60
+ if (NOT $ENV{ROOTSYS} STREQUAL "" AND NOT $ENV{ROOTSYS} STREQUAL " ${CMAKE_BINARY_DIR} " )
61
61
function (strip_path ENV_VAR _path)
62
- string (REPLACE ":${_path} :" ":" _temp_envvar $ENV{${ENV_VAR} })
63
- string (REGEX REPLACE "^${_path} :" "" _temp_envvar ${_temp_envvar} )
64
- string (REGEX REPLACE ":${_path} $" "" _temp_envvar ${_temp_envvar} )
65
- if (_temp_envvar STREQUAL _path)
66
- set (ENV{ENV_VAR} "" )
67
- else ()
68
- set (ENV{ENV_VAR} "${_temp_envvar} " )
62
+ if (NOT $ENV{${ENV_VAR} } STREQUAL "" )
63
+ string (REPLACE ":${_path} :" ":" _temp_envvar $ENV{${ENV_VAR} })
64
+ string (REGEX REPLACE "^${_path} :" "" _temp_envvar ${_temp_envvar} )
65
+ string (REGEX REPLACE ":${_path} $" "" _temp_envvar ${_temp_envvar} )
66
+ if (_temp_envvar STREQUAL _path)
67
+ set (ENV{ENV_VAR} "" )
68
+ else ()
69
+ set (ENV{ENV_VAR} "${_temp_envvar} " )
70
+ endif ()
69
71
endif ()
70
72
endfunction ()
71
73
strip_path("PATH" "$ENV{ROOTSYS} /bin" )
72
- strip_path("LD_LIBRARY_PATH" "$ENV{ROOTSYS} /lib" )
74
+ if (not WIN32 )
75
+ strip_path("LD_LIBRARY_PATH" "$ENV{ROOTSYS} /lib" )
76
+ endif ()
77
+ if (APPLE )
78
+ strip_path("DYLD_LIBRARY_PATH" "$ENV{ROOTSYS} /lib" )
79
+ endif ()
73
80
strip_path("PYTHONPATH" "$ENV{ROOTSYS} /lib" )
74
81
# if we leave the ':' it will result in an empty entry in the CMAKE_PREFIX_PATH
75
82
# which will interpreted as the current directory.
0 commit comments