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

normalize paths in CMAKE_PREFIX_PATH for proper comparison #979

Merged
merged 4 commits into from
Jan 28, 2019
Merged
Changes from 3 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
7 changes: 5 additions & 2 deletions cmake/templates/_setup_util.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,11 @@ if __name__ == '__main__':
CMAKE_PREFIX_PATH = '@CMAKE_PREFIX_PATH_AS_IS@'.split(';')
# prepend current workspace if not already part of CPP
base_path = os.path.dirname(__file__)
if base_path not in CMAKE_PREFIX_PATH:
CMAKE_PREFIX_PATH.insert(0, base_path)

# CMAKE_PREFIX_PATH uses forward slash on all platforms, but __file__ is platform dependent
# base_path on Windows contains backward slashes, need to normalize paths in CMAKE_PREFIX_PATH with os.path.normpath for comparison
if base_path not in [os.path.normcase(p) for p in CMAKE_PREFIX_PATH]:
CMAKE_PREFIX_PATH.insert(0, base_path.replace(os.path.sep, '/'))
CMAKE_PREFIX_PATH = os.pathsep.join(CMAKE_PREFIX_PATH)

environ = dict(os.environ)
Expand Down