Skip to content

[C++] Use the CMake's standard find features #15952

@asfimport

Description

@asfimport

From #3469 (comment)

We implement our custom find codes to find libraries by find_library()/find_path() with NO_DEFAULT_PATH. So we need to handle lib64/ (on Red Hat) and lib/x86_64-linux-gnu/ (on Debian) paths manually.

If we use the CMake's standard find features such as CMAKE_PREFIX_PATH https://cmake.org/cmake/help/v3.13/variable/CMAKE_PREFIX_PATH.html#variable:CMAKE_PREFIX_PATH , we can remove our custom find codes.

CMake has package specific find path feature by <PackageName}_ROOT since 3.12. It's equivalent of our <PackageName}_HOME.

https://cmake.org/cmake/help/v3.12/command/find_library.html

If called from within a find module loaded by find_package(<PackageName>), search prefixes unique to the current package being found. Specifically look in the <PackageName>_ROOT CMake variable and the <PackageName>_ROOT environment variable. The package root variables are maintained as a stack so if called from nested find modules, root paths from the parent’s find module will be searched after paths from the current module, i.e. <CurrentPackage>_ROOT, ENV\{<CurrentPackage>_ROOT}, <ParentPackage>_ROOT, ENV\{<ParentPackage>_ROOT}, etc.

Reporter: Kouhei Sutou / @kou
Assignee: Uwe Korn / @xhochy

Subtasks:

Related issues:

Note: This issue was originally created as ARROW-4383. Please see the migration documentation for further details.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions