Fix [type] command file url forward slashes issue when use mingw
This commit is contained in:
parent
4420f9b33b
commit
3c98026a1c
@ -67,18 +67,28 @@ if(ENABLE_GLSLANG_JS)
|
||||
endif()
|
||||
|
||||
if(NOT ENABLE_EMSCRIPTEN_ENVIRONMENT_NODE)
|
||||
if (CMAKE_HOST_SYSTEM MATCHES "Windows.*")
|
||||
# There are several ways we could append one file to another on Windows, but unfortunately 'cat' is not one of them
|
||||
# (there is no 'cat' command in cmd). Also, since this will ultimately run in cmd and not pwsh, we need to ensure
|
||||
# Windows path separators are used.
|
||||
file(TO_NATIVE_PATH "${CMAKE_CURRENT_BINARY_DIR}/glslang.js" glslang_js_path)
|
||||
file(TO_NATIVE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/glslang.after.js" glslang_after_js_path)
|
||||
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.18")
|
||||
add_custom_command(TARGET glslang.js POST_BUILD
|
||||
COMMAND type "${glslang_after_js_path}" >> "${glslang_js_path}")
|
||||
COMMAND ${CMAKE_COMMAND} -E cat ${CMAKE_CURRENT_SOURCE_DIR}/glslang.after.js >> ${CMAKE_CURRENT_BINARY_DIR}/glslang.js
|
||||
)
|
||||
else()
|
||||
add_custom_command(TARGET glslang.js POST_BUILD
|
||||
COMMAND cat ${CMAKE_CURRENT_SOURCE_DIR}/glslang.after.js >> ${CMAKE_CURRENT_BINARY_DIR}/glslang.js)
|
||||
if (MINGW)
|
||||
message(FATAL_ERROR "Must use at least CMake 3.18")
|
||||
endif()
|
||||
|
||||
if (CMAKE_HOST_SYSTEM MATCHES "Windows.*")
|
||||
# There are several ways we could append one file to another on Windows, but unfortunately 'cat' is not one of them
|
||||
# (there is no 'cat' command in cmd). Also, since this will ultimately run in cmd and not pwsh, we need to ensure
|
||||
# Windows path separators are used.
|
||||
file(TO_NATIVE_PATH "${CMAKE_CURRENT_BINARY_DIR}/glslang.js" glslang_js_path)
|
||||
file(TO_NATIVE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/glslang.after.js" glslang_after_js_path)
|
||||
add_custom_command(TARGET glslang.js POST_BUILD
|
||||
COMMAND type "${glslang_after_js_path}" >> "${glslang_js_path}")
|
||||
else()
|
||||
add_custom_command(TARGET glslang.js POST_BUILD
|
||||
COMMAND cat ${CMAKE_CURRENT_SOURCE_DIR}/glslang.after.js >> ${CMAKE_CURRENT_BINARY_DIR}/glslang.js)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
Loading…
x
Reference in New Issue
Block a user