From 27f4bf8d94d1395120f8bbc3b8d5a40a8c31b2bc Mon Sep 17 00:00:00 2001 From: Martchus Date: Mon, 10 Jun 2024 22:34:29 +0200 Subject: [PATCH] Set export name when compiling with emscripten --- cmake/modules/BasicConfig.cmake | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmake/modules/BasicConfig.cmake b/cmake/modules/BasicConfig.cmake index 288febf..085522f 100644 --- a/cmake/modules/BasicConfig.cmake +++ b/cmake/modules/BasicConfig.cmake @@ -611,6 +611,11 @@ if (GCOV_COVERAGE_ENABLED) list(APPEND META_ADDITIONAL_LINK_FLAGS ${GCC_COVERAGE_FLAGS}) endif () +# set export name when compiling with emscripten +if (CMAKE_C_COMPILER MATCHES ".*emcc$") + list(APPEND PRIVATE_LIBRARIES "-sEXPORT_NAME='${META_PROJECT_VARNAME_LOWER}'") +endif () + # configure creation of install targets if (NOT META_NO_INSTALL_TARGETS) # install targets have not been disabled on project level check whether install targets are disabled by the user this