Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • U uchardet
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 14
    • Issues 14
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • uchardet
  • uchardet
  • Issues
  • #24
Closed
Open
Issue created Jul 26, 2021 by Pedro López-Cabanillas@plclContributor

Support cmake exported targets

If cmake exported targets are implemented in uchardet, a downstream project using CMake can find and link the libuchardet library directly with cmake (without needing pkg-config at all) this way:

project(sample LANGUAGES C)
find_package ( uchardet )
if (uchardet_FOUND)
  add_executable( sample sample.c )
  target_link_libraries ( sample PRIVATE uchardet::libuchardet )
endif ()

The build system should create one exported target for each built target feature, for instance:

  • The executable uchardet::uchardet
  • The shared library uchardet::libuchardet
  • The static library uchardet::libuchardet_static

After installing the project in a prefix like "$HOME/uchardet/", the downstream project can be configured with a command like:

cmake -DCMAKE_PREFIX_PATH="$HOME/uchardet/;..."

Instead of installing, the build directory can be used directly, for instance:

cmake -Duchardet_DIR="$HOME/build-uchardet-0.1.0/" ...
Assignee
Assign to
Time tracking