From f3d2772ec01a7f341e1ece22812933b6ef83b020 Mon Sep 17 00:00:00 2001 From: Walter Schell Date: Mon, 11 Jan 2021 20:13:09 -0500 Subject: [PATCH] CMakeLists.txt: Make libm dep conditional on UNIX --- lua-5.4.0/CMakeLists.txt | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/lua-5.4.0/CMakeLists.txt b/lua-5.4.0/CMakeLists.txt index d80b4b3..4b54f90 100644 --- a/lua-5.4.0/CMakeLists.txt +++ b/lua-5.4.0/CMakeLists.txt @@ -32,17 +32,20 @@ set(LUA_LIB_SRCS "src/lutf8lib.c" "src/linit.c" ) -#TODO: Redo this with find_package -find_library(LIBM m) -if(NOT LIBM) - message(FATAL_ERROR "libm not found and requred by lua") -endif() + add_library(lua_static STATIC ${LUA_LIB_SRCS}) set_target_properties(lua_static PROPERTIES OUTPUT_NAME "lua") -target_link_libraries(lua_static INTERFACE ${LIBM}) target_include_directories(lua_static PUBLIC "include") set(LUA_DEFINITIONS) if(UNIX) + + find_library(LIBM m) + #TODO: Redo this with find_package + if(NOT LIBM) + message(FATAL_ERROR "libm not found and requred by lua") + endif() + target_link_libraries(lua_static INTERFACE ${LIBM}) + list(APPEND LUA_DEFINITIONS LUA_USE_POSIX) if(LUA_SUPPORT_DL) target_compile_definitions(lua_static PRIVATE "LUA_USE_DLOPEN")