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 CMake Config-file package #260

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

kevinAlbs
Copy link

@kevinAlbs kevinAlbs commented Jan 15, 2024

Summary

This PR resolves #250 by creating CMake Config-file Package.

Motivation

https://cmake.org/cmake/help/latest/manual/cmake-packages.7.html#config-file-packages notes:

Config-file packages are provided by upstream vendors as part of development packages, that is, they belong with the header files and any other files provided to assist downstreams in using the package

Including a CMake Config-file Package enables CMake consumers to use find_package to find and use utf8proc:

add_executable (app app.c)
find_package (utf8proc 2.9.0 REQUIRED)
target_link_libraries (app PRIVATE utf8proc::utf8proc)

The absence of a CMake Config-file Package may add difficulty using utf8proc in a CMake project. For example: the MongoDB C driver includes FindUtf8Proc.cmake using pkg-config. However, using pkg-config is not suitable for consumers building with MSVC (the -l and -L flags are unrecognized).

Use of relative paths in 422de38 is intended to make the installed package relocatable.

@kevinAlbs kevinAlbs changed the title Add cmake config file package Add CMake Config-file package Jan 15, 2024
@kevinAlbs kevinAlbs marked this pull request as ready for review January 15, 2024 15:58
CMakeLists.txt Outdated Show resolved Hide resolved
CMakeLists.txt Outdated Show resolved Hide resolved
CMakeLists.txt Outdated
)
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/utf8proc-config-version.cmake"
COMPATIBILITY AnyNewerVersion
Copy link

Choose a reason for hiding this comment

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

It seems that utf8proc follows the semantic versioning. SameMajorVersion may be better.

CMakeLists.txt Outdated Show resolved Hide resolved
README.md Outdated
Comment on lines 45 to 54
## Using with CMake

A CMake Config-file package is provided. To use utf8proc in a CMake project:

```cmake
add_executable (app app.c)
find_package (utf8proc 2.9.0 REQUIRED)
target_link_libraries (app PRIVATE utf8proc::utf8proc)
```

Copy link

Choose a reason for hiding this comment

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

It seems that Using other compilers is a subsection of Quick Start.
How about moving this after Using other compilers?

@kevinAlbs
Copy link
Author

Thank you for the review @kou. Feedback has been applied.

@kevinAlbs kevinAlbs requested a review from kou June 7, 2024 17:00
Copy link

@kou kou left a comment

Choose a reason for hiding this comment

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

+1

(But I'm not a maintainer of this project. I just an user of this project.)

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.

CMake export configuration missing
2 participants