[cmake-developers] [CMake 0015231]: find_package: should be a simple way to alter the order of the config/module lookups
Mantis Bug Tracker
mantis at public.kitware.com
Fri Oct 31 12:31:05 EDT 2014
The following issue has been SUBMITTED.
======================================================================
http://www.cmake.org/Bug/view.php?id=15231
======================================================================
Reported By: Charles Karney
Assigned To:
======================================================================
Project: CMake
Issue ID: 15231
Category: CMake
Reproducibility: N/A
Severity: feature
Priority: normal
Status: new
======================================================================
Date Submitted: 2014-10-31 12:31 EDT
Last Modified: 2014-10-31 12:31 EDT
======================================================================
Summary: find_package: should be a simple way to alter the
order of the config/module lookups
Description:
As we are integrating cmake more and more into our environment, it is
clear how much superior the config-mode for find_package is compared to
the module-mode. As a result, our top-level CMakeLists.txt contains
several occurrences of the following pattern
find_package (PROJ4 CONFIG QUIET)
if (NOT PROJ4_FOUND)
find_package (PROJ4 MODULE REQUIRED)
endif ()
Request 1: Add
MODULE_FIRST
CONFIG_FIRST
options to find_package, meaning do the module lookup first (the default
but see next) or the config lookup first. (These options complement the
MODULE and CONFIG options.) So the find_package invocation above
becomes
find_package (PROJ4 CONFIG_FIRST REQUIRED)
Request 2: Add a global variable, e.g., CMAKE_FIND_PACKAGE_PREFER_CONFIG
(default OFF) to specify the default lookup order. Thus if I've worked
to get all my dependent packages with config-mode support, I can invoke
cmake with
cmake -DCMAKE_FIND_PACKAGE_PREFER_CONFIG=ON ..
without having to edit the CMakeLists.txt file.
Finally a comment: the advice (not sure where from) that our current
pattern can be shortened to
find_package (PROJ4 NO_MODULE QUIET)
find_package (PROJ4 MODULE)
seems not to hold in all cases. If you think this should work, let me
know and I will look for a counter-example.
======================================================================
Issue History
Date Modified Username Field Change
======================================================================
2014-10-31 12:31 Charles Karney New Issue
======================================================================
More information about the cmake-developers
mailing list