-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Make non-system include paths accessible at runtime #19179
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -2135,3 +2135,39 @@ function(generateManual name input output) | |||||||||||||||||||
|
||||||||||||||||||||
install(FILES ${output} DESTINATION ${CMAKE_INSTALL_MANDIR}/man1) | ||||||||||||||||||||
endfunction() | ||||||||||||||||||||
|
||||||||||||||||||||
#---------------------------------------------------------------------------- | ||||||||||||||||||||
# If path is a system path, set the return variable is_system_path to true. | ||||||||||||||||||||
# The 1st argument is the path that should be checked | ||||||||||||||||||||
# The 2nd argument is the return value | ||||||||||||||||||||
#---------------------------------------------------------------------------- | ||||||||||||||||||||
function (IS_SYSTEM_PATH path is_system_path) | ||||||||||||||||||||
foreach (dir ${CMAKE_SYSTEM_PATH}) | ||||||||||||||||||||
if ("${path}" STREQUALS "$dir") | ||||||||||||||||||||
set(${is_system_path} true PARENT_SCOPE) | ||||||||||||||||||||
endif() | ||||||||||||||||||||
endforeach() | ||||||||||||||||||||
set(${is_system_path} false PARENT_SCOPE) | ||||||||||||||||||||
Comment on lines
+2147
to
+2150
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The canonical bools are all caps, and we can break out early:
Suggested change
|
||||||||||||||||||||
endfunction() | ||||||||||||||||||||
|
||||||||||||||||||||
#---------------------------------------------------------------------------- | ||||||||||||||||||||
# If path is not a system path, append it to the given variable | ||||||||||||||||||||
# The 1st argument is the path to be checked | ||||||||||||||||||||
# The 2nd argument is the variable that the path gets appended to if it is | ||||||||||||||||||||
# not a system path. | ||||||||||||||||||||
#---------------------------------------------------------------------------- | ||||||||||||||||||||
function (IF_NOT_SYSTEM_PATH_APPEND path variable) | ||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this function ever going to be called with another variable than the default root include path? If yes, fair enough, otherwise I would call it something like |
||||||||||||||||||||
IS_SYSTEM_PATH("${path}" is_system_path) | ||||||||||||||||||||
if (NOT is_system_path) | ||||||||||||||||||||
if (${${variable}} STRING_EMPTY) | ||||||||||||||||||||
set(${variable} "${path}" PARENT_SCOPE) | ||||||||||||||||||||
else() | ||||||||||||||||||||
if(WIN32) | ||||||||||||||||||||
set(ROOT_PATH_SEPARATOR ";") | ||||||||||||||||||||
elseif(UNIX) | ||||||||||||||||||||
set(ROOT_PATH_SEPARATOR ":") | ||||||||||||||||||||
endif() | ||||||||||||||||||||
set(${variable} "${${variable}}${ROOT_PATH_SEPARATOR}${path}" PARENT_SCOPE) | ||||||||||||||||||||
endif() | ||||||||||||||||||||
endif() | ||||||||||||||||||||
endfunction() |
Original file line number | Diff line number | Diff line change | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -89,6 +89,10 @@ clean_environment() | |||||||||||||||||
default_manpath="" | ||||||||||||||||||
fi | ||||||||||||||||||
fi | ||||||||||||||||||
if [ -n "${ROOT_INCLUDE_PATH-}" ]; then | ||||||||||||||||||
drop_from_path "$ROOT_INCLUDE_PATH" "@DEFAULT_ROOT_INCLUDE_PATH@" | ||||||||||||||||||
ROOT_INCLUDE_PATH=$newpath | ||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||||||||||||||||
fi | ||||||||||||||||||
} | ||||||||||||||||||
|
||||||||||||||||||
set_environment() | ||||||||||||||||||
|
@@ -162,6 +166,14 @@ set_environment() | |||||||||||||||||
else | ||||||||||||||||||
JUPYTER_CONFIG_DIR=$ROOTSYS/etc/notebook:$JUPYTER_CONFIG_DIR; export JUPYTER_CONFIG_DIR | ||||||||||||||||||
fi | ||||||||||||||||||
|
||||||||||||||||||
if [ -z "${ROOT_INCLUDE_PATH-}" ]; then | ||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The variable name contains an extra There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is bash syntax for using a default value (of nothing) when the variable is not set. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK, I had to read up on the subtle difference between |
||||||||||||||||||
ROOT_INCLUDE_PATH=@DEFAULT_ROOT_INCLUDE_PATH@ | ||||||||||||||||||
export ROOT_INCLUDE_PATH | ||||||||||||||||||
else | ||||||||||||||||||
ROOT_INCLUDE_PATH=@DEFAULT_ROOT_INCLUDE_PATH@:$ROOT_INCLUDE_PATH | ||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you consider this an issue if DEFAULT_ROOT_INCLUDE_PATH is empty? Not just here but in the other shell setups? |
||||||||||||||||||
export ROOT_INCLUDE_PATH | ||||||||||||||||||
Comment on lines
+171
to
+175
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||
fi | ||||||||||||||||||
} | ||||||||||||||||||
|
||||||||||||||||||
getTrueShellExeName() { # mklement0 https://stackoverflow.com/a/23011530/7471760 | ||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe my cmake is too rusty, but shouldn't we not always set is_system_path to false at the end of the function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, I think the return is needed