Skip to content

Conversation

jonringer
Copy link
Contributor

Was iterating on this package for Nixpkgs, and found it difficult to consume the .cmake configurations as get_filename_component(_INSTALL_PREFIX "${LIBEVENT_CMAKE_DIR}/../../.." ABSOLUTE) was not always true.

This should be a no-op for most libevent package maintainers.

azat
azat previously approved these changes Oct 29, 2021
@azat azat self-assigned this Nov 5, 2021
Copy link
Member

@azat azat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

But this breaks the export test - https://github.com/libevent/libevent/runs/4050571079?check_suite_focus=true

Can you please take a look?

@jonringer
Copy link
Contributor Author

The test failures were coming from the tests not being able to find LibeventConfig.cmake.

I removed the surrounding code which deletes the file and then regenerates it for the test cases. The tests were able to pass locally.

@@ -1546,18 +1546,9 @@ set(EVENT_INSTALL_CMAKE_DIR

export(PACKAGE libevent)

function(gen_package_config forinstall)
if(${forinstall})
set(CONFIG_FOR_INSTALL_TREE 1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, CONFIG_FOR_INSTALL_TREE can be removed from cmake/LibeventConfig.cmake.in?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see why not. It's being installed to ${CMAKE_BINARY_DIR}, similar to the other .cmake files

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But if we will remove CONFIG_FOR_INSTALL_TREE code, then LIBEVENT_INCLUDE_DIRS will be incorrect.

if(CONFIG_FOR_INSTALL_TREE)
## Config for install tree ----------------------------------------
# Find includes
unset(_event_h CACHE)
find_path(_event_h
NAMES event2/event.h
PATHS "${_INSTALL_PREFIX}/include"
NO_DEFAULT_PATH)
if(_event_h)
set(LIBEVENT_INCLUDE_DIRS "${_event_h}")
message_if_needed(STATUS "Found libevent include directory: ${_event_h}")
else()
message_if_needed(WARNING "Your libevent library does not contain header files!")
endif()
# Find libraries
macro(find_event_lib _comp)
unset(_event_lib CACHE)
find_library(_event_lib
NAMES "event_${_comp}"
PATHS "${_INSTALL_PREFIX}/lib"
NO_DEFAULT_PATH)
if(_event_lib)
list(APPEND LIBEVENT_LIBRARIES "libevent::${_comp}")
set_case_insensitive_found(${_comp})
message_if_needed(STATUS "Found libevent component: ${_event_lib}")
else()
no_component_msg(${_comp})
endif()
endmacro()
foreach(comp ${_EVENT_COMPONENTS})
find_event_lib(${comp})
endforeach()
else()

P.S. Sorry for the delay.

@tristan957
Copy link

What is the status on this PR? It would be nice to add this to the next release of libevent. I don't mind trying to take over the PR.

@azat
Copy link
Member

azat commented Jun 30, 2022

What is the status on this PR? It would be nice to add this to the next release of libevent. I don't mind trying to take over the PR.

I think you can continue it. You can base you patches on top of this to preserve author, as long as you not completely change the patch. Thanks!

@jonringer
Copy link
Contributor Author

sorry, I keep dropping things due to how many balls I'm trying to juggle. If you would like to take over, please do so!

I'll be happy to review :)

@azat
Copy link
Member

azat commented Jul 9, 2022

@tristan957 are you going to finish this?

@azat azat removed their assignment Jul 9, 2022
@tristan957
Copy link

I have it on my list, but if someone else gets to it before I do even better.

@azat azat mentioned this pull request Jul 10, 2022
21 tasks
@azat azat self-assigned this Jul 10, 2022
@azat azat force-pushed the use-gnu-install branch from ea73125 to 3bdb5e8 Compare July 10, 2022 10:52
@azat
Copy link
Member

azat commented Nov 20, 2022

This is still a problem - #1221 (comment)

Though by some reason our test for export does not shows the problem.
This should be investigated.

@azat
Copy link
Member

azat commented May 14, 2023

Merged in #1397

@azat azat closed this May 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants