Fix linking with libm

Fixes using clang's MSVC ABI.

Fixes: https://github.com/quickjs-ng/quickjs/issues/728
This commit is contained in:
Oliver 2024-12-04 00:15:20 -06:00 committed by GitHub
parent a41771f735
commit ebc1a655b4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -212,7 +212,10 @@ find_package(Threads)
if(NOT CMAKE_SYSTEM_NAME STREQUAL "WASI") if(NOT CMAKE_SYSTEM_NAME STREQUAL "WASI")
list(APPEND qjs_libs ${CMAKE_THREAD_LIBS_INIT}) list(APPEND qjs_libs ${CMAKE_THREAD_LIBS_INIT})
endif() 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) list(APPEND qjs_libs m)
endif() endif()