rapids_find_generate_module

Added in version v21.06.00.

Generate a Find*.cmake module for the requested package

rapids_find_generate_module( <PackageName>
                HEADER_NAMES <paths...>
                [LIBRARY_NAMES <names...>]
                [INCLUDE_SUFFIXES <suffixes...>]
                [VERSION <version>]
                [NO_CONFIG]
                [INITIAL_CODE_BLOCK <code_block_variable>]
                [FINAL_CODE_BLOCK <code_block_variable>]
                [BUILD_EXPORT_SET <name>]
                [INSTALL_EXPORT_SET <name>]
                )

Generates a custom Find module for the requested package. Makes it easier for projects to look for packages that don’t have an existing FindModule or don’t provide a CONFIG module when installed.

Note

If you are using this for a module that is part of your BUILD or INSTALL export set, it is highly likely that this needs to be part of the same export sets.

HEADER_NAMES

Header names that should be provided to find_path() to determine the include directory of the package. If provided a list of names only one needs to be found for a directory to be considered a match

LIBRARY_NAMES

library names that should be provided to find_library() to determine the include directory of the package. If provided a list of names only one needs to be found for a directory to be considered a match

Note

Every entry that doesn’t start with lib will also be searched for as lib<name>

INCLUDE_SUFFIXES

Extra relative sub-directories to use while searching for HEADER_NAMES.

VERSION

Will append extra entries of the library to search for based on the content of LIBRARY_NAMES:

  • <name><version>

  • <name>.<version>

  • lib<name><version>

  • lib<name>.<version>

This ordering is done explicitly to follow CMake recommendations for searching for versioned libraries:

“We recommend specifying the unversioned name first so that locally-built packages can be found before those provided by distributions.”

NO_CONFIG

When provided will stop the generated Find Module from first searching for the projects shipped Find Config.

INITIAL_CODE_BLOCK

Optional value of the variable that holds a string of code that will be executed as the first step of this config file.

Note: This requires the code block variable instead of the contents so that we can properly insert CMake code

FINAL_CODE_BLOCK

Optional value of the variable that holds a string of code that will be executed as the last step of this config file.

Note: This requires the code block variable instead of the contents so that we can properly insert CMake code

BUILD_EXPORT_SET

Record that this custom FindPackage module needs to be part of our build directory export set. This means that it will be usable by the calling package if it needs to search for <PackageName> again.

INSTALL_EXPORT_SET

Record that this custom FindPackage module needs to be part of our install export set. This means that it will be installed as part of our packages CMake export set infrastructure

Result Variables

CMAKE_MODULE_PATH will be modified to include the folder where Find<PackageName>.cmake is located.

Example on how to properly use rapids_find_generate_module():

...

rapids_find_generate_module(
  RDKAFKA
  HEADER_NAMES rdkafkacpp.h
  LIBRARY_NAMES rdkafka++
  BUILD_EXPORT_SET consumer-exports
  INSTALL_EXPORT_SET consumer-exports
)
rapids_find_package(
  RDKAFKA REQUIRED
  BUILD_EXPORT_SET consumer-exports
  INSTALL_EXPORT_SET consumer-exports
)