Skip to content

Commit 389cfe9

Browse files
authored
Merge pull request #705 from jengelh/bld
Fix link failure
2 parents 72cca13 + 15c4871 commit 389cfe9

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

CMakeLists.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,14 +180,22 @@ endif()
180180

181181
find_package(SDL3 REQUIRED CONFIG REQUIRED COMPONENTS SDL3)
182182
find_package(glm REQUIRED)
183-
if (TARGET httlib::httplib)
183+
find_package(httplib QUIET)
184+
if (TARGET httplib::httplib)
184185
add_library(httplib ALIAS httplib::httplib)
185186
else()
186187
# Some Linux distributions do not package httplibConfig.cmake, so find the header manually
187188
find_file(CPP_HTTPLIB_HEADER httplib.h REQUIRED)
189+
find_library(CPP_HTTPLIB_LIB cpp-httplib QUIET)
188190

189191
# The target httplib::httplib cannot be created manually, so rename it
190192
add_library(httplib INTERFACE ${CPP_HTTPLIB_HEADER})
193+
194+
# And some Linux distributions build httplib as header-only,
195+
# and some as header+library. What a mess!
196+
if (NOT ${CPP_HTTPLIB_LIB} STREQUAL "CPP_HTTPLIB_LIB-NOTFOUND")
197+
target_link_libraries(httplib INTERFACE ${CPP_HTTPLIB_LIB})
198+
endif ()
191199
endif()
192200
find_package(ZLIB REQUIRED)
193201
find_package(plog REQUIRED)

0 commit comments

Comments
 (0)