Hi Joachim,

Am Samstag, 20. Oktober 2018, 13:22:04 CEST schrieb Joachim Wuttke:
> If Config mode is the newer, preferred way to find a package, I would expect
> find_package to first try Config mode, and only fall back to Module mode if
> no config scripts can be found. However, according to the find_package doc
> page, it is just the other way round.
> 
> Why?

The reason as far as I understand it is that you, as the consumer of a 
library, might want to customize the find_package process. Since find_package 
modules are usually shipped by your own code[1], it's not a problem that the 
module eclipses the config package.

> How to enforce that new config scripts are used if there are still FindXXX
> modules around?

First of all, purge the FindXXX modules from your own code base if you don't 
use them.
Otherwise, append the "CONFIG" keyword to the find_package call as described 
in the docs[2].

If you want to keep the FindXXX module around for compatibility with older 
versions of a library, then an even better solution is to fix your FindXXX 
module to call find_package(...CONFIG) and skip the search if a config file is 
found.

Cheers,
  Johannes



[1] apart from the modules shipped with cmake
[2] 
https://cmake.org/cmake/help/latest/command/find_package.html#full-signature-and-config-mode


-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake

Reply via email to