Disable libjerry-math by default (#4428)

Normally, it is more usual and safe to use a toolchain's native
math library. Especially, if multiple components of a project use
math functions, in which case all components should be linked
against the same libm.

The libjerry-math can be used, of course, but as it needs extra
care and consideration, it should be opt-in.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
This commit is contained in:
Akos Kiss
2021-01-08 11:37:46 +01:00
committed by GitHub
parent 0a3aa0f48b
commit d161e2d9ed
8 changed files with 14 additions and 14 deletions
+8
View File
@@ -16,6 +16,8 @@ cmake_minimum_required (VERSION 2.8.12)
set(JERRY_CORE_NAME jerry-core)
project (${JERRY_CORE_NAME} C)
include(CheckLibraryExists)
# Optional build settings
set(ENABLE_ALL_IN_ONE OFF CACHE BOOL "Enable all-in-one build?")
@@ -413,6 +415,12 @@ endif()
if(JERRY_MATH)
target_link_libraries(${JERRY_CORE_NAME} jerry-math)
set(JERRY_CORE_PKGCONFIG_REQUIRES libjerry-math)
else()
check_library_exists(m sin "" HAVE_M_LIB)
if(HAVE_M_LIB)
target_link_libraries(${JERRY_CORE_NAME} m)
set(JERRY_CORE_PKGCONFIG_LIBS "${JERRY_CORE_PKGCONFIG_LIBS} -lm")
endif()
endif()
separate_arguments(EXTERNAL_LINK_LIBS)