diff options
| author | Xavier Del Campo Romero <xavi.dcr@tutanota.com> | 2023-10-15 22:37:11 +0200 |
|---|---|---|
| committer | Xavier Del Campo Romero <xavi.dcr@tutanota.com> | 2023-10-25 13:45:12 +0200 |
| commit | b2be8b4658deea570b2a1890b6b45a7b2e95b615 (patch) | |
| tree | 3e15b4277bc1a97c9c5f3ed9c0031f6c1a3d26e2 /cmake | |
| parent | fc3db3927747fc98fb1378f46f232ef932b773e0 (diff) | |
| download | slcl-b2be8b4658deea570b2a1890b6b45a7b2e95b615.tar.gz | |
CMake: Find system libweb or dynstr if available
So far, slcl's build system would always build libweb and dynstr.
However, this is discouraged by distribution packagers.
Diffstat (limited to 'cmake')
| -rw-r--r-- | cmake/Findweb.cmake | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/cmake/Findweb.cmake b/cmake/Findweb.cmake new file mode 100644 index 0000000..a5d1d68 --- /dev/null +++ b/cmake/Findweb.cmake @@ -0,0 +1,24 @@ +mark_as_advanced(WEB_LIBRARY WEB_INCLUDE_DIR) +find_library(WEB_LIBRARY NAMES libweb web) + +find_path(WEB_INCLUDE_DIR + NAMES + handler.h + html.h + http.h + server.h + wildcard_cmp.h + PATH_SUFFIXES libweb include/libweb) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(web + DEFAULT_MSG WEB_LIBRARY WEB_INCLUDE_DIR) + +if(WEB_FOUND) + if(NOT TARGET web) + add_library(web UNKNOWN IMPORTED) + set_target_properties(web PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${WEB_INCLUDE_DIR}" + IMPORTED_LOCATION "${WEB_LIBRARY}") + endif() +endif() |
