Ensure Windows paths used by CMake contain forward slashes only (#807)
This commit is contained in:
parent
7baefc1a8c
commit
7205619704
|
@ -349,7 +349,9 @@ def _tail_if_starts_with(str, start):
|
||||||
def _absolutize(workspace_name, text, force = False):
|
def _absolutize(workspace_name, text, force = False):
|
||||||
if text.strip(" ").startswith("C:") or text.strip(" ").startswith("c:"):
|
if text.strip(" ").startswith("C:") or text.strip(" ").startswith("c:"):
|
||||||
return text
|
return text
|
||||||
return absolutize_path_in_str(workspace_name, "$$EXT_BUILD_ROOT$$/", text, force)
|
|
||||||
|
# Use bash parameter substitution to replace backslashes with forward slashes as CMake fails if provided paths containing backslashes
|
||||||
|
return absolutize_path_in_str(workspace_name, "$${EXT_BUILD_ROOT//\\\\//}$$/", text, force)
|
||||||
|
|
||||||
def _join_flags_list(workspace_name, flags):
|
def _join_flags_list(workspace_name, flags):
|
||||||
return " ".join([_absolutize(workspace_name, flag) for flag in flags])
|
return " ".join([_absolutize(workspace_name, flag) for flag in flags])
|
||||||
|
|
|
@ -12,12 +12,12 @@ def _absolutize_test(ctx):
|
||||||
env = unittest.begin(ctx)
|
env = unittest.begin(ctx)
|
||||||
|
|
||||||
cases = {
|
cases = {
|
||||||
"-Lexternal/cmake/aaa": "-L$$EXT_BUILD_ROOT$$/external/cmake/aaa",
|
"-Lexternal/cmake/aaa": "-L$${EXT_BUILD_ROOT//\\\\//}$$/external/cmake/aaa",
|
||||||
"/abs/a12": "/abs/a12",
|
"/abs/a12": "/abs/a12",
|
||||||
"abs/a12": "abs/a12",
|
"abs/a12": "abs/a12",
|
||||||
"external/cmake/aaa": "$$EXT_BUILD_ROOT$$/external/cmake/aaa",
|
"external/cmake/aaa": "$${EXT_BUILD_ROOT//\\\\//}$$/external/cmake/aaa",
|
||||||
"name=ws/cmake/aaa": "name=$$EXT_BUILD_ROOT$$/ws/cmake/aaa",
|
"name=ws/cmake/aaa": "name=$${EXT_BUILD_ROOT//\\\\//}$$/ws/cmake/aaa",
|
||||||
"ws/cmake/aaa": "$$EXT_BUILD_ROOT$$/ws/cmake/aaa",
|
"ws/cmake/aaa": "$${EXT_BUILD_ROOT//\\\\//}$$/ws/cmake/aaa",
|
||||||
}
|
}
|
||||||
|
|
||||||
for case in cases:
|
for case in cases:
|
||||||
|
@ -94,11 +94,11 @@ def _fill_crossfile_from_toolchain_test(ctx):
|
||||||
expected = {
|
expected = {
|
||||||
"CMAKE_AR": "/cxx_linker_static",
|
"CMAKE_AR": "/cxx_linker_static",
|
||||||
"CMAKE_ASM_FLAGS_INIT": "assemble",
|
"CMAKE_ASM_FLAGS_INIT": "assemble",
|
||||||
"CMAKE_CXX_COMPILER": "$$EXT_BUILD_ROOT$$/external/cxx-value",
|
"CMAKE_CXX_COMPILER": "$${EXT_BUILD_ROOT//\\\\//}$$/external/cxx-value",
|
||||||
"CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN": "cxx-toolchain",
|
"CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN": "cxx-toolchain",
|
||||||
# Quoted args are escaped when crossfile is written to a script in create_cmake_script
|
# Quoted args are escaped when crossfile is written to a script in create_cmake_script
|
||||||
"CMAKE_CXX_FLAGS_INIT": "--quoted=\"abc def\" --sysroot=/abc/sysroot --gcc_toolchain cxx-toolchain",
|
"CMAKE_CXX_FLAGS_INIT": "--quoted=\"abc def\" --sysroot=/abc/sysroot --gcc_toolchain cxx-toolchain",
|
||||||
"CMAKE_CXX_LINK_EXECUTABLE": "$$EXT_BUILD_ROOT$$/ws/cxx_linker_executable <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>",
|
"CMAKE_CXX_LINK_EXECUTABLE": "$${EXT_BUILD_ROOT//\\\\//}$$/ws/cxx_linker_executable <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>",
|
||||||
"CMAKE_C_COMPILER": "/some-cc-value",
|
"CMAKE_C_COMPILER": "/some-cc-value",
|
||||||
"CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN": "cc-toolchain",
|
"CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN": "cc-toolchain",
|
||||||
"CMAKE_C_FLAGS_INIT": "-cc-flag -gcc_toolchain cc-toolchain",
|
"CMAKE_C_FLAGS_INIT": "-cc-flag -gcc_toolchain cc-toolchain",
|
||||||
|
|
Loading…
Reference in New Issue