Compare commits

..

12 Commits

Author SHA1 Message Date
Sara Dickinson a9dc8df77d b 2023-06-21 16:39:47 +01:00
Sara Dickinson f80d482511 a 2023-06-21 16:34:37 +01:00
Sara Dickinson 0e52e8c87b more debug 2023-06-21 16:31:45 +01:00
Sara Dickinson d34120ed31 a 2023-06-21 15:58:43 +01:00
Sara Dickinson 12bca2ac09 try to see the build type 2023-06-21 15:50:30 +01:00
Sara Dickinson df1bbe2811 try force 2023-06-21 15:26:11 +01:00
Sara Dickinson b058dd7bc9 remove quite 2023-06-21 15:02:53 +01:00
Sara Dickinson 2a75e1a9ea more debug 2023-06-21 13:34:37 +01:00
Sara Dickinson 3cf9aa8f9e see what libuv does 2023-06-21 13:23:01 +01:00
Sara Dickinson 371345ac96 more messages 2023-06-21 12:00:41 +01:00
Sara Dickinson a6fcc49b1f message 2023-06-21 11:54:23 +01:00
Sara Dickinson b15cecfb30 Revert "Test reverting FindLibevent2"
This reverts commit c7b3f29f62.
2023-06-21 11:50:32 +01:00
4 changed files with 71 additions and 36 deletions

View File

@ -1,15 +1,22 @@
#[=======================================================================[.rst: #[=======================================================================[.rst:
FindLibevent2 FindLibevent2
------------- -------------
Find the Libevent2 library. For now this finds the core library only. Find the Libevent2 library. For now this finds the core library only.
Imported targets Imported targets
^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^
This module defines the following :prop_tgt:`IMPORTED` targets: This module defines the following :prop_tgt:`IMPORTED` targets:
``Libevent2::Libevent_core`` ``Libevent2::Libevent_core``
The Libevent2 library, if found. The Libevent2 library, if found.
Result variables Result variables
^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^
This module will set the following variables in your project: This module will set the following variables in your project:
``Libevent2_FOUND`` ``Libevent2_FOUND``
If false, do not try to use Libevent2. If false, do not try to use Libevent2.
``LIBEVENT2_INCLUDE_DIR`` ``LIBEVENT2_INCLUDE_DIR``
@ -21,42 +28,61 @@ This module will set the following variables in your project:
#]=======================================================================] #]=======================================================================]
find_path(LIBEVENT2_INCLUDE_DIR event2/event.h find_package(PkgConfig)
HINTS if (PKG_CONFIG_FOUND)
"${LIBEVENT2_DIR}" message("**** PKG_CONFIG_FOUND is TRUE and Build type is " ${CMAKE_BUILD_TYPE})
"${LIBEVENT2_DIR}/include" pkg_check_modules(PkgLibevent IMPORTED_TARGET GLOBAL libevent>=2)
) endif ()
find_library(LIBEVENT2_LIBRARY NAMES event_core libevent_core if (PkgLibevent_FOUND)
HINTS message("PkgLibevent_INCLUDE_DIRS : " ${PkgLibevent_INCLUDE_DIRS})
"${LIBEVENT2_DIR}" message("Hello world 1: " ${Libevent2_FOUND} " " ${LIBEVENT2_INCLUDE_DIR} " " ${LIBEVENT2_LIBRARIES} " " ${LIBEVENT2_VERSION})
"${LIBEVENT2_DIR}/lib" set(LIBEVENT2_INCLUDE_DIR ${PkgLibevent_INCLUDE_DIRS} CACHE FILEPATH "libevent2 include path" FORCE)
) set(LIBEVENT2_LIBRARIES ${PkgLibevent_LIBRARIES} CACHE STRING "libevent2 libraries" FORCE)
set(LIBEVENT2_VERSION ${PkgLibevent_VERSION})
set(LIBEVENT2_LIBRARIES "") add_library(Libevent2::Libevent_core ALIAS PkgConfig::PkgLibevent)
set(Libevent2_FOUND ON)
if (LIBEVENT2_INCLUDE_DIR AND LIBEVENT2_LIBRARY) else ()
if (NOT TARGET Libevent2::Libevent_core) find_path(LIBEVENT2_INCLUDE_DIR event2/event.h
add_library(Libevent2::Libevent_core UNKNOWN IMPORTED) HINTS
set_target_properties(Libevent2::Libevent_core PROPERTIES "${LIBEVENT2_DIR}"
INTERFACE_INCLUDE_DIRECTORIES "${LIBEVENT2_INCLUDE_DIR}" "${LIBEVENT2_DIR}/include"
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION "${LIBEVENT2_LIBRARY}"
)
endif ()
if (NOT LIBEVENT2_VERSION AND LIBEVENT2_INCLUDE_DIR AND EXISTS "${LIBEVENT2_INCLUDE_DIR}/event2/event.h")
file(STRINGS "${LIBEVENT2_INCLUDE_DIR}/event2/event-config.h" LIBEVENT2_H REGEX "^#define _?EVENT_+VERSION ")
string(REGEX REPLACE "^.*EVENT_+VERSION \"([^\"]+)\".*$" "\\1" LIBEVENT2_VERSION "${LIBEVENT2_H}")
endif ()
endif()
list(APPEND LIBEVENT2_LIBRARIES "${LIBEVENT2_LIBRARY}")
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Libevent2
REQUIRED_VARS LIBEVENT2_LIBRARIES LIBEVENT2_INCLUDE_DIR
VERSION_VAR LIBEVENT2_VERSION
) )
mark_as_advanced(LIBEVENT2_INCLUDE_DIR LIBEVENT2_LIBRARIES LIBEVENT2_LIBRARY) message("Hello world 2: " ${Libevent2_FOUND} " " ${LIBEVENT2_INCLUDE_DIR} " " ${LIBEVENT2_LIBRARIES} " " ${LIBEVENT2_VERSION})
find_library(LIBEVENT2_LIBRARIES NAMES event_core libevent_core
HINTS
"${LIBEVENT2_DIR}"
"${LIBEVENT2_DIR}/lib"
)
if (LIBEVENT2_INCLUDE_DIR AND LIBEVENT2_LIBRARIES)
if (NOT TARGET Libevent2::Libevent_core)
add_library(Libevent2::Libevent_core UNKNOWN IMPORTED)
set_target_properties(Libevent2::Libevent_core PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${LIBEVENT2_INCLUDE_DIR}"
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION "${LIBEVENT2_LIBRARIES}"
)
endif ()
if (NOT LIBEVENT2_VERSION AND LIBEVENT2_INCLUDE_DIR AND EXISTS "${LIBEVENT2_INCLUDE_DIR}/event2/event.h")
file(STRINGS "${LIBEVENT2_INCLUDE_DIR}/event2/event-config.h" LIBEVENT2_H REGEX "^#define _?EVENT_+VERSION ")
string(REGEX REPLACE "^.*EVENT_+VERSION \"([^\"]+)\".*$" "\\1" LIBEVENT2_VERSION "${LIBEVENT2_H}")
endif ()
endif ()
message("Hello world 3: " ${Libevent2_FOUND} " " ${LIBEVENT2_INCLUDE_DIR} " " ${LIBEVENT2_LIBRARIES} " " ${LIBEVENT2_VERSION})
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Libevent2
REQUIRED_VARS LIBEVENT2_LIBRARIES LIBEVENT2_INCLUDE_DIR
VERSION_VAR LIBEVENT2_VERSION
)
endif ()
message("Hello world 4" ${Libevent2_FOUND} " " ${LIBEVENT2_INCLUDE_DIR} " " ${LIBEVENT2_LIBRARIES} " " ${LIBEVENT2_VERSION})
mark_as_advanced(LIBEVENT2_INCLUDE_DIR LIBEVENT2_LIBRARIES)

View File

@ -39,6 +39,7 @@ if (PkgLibIdn2_FOUND)
set(LIBIDN2_VERSION ${PkgLibIdn2_VERSION}) set(LIBIDN2_VERSION ${PkgLibIdn2_VERSION})
add_library(Libidn2::Libidn2 ALIAS PkgConfig::PkgLibIdn2) add_library(Libidn2::Libidn2 ALIAS PkgConfig::PkgLibIdn2)
set(Libidn2_FOUND ON) set(Libidn2_FOUND ON)
message("Hello world 1: " ${Libidn2_FOUND} " " ${LIBIDN2_INCLUDE_DIR} " " ${LIBIDN2_LIBRARIES} " " ${LIBIDN2_VERSION})
else () else ()
find_path(LIBIDN2_INCLUDE_DIR idn2.h find_path(LIBIDN2_INCLUDE_DIR idn2.h
HINTS HINTS

View File

@ -39,6 +39,7 @@ if (PkgLibunbound_FOUND)
set(LIBUNBOUND_VERSION ${PkgLibunbound_VERSION}) set(LIBUNBOUND_VERSION ${PkgLibunbound_VERSION})
add_library(Libunbound::Libunbound ALIAS PkgConfig::PkgLibunbound) add_library(Libunbound::Libunbound ALIAS PkgConfig::PkgLibunbound)
set(Libunbound_FOUND ON) set(Libunbound_FOUND ON)
message("Hello world 1: " ${Libidn2_FOUND} " " ${LIBIDN2_INCLUDE_DIR} " " ${LIBIDN2_LIBRARIES} " " ${LIBIDN2_VERSION})
else () else ()
find_path(LIBUNBOUND_INCLUDE_DIR unbound.h find_path(LIBUNBOUND_INCLUDE_DIR unbound.h
HINTS HINTS

View File

@ -39,6 +39,7 @@ if (PkgLibuv_FOUND)
set(LIBUV_VERSION ${PkgLibuv_VERSION}) set(LIBUV_VERSION ${PkgLibuv_VERSION})
add_library(Libuv::Libuv ALIAS PkgConfig::PkgLibuv) add_library(Libuv::Libuv ALIAS PkgConfig::PkgLibuv)
set(Libuv_FOUND ON) set(Libuv_FOUND ON)
message("Libvu 1: " ${Libuv_FOUND} " " ${LIBUV_INCLUDE_DIR} " " ${LIBUV_LIBRARIES} " " ${LIBUV_VERSION})
else () else ()
find_path(LIBUV_INCLUDE_DIR uv.h find_path(LIBUV_INCLUDE_DIR uv.h
HINTS HINTS
@ -52,6 +53,8 @@ else ()
"${LIBUV_DIR}/lib" "${LIBUV_DIR}/lib"
) )
message("Libvu 2: " ${Libuv_FOUND} " " ${LIBUV_INCLUDE_DIR} " " ${LIBUV_LIBRARIES} " " ${LIBUV_VERSION})
if (LIBUV_INCLUDE_DIR AND LIBUV_LIBRARIES) if (LIBUV_INCLUDE_DIR AND LIBUV_LIBRARIES)
if (NOT TARGET Libuv::Libuv) if (NOT TARGET Libuv::Libuv)
add_library(Libuv::Libuv UNKNOWN IMPORTED) add_library(Libuv::Libuv UNKNOWN IMPORTED)
@ -72,6 +75,8 @@ else ()
endif () endif ()
endif () endif ()
message("Libvu 3: " ${Libuv_FOUND} " " ${LIBUV_INCLUDE_DIR} " " ${LIBUV_LIBRARIES} " " ${LIBUV_VERSION})
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Libuv find_package_handle_standard_args(Libuv
REQUIRED_VARS LIBUV_LIBRARIES LIBUV_INCLUDE_DIR REQUIRED_VARS LIBUV_LIBRARIES LIBUV_INCLUDE_DIR
@ -79,4 +84,6 @@ else ()
) )
endif () endif ()
message("Libvu 4: " ${Libuv_FOUND} " " ${LIBUV_INCLUDE_DIR} " " ${LIBUV_LIBRARIES} " " ${LIBUV_VERSION})
mark_as_advanced(LIBUV_INCLUDE_DIR LIBUV_LIBRARIES) mark_as_advanced(LIBUV_INCLUDE_DIR LIBUV_LIBRARIES)