cmake: correct find modules

This commit is contained in:
Alexandre Bouvier
2022-12-06 04:17:44 +01:00
parent 7c68f93bdf
commit bb3440f7c4
6 changed files with 49 additions and 52 deletions

View File

@ -4,10 +4,7 @@
find_package(PkgConfig QUIET)
if (PKG_CONFIG_FOUND)
pkg_search_module(ENET QUIET IMPORTED_TARGET GLOBAL libenet)
if (ENET_FOUND)
add_library(enet::enet ALIAS PkgConfig::ENET)
endif()
pkg_search_module(ENET QUIET IMPORTED_TARGET libenet)
endif()
include(FindPackageHandleStandardArgs)
@ -15,3 +12,7 @@ find_package_handle_standard_args(enet
REQUIRED_VARS ENET_LINK_LIBRARIES
VERSION_VAR ENET_VERSION
)
if (enet_FOUND AND NOT TARGET enet::enet)
add_library(enet::enet ALIAS PkgConfig::ENET)
endif()