normalize paths in CMAKE_PREFIX_PATH for proper comparison
* Insert current directory to CMAKE_PREFIX_PATH only when it doesn't exist
use '/' as separator
* add comment to explain why os.path.normpath is needed
* correct comment; remove use of os.path.normpath()
* normalize base_path instead of paths in CMAKE_PREfiX_PATH
@@ -265,6 +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__)
+ # CMAKE_PREFIX_PATH uses forward slash on all platforms, but __file__ is platform dependent
+ # base_path on Windows contains backward slashes, need to be converted to forward slashes before comparison
+ if os.path.sep != '/':
+ base_path = base_path.replace(os.path.sep, '/')
+
if base_path not in CMAKE_PREFIX_PATH:
CMAKE_PREFIX_PATH.insert(0, base_path)
CMAKE_PREFIX_PATH = os.pathsep.join(CMAKE_PREFIX_PATH)
