Skip to content

Commit 6e5c26b

Browse files
committed
Fix case where preloading paths have @ in absolute path
1 parent 7bb23b9 commit 6e5c26b

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

unittests/CppInterOp/CMakeLists.txt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ add_cppinterop_unittest(CppInterOpTests
2424
)
2525

2626
if(EMSCRIPTEN)
27+
string(REPLACE "@" "@@" ESCAPED_SYSROOT_PATH "${SYSROOT_PATH}")
2728
# Explanation of Emscripten-specific link flags for CppInterOpTests:
2829
#
2930
# MAIN_MODULE=1:
@@ -55,7 +56,7 @@ if(EMSCRIPTEN)
5556
PUBLIC "SHELL: -s ALLOW_MEMORY_GROWTH=1"
5657
PUBLIC "SHELL: -s STACK_SIZE=32mb"
5758
PUBLIC "SHELL: -s INITIAL_MEMORY=128mb"
58-
PUBLIC "SHELL: --preload-file ${SYSROOT_PATH}/include@/include"
59+
PUBLIC "SHELL: --preload-file ${ESCAPED_SYSROOT_PATH}/include@/include"
5960
PUBLIC "SHELL: --emrun"
6061
)
6162
endif()
@@ -96,16 +97,18 @@ target_link_libraries(DynamicLibraryManagerTests
9697
)
9798

9899
if(EMSCRIPTEN)
100+
set(TEST_SHARED_LIBRARY_PATH "${CMAKE_CURRENT_BINARY_DIR}/TestSharedLib/unittests/bin/Release/")
101+
string(REPLACE "@" "@@" ESCAPED_TEST_SHARED_LIBRARY_PATH "${TEST_SHARED_LIBRARY_PATH}")
99102
# Check explanation of Emscripten-specific link flags for CppInterOpTests above for DynamicLibraryManagerTests as well.
100103
target_link_options(DynamicLibraryManagerTests
101104
PUBLIC "SHELL: -s MAIN_MODULE=1"
102105
PUBLIC "SHELL: -s WASM_BIGINT"
103106
PUBLIC "SHELL: -s ALLOW_MEMORY_GROWTH=1"
104107
PUBLIC "SHELL: -s STACK_SIZE=32mb"
105108
PUBLIC "SHELL: -s INITIAL_MEMORY=128mb"
106-
PUBLIC "SHELL: --preload-file ${SYSROOT_PATH}/include@/include"
109+
PUBLIC "SHELL: --preload-file ${ESCAPED_SYSROOT_PATH}/include@/include"
107110
PUBLIC "SHELL: --emrun"
108-
PUBLIC "SHELL: --preload-file ${CMAKE_CURRENT_BINARY_DIR}/TestSharedLib/unittests/bin/Release/libTestSharedLib.so@/libTestSharedLib.so"
111+
PUBLIC "SHELL: --preload-file ${ESCAPED_TEST_SHARED_LIBRARY_PATH}/libTestSharedLib.so@/libTestSharedLib.so"
109112
)
110113
endif()
111114

0 commit comments

Comments
 (0)