Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add FinduSockets.cmake and FinduWebSockets.cmake find-modules #421

Merged
merged 9 commits into from
Jan 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [Unreleased Minor]

### Added

* Added `FinduSockets` and `FinduWebSockets` find modules (https://github.com/robotology/ycm/pull/421).

### Changed

* Update Catch vendored files from v2.13.4 to v3.2.1 (https://github.com/robotology/ycm/pull/422).
Expand Down
2 changes: 2 additions & 0 deletions find-modules/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ set(YCM_FIND_MODULES FindACE.cmake
FindSQLite.cmake
FindStage.cmake
FindTinyXML.cmake
FinduSockets.cmake
FinduWebSockets.cmake
FindYamlCpp.cmake
FindZFP.cmake)

Expand Down
31 changes: 31 additions & 0 deletions find-modules/FinduSockets.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# SPDX-FileCopyrightText: 2023 Istituto Italiano di Tecnologia (IIT)
# SPDX-License-Identifier: BSD-3-Clause

#[=======================================================================[.rst:
FinduSockets
-----------

The following imported targets are created:

uSockets::uSockets

#]=======================================================================]

include(FindPackageHandleStandardArgs)

find_path(uSockets_INCLUDE_DIR libusockets.h)
mark_as_advanced(uSockets_INCLUDE_DIR)
find_library(uSockets_LIBRARY uSockets libuSockets)
mark_as_advanced(uSockets_LIBRARY)

find_package_handle_standard_args(uSockets DEFAULT_MSG uSockets_INCLUDE_DIR uSockets_LIBRARY)

if(uSockets_FOUND)
if(NOT TARGET uSockets::uSockets)
add_library(uSockets::uSockets UNKNOWN IMPORTED)
set_target_properties(uSockets::uSockets PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${uSockets_INCLUDE_DIR}")
set_property(TARGET uSockets::uSockets PROPERTY
IMPORTED_LOCATION "${uSockets_LIBRARY}")
endif()
endif()
41 changes: 41 additions & 0 deletions find-modules/FinduWebSockets.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# SPDX-FileCopyrightText: 2023 Istituto Italiano di Tecnologia (IIT)
# SPDX-License-Identifier: BSD-3-Clause

#[=======================================================================[.rst:
FinduWebSockets
-----------

Find the uWebSockets library.

The following imported targets are created:

uWebSockets::uWebSockets

#]=======================================================================]

include(FindPackageHandleStandardArgs)
include(CMakeFindDependencyMacro)

find_dependency(uSockets REQUIRED)
find_dependency(ZLIB REQUIRED)

# We do not use WebSocket.h as it has the same name of a
# Windows system header, found for example in
# C:/Program Files (x86)/Windows Kits/10/Include/10.0.19041.0/um
find_path(uWebSockets_INCLUDE_DIR WebSocketProtocol.h PATH_SUFFIXES uWebSockets uwebsockets)

mark_as_advanced(uWebSockets_INCLUDE_DIR)

find_package_handle_standard_args(uWebSockets DEFAULT_MSG uWebSockets_INCLUDE_DIR)

if(uWebSockets_FOUND)
if(NOT TARGET uWebSockets::uWebSockets)
add_library(uWebSockets::uWebSockets INTERFACE IMPORTED)
set_target_properties(uWebSockets::uWebSockets PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${uWebSockets_INCLUDE_DIR}")
set_target_properties(uWebSockets::uWebSockets PROPERTIES
INTERFACE_LINK_LIBRARIES ZLIB::ZLIB)
set_property(TARGET uWebSockets::uWebSockets APPEND PROPERTY
INTERFACE_LINK_LIBRARIES uSockets::uSockets)
endif()
endif()