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

Added options to command find_package #228

Merged
merged 1 commit into from
May 30, 2024
Merged

Added options to command find_package #228

merged 1 commit into from
May 30, 2024

Conversation

bmarques1995
Copy link
Contributor

Now is possible to use the command find_package with cmake to find nghttp3

@tatsuhiro-t
Copy link
Member

@vszakats What do you think about this change?

Comment on lines 78 to 91
write_basic_package_version_file(
"${NGHTTP3_VERSION_CONFIG}" VERSION ${NGHTTP3_VERSION} COMPATIBILITY SameMajorVersion
)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules/config.cmake.in" "${NGHTTP3_PROJECT_CONFIG}" @ONLY)

# Install cmake config files
install(
FILES "${NGHTTP3_PROJECT_CONFIG}" "${NGHTTP3_VERSION_CONFIG}"
DESTINATION "${NGHTTP3_CONFIG_INSTALL_DIR}")

install(
EXPORT "${NGHTTP3_TARGETS_EXPORT_NAME}"
NAMESPACE "${NGHTTP3_NAMESPACE}"
DESTINATION "${NGHTTP3_CONFIG_INSTALL_DIR}")
Copy link
Contributor

@vszakats vszakats May 28, 2024

Choose a reason for hiding this comment

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

Suggested change
write_basic_package_version_file(
"${NGHTTP3_VERSION_CONFIG}" VERSION ${NGHTTP3_VERSION} COMPATIBILITY SameMajorVersion
)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules/config.cmake.in" "${NGHTTP3_PROJECT_CONFIG}" @ONLY)
# Install cmake config files
install(
FILES "${NGHTTP3_PROJECT_CONFIG}" "${NGHTTP3_VERSION_CONFIG}"
DESTINATION "${NGHTTP3_CONFIG_INSTALL_DIR}")
install(
EXPORT "${NGHTTP3_TARGETS_EXPORT_NAME}"
NAMESPACE "${NGHTTP3_NAMESPACE}"
DESTINATION "${NGHTTP3_CONFIG_INSTALL_DIR}")
write_basic_package_version_file(
"${NGHTTP3_VERSION_CONFIG}" VERSION ${NGHTTP3_VERSION} COMPATIBILITY SameMajorVersion
)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules/config.cmake.in" "${NGHTTP3_PROJECT_CONFIG}" @ONLY)
# Install cmake config files
install(
FILES "${NGHTTP3_PROJECT_CONFIG}" "${NGHTTP3_VERSION_CONFIG}"
DESTINATION "${NGHTTP3_CONFIG_INSTALL_DIR}")
install(
EXPORT "${NGHTTP3_TARGETS_EXPORT_NAME}"
NAMESPACE "${NGHTTP3_NAMESPACE}"
DESTINATION "${NGHTTP3_CONFIG_INSTALL_DIR}")

nits: whitespace/indentation

DESTINATION "${CMAKE_INSTALL_LIBDIR}")
endif()

install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libnghttp3.pc"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change

nit: delete extra newline at the end of file.

@@ -0,0 +1,3 @@
include(CMakeFindDependencyMacro)

include("${CMAKE_CURRENT_LIST_DIR}/@NGHTTP3_TARGETS_EXPORT_NAME@.cmake")
Copy link
Contributor

@vszakats vszakats May 28, 2024

Choose a reason for hiding this comment

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

A newline is missing at he end of this file.

What do you think of moving this file to the existing cmake directory instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's okay for me

@tatsuhiro-t
Copy link
Member

@vszakats Thank you for the quick review!

@bmarques1995
Copy link
Contributor Author

@vszakats Thank you for the quick review!

I've modified the files, I've moved the pkgconfig to the end of the CMakeLists.txt, where it was located originally, about the modifications suggested by @vszakats, i perceived that the snippets indicated by him was at same identation level of the entry script, meaning without identation. I've moved the config.cmake.in to the same CMakeLists.txt dir.

@vszakats
Copy link
Contributor

Thanks @bmarques1995. Looks good to me, also agreeing on the lib directory for the new file.

@tatsuhiro-t
Copy link
Member

lib/config.cmake.in needs to be added to

EXTRA_DIST = CMakeLists.txt sfparse/COPYING
so that generated archive file contains it.

@bmarques1995
Copy link
Contributor Author

bmarques1995 commented May 29, 2024

Could u test again? And how do i test by myself?

@tatsuhiro-t tatsuhiro-t merged commit 57eef59 into ngtcp2:main May 30, 2024
20 checks passed
@tatsuhiro-t
Copy link
Member

Thank you for PR. Merged now.

@tatsuhiro-t tatsuhiro-t added this to the v1.4.0 milestone May 30, 2024
@bmarques1995 bmarques1995 mentioned this pull request Jul 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants