@@ -14,6 +14,17 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
1414 add_link_options ("-fvisibility=hidden" )
1515endif ()
1616
17+ ### Dependencies
18+ find_package (LuaJIT )
19+ if (LUAJIT_INCLUDE_DIR)
20+ set (LUA_INCLUDE_DIR ${LUAJIT_INCLUDE_DIR} )
21+ set (LUA_LIBRARIES ${LUAJIT_LIBRARIES} )
22+ else ()
23+ find_package (Lua 5.1 REQUIRED )
24+ endif ()
25+
26+ include_directories (${LUA_INCLUDE_DIR} )
27+
1728### "Libraries"
1829add_library (https MODULE
1930 lua/main.cpp
@@ -63,6 +74,9 @@ elseif (WIN32)
6374 option (USE_ANDROID_BACKEND "Use the Android Java backend (Android-only)" OFF )
6475
6576 option (USE_WINSOCK "Use winsock instead of BSD sockets (windows-only)" ON )
77+
78+ # Windows needs to link with Lua libraries
79+ target_link_libraries (https ${LUA_LIBRARIES} )
6680elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" )
6781 option (USE_CURL_BACKEND "Use the libcurl backend" OFF )
6882 option (USE_OPENSSL_BACKEND "Use the openssl backend" OFF )
@@ -71,6 +85,13 @@ elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
7185 option (USE_ANDROID_BACKEND "Use the Android Java backend (Android-only)" OFF )
7286
7387 option (USE_WINSOCK "Use winsock instead of BSD sockets (windows-only)" OFF )
88+
89+ if (NOT IOS )
90+ # macOS needs -undefined dynamic_lookup
91+ target_compile_definitions (https -undefined dynamic_lookup )
92+ else ()
93+ target_link_libraries (https ${LUA_LIBRARIES} )
94+ endif ()
7495elseif (ANDROID )
7596 option (USE_CURL_BACKEND "Use the libcurl backend" OFF )
7697 option (USE_OPENSSL_BACKEND "Use the openssl backend" OFF )
@@ -79,25 +100,16 @@ elseif (ANDROID)
79100 option (USE_ANDROID_BACKEND "Use the Android Java backend (Android-only)" ON )
80101
81102 option (USE_WINSOCK "Use winsock instead of BSD sockets (windows-only)" OFF )
103+
104+ # Android needs to link with Lua libraries
105+ target_link_libraries (https ${LUA_LIBRARIES} )
82106endif ()
83107option (DEBUG_SCHANNEL "Enable debug output in schannel backend" OFF )
84108
85109set_target_properties (https PROPERTIES PREFIX "" )
86110
87- ### Dependencies
88111target_link_libraries (https https-common )
89112
90- find_package (LuaJIT )
91- if (LUAJIT_INCLUDE_DIR)
92- set (LUA_INCLUDE_DIR ${LUAJIT_INCLUDE_DIR} )
93- set (LUA_LIBRARIES ${LUAJIT_LIBRARIES} )
94- else ()
95- find_package (Lua 5.1 REQUIRED )
96- endif ()
97-
98- include_directories (${LUA_INCLUDE_DIR} )
99- target_link_libraries (https ${LUA_LIBRARIES} )
100-
101113if (USE_CURL_BACKEND)
102114 set (HTTPS_BACKEND_CURL ON )
103115 find_package (CURL REQUIRED )
0 commit comments