Skip to content
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

Prevent LLVM cmake from finding builtin zstd. #17909

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,22 @@ set(DIR_PERMISSIONS DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE G
# ROOT build. This is significant e,g. for roottest, which will otherwise have libraries
# of a different ROOT build available / visible / reachable.
if(NOT $ENV{ROOTSYS} STREQUAL "")
string(REPLACE "$ENV{ROOTSYS}/bin" "" ENV_PATH "$ENV{PATH}")
string(REPLACE "$ENV{ROOTSYS}/lib" "" ENV_LD_LIBRARY_PATH "$ENV{LD_LIBRARY_PATH}")
string(REPLACE "$ENV{ROOTSYS}/lib" "" ENV_PYTHONPATH "$ENV{PYTHONPATH}")
string(REPLACE "$ENV{ROOTSYS}" "" ENV_CMAKE_PREFIX_PATH "$ENV{CMAKE_PREFIX_PATH}")
set(ENV{PATH} "${ENV_PATH}")
set(ENV{LD_LIBRARY_PATH} "${ENV_LD_LIBRARY_PATH}")
set(ENV{PYTHONPATH} "${ENV_PYTHONPATH}")
set(ENV{CMAKE_PREFIX_PATH} "${ENV_CMAKE_PREFIX_PATH}")
function(strip_path ENV_VAR _path)
string(REPLACE ":${_path}:" ":" _temp_envvar $ENV{${ENV_VAR}})
string(REGEX REPLACE "^${_path}:" "" _temp_envvar ${_temp_envvar})
string(REGEX REPLACE ":${_path}$" "" _temp_envvar ${_temp_envvar})
if (_temp_envvar STREQUAL _path)
set(ENV{ENV_VAR} "")
else()
set(ENV{ENV_VAR} "${_temp_envvar}")
endif()
endfunction()
strip_path("PATH" "$ENV{ROOTSYS}/bin")
strip_path("LD_LIBRARY_PATH" "$ENV{ROOTSYS}/lib")
strip_path("PYTHONPATH" "$ENV{ROOTSYS}/lib")
# if we leave the ':' it will result in an empty entry in the CMAKE_PREFIX_PATH
# which will interpreted as the current directory.
Comment on lines +74 to +75
Copy link
Member

Choose a reason for hiding this comment

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

This comment seems outdated now.

Copy link
Member Author

Choose a reason for hiding this comment

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

The comment is maybe misplaced but still relevant. For the other paths, there is no side effect to having :: whereas it is disastrous for CMAKE_PREFIX_PATH.

strip_path("CMAKE_PREFIX_PATH" "$ENV{ROOTSYS}")
set(ENV{ROOTSYS} ${CMAKE_BINARY_DIR})
endif()

Expand Down
1 change: 1 addition & 0 deletions cmake/modules/SearchInstalledSoftware.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,7 @@ if(NOT builtin_zstd)
endif()

if(builtin_zstd)
list(APPEND ROOT_BUILTINS zstd)
list(APPEND ROOT_BUILTINS ZSTD)
add_subdirectory(builtins/zstd)
endif()
Expand Down
Loading