From ebc1a655b44561494ed5bd5ed9471d87b3c7f8cd Mon Sep 17 00:00:00 2001 From: Oliver <59418903+Oliver-makes-code@users.noreply.github.com> Date: Wed, 4 Dec 2024 00:15:20 -0600 Subject: [PATCH] Fix linking with libm Fixes using clang's MSVC ABI. Fixes: https://github.com/quickjs-ng/quickjs/issues/728 --- CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b635b4c..66ad2dc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -212,7 +212,10 @@ find_package(Threads) if(NOT CMAKE_SYSTEM_NAME STREQUAL "WASI") list(APPEND qjs_libs ${CMAKE_THREAD_LIBS_INIT}) endif() -if(NOT MSVC) + +# try to find libm +find_library(M_LIBRARIES m) +if(M_LIBRARIES OR CMAKE_C_COMPILER_ID STREQUAL "TinyCC") list(APPEND qjs_libs m) endif()