mirror of
https://github.com/walterschell/Lua.git
synced 2024-11-15 12:15:43 +08:00
CMakeLists.txt: Make libm dep conditional on UNIX
This commit is contained in:
parent
d6c62f3fcf
commit
f3d2772ec0
@ -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")
|
||||
|
Loading…
Reference in New Issue
Block a user