From 75c684f005e12aa54981f8c2d3e6bfcac728ff00 Mon Sep 17 00:00:00 2001 From: anutosh491 Date: Mon, 17 Mar 2025 15:01:47 +0530 Subject: [PATCH 1/2] Use target_link_options instead of set_target_properties for linking --- lib/Interpreter/CMakeLists.txt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/Interpreter/CMakeLists.txt b/lib/Interpreter/CMakeLists.txt index cd2f46571..ef9cb1f67 100644 --- a/lib/Interpreter/CMakeLists.txt +++ b/lib/Interpreter/CMakeLists.txt @@ -129,9 +129,13 @@ if(EMSCRIPTEN) #FIXME: A patch is needed to llvm to remove -Wl,-z,defs since it is now recognised on emscripten. What needs to be removed is here # https://github.com/llvm/llvm-project/blob/128e2e446e90c3b1827cfc7d4d19e3c0976beff3/llvm/cmake/modules/HandleLLVMOptions.cmake#L318 . The PR to do try to do this is here # https://github.com/llvm/llvm-project/pull/123396 - set_target_properties(clangCppInterOp PROPERTIES - NO_SONAME 1 - LINK_FLAGS "-s WASM_BIGINT -s SIDE_MODULE=1 ${SYMBOLS_LIST}" + set_target_properties(clangCppInterOp + PROPERTIES NO_SONAME 1 + ) + target_link_options(clangCppInterOp + PRIVATE "SHELL: -s WASM_BIGINT" + PRIVATE "SHELL: -s SIDE_MODULE=1" + PRIVATE "SHELL: ${SYMBOLS_LIST}" ) if (CPPINTEROP_ENABLE_TESTING) # When compiling Emscripten tests the shared library it links to is expected to be in the same folder as the compiled Javascript From 191fc626d1fe54c3e80994ffd04817d5632c2ed5 Mon Sep 17 00:00:00 2001 From: anutosh491 Date: Mon, 17 Mar 2025 15:44:11 +0530 Subject: [PATCH 2/2] use target_link_options for TestSharedLib too --- unittests/CppInterOp/TestSharedLib/CMakeLists.txt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/unittests/CppInterOp/TestSharedLib/CMakeLists.txt b/unittests/CppInterOp/TestSharedLib/CMakeLists.txt index cb209edac..0c27afc95 100644 --- a/unittests/CppInterOp/TestSharedLib/CMakeLists.txt +++ b/unittests/CppInterOp/TestSharedLib/CMakeLists.txt @@ -11,9 +11,12 @@ set_output_directory(TestSharedLib if (EMSCRIPTEN) - set_target_properties(TestSharedLib PROPERTIES - NO_SONAME 1 - LINK_FLAGS "-s WASM_BIGINT -s SIDE_MODULE=1" + set_target_properties(TestSharedLib + PROPERTIES NO_SONAME 1 + ) + target_link_options(TestSharedLib + PRIVATE "SHELL: -s WASM_BIGINT" + PRIVATE "SHELL: -s SIDE_MODULE=1" ) endif()