View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
0013128 | CMake | Modules | public | 2012-04-13 15:34 | 2016-06-10 14:31 | ||||
Reporter | devurandom | ||||||||
Assigned To | Kitware Robot | ||||||||
Priority | normal | Severity | major | Reproducibility | always | ||||
Status | closed | Resolution | moved | ||||||
Platform | OS | OS Version | |||||||
Product Version | CMake 2.8.7 | ||||||||
Target Version | Fixed in Version | ||||||||
Summary | 0013128: find_package_handle_standard_args in CONFIG_MODE requires ${NAME}_CONFIG even if ${NAME}_FOUND | ||||||||
Description | Consider following code, which will always bail out with an error: find_package(Eigen3 QUIET) message(E3F: ${EIGEN3_FOUND}) find_package(Eigen3 QUIET NO_MODULE PATHS "${MY_CONFIG_PATH}") message(E3F: ${EIGEN3_FOUND}) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(Eigen3 CONFIG_MODE) Both E3F messages print TRUE, but FPHSA still aborts with a failure. I assume this is because of following code: IF(FPHSA_CONFIG_MODE) LIST(INSERT FPHSA_REQUIRED_VARS 0 ${_NAME}_CONFIG) and: FOREACH(_CURRENT_VAR ${FPHSA_REQUIRED_VARS}) IF(NOT ${_CURRENT_VAR}) SET(${_NAME_UPPER}_FOUND FALSE) | ||||||||
Additional Information | What I am trying to achieve is the following: Eigen3 should be searched in the system, if it is not found my project comes with a local copy of it (via ${MY_CONFIG_PATH}/Eigen3Config.cmake). No matter where it was found, I would like only one message to be output about the presence or absence of Eigen3. If possible they should look similar, but just point to different paths. I previously had following code: find_package(Eigen3) if (NOT EIGEN3_FOUND) set(EIGEN3_INCLUDE_DIR "${CMAKE_SOURCE_DIR}") find_package(Eigen3 REQUIRED) But that outputs one irritating "Could NOT find ..." message even if Eigen3 is found locally. Further the success message, if Eigen3 was found locally, is missing. | ||||||||
Tags | No tags attached. | ||||||||
Attached Files | |||||||||
Relationships | |
Relationships |
Notes | |
(0029149) devurandom (reporter) 2012-04-13 15:47 |
"they should look similar": "they" refers to the messages for the cases where Eigen3 was found locally or in the system. |
(0029150) David Cole (manager) 2012-04-13 16:14 |
Why not simply append or prepend your own path to CMAKE_MODULE_PATH before calling find_package? If you append, your config file will be found last, if you prepend, your config file will be found first. In the case where you'd prefer the system Eigen, you should append and then call find_package only once with REQUIRED. Wouldn't that be simpler? |
(0029171) Brad King (manager) 2012-04-16 09:16 |
The documentation of find_package_handle_standard_args states "Use the option CONFIG_MODE if your FindXXX.cmake module is a wrapper". The entire macro is meant only for use inside a Find module. The FindEigen3 module itself should do the config-mode search. Look at FindHDF5 and FindVTK for examples that try config mode and fall back to old-style search. |
(0029185) Alex Neundorf (developer) 2012-04-16 15:49 |
I agree with Brad. Also, the documentation for find_package() says: "The full path to the configuration file is stored in the cmake variable <package>_CONFIG." So when you use fphsa(Foo ... CONFIG_MODE ), it does the right thing and checks for Foo_CONFIG. I think there is nothing to change here. |
(0029195) devurandom (reporter) 2012-04-16 17:40 |
Re: David: Appending a directory containing *Config.cmake files to CMAKE_MODULE_PATH, when that path also contains Find*.cmake files, does not do what I'd expect: It sees the Find* file and just uses that, instead of falling back to *Config. So it appears preferring this or that library does not work in the way you described. Re: Brad and Alex: Why should every single package implement that fallback mechanism? Wouldn't it be easier if CMake implemented it and it could be used automatically, if desired? Could you add a mode/version of fphsa or find_package, that either uses the fallback mechanism I hinted at above, or just summarises the previous find_package(QUIET) calls? |
(0029223) Alex Neundorf (developer) 2012-04-18 15:10 |
If you post a patch we'll have a look at it. |
(0029224) Brad King (manager) 2012-04-18 15:15 |
FWIW I'm not interested in any more automatic fallback behavior in find_package. If the command sees a Find module in CMAKE_MODULE_PATH it will enter Module mode and never consider Config mode. Any functionality along these lines belongs in FPHSA (or a new macro/function) to help Find modules do Config mode first and then fall back to normal testing. It is up to the package-specific Find modules to know whether newer versions of the package provide package config files. |
(0042024) Kitware Robot (administrator) 2016-06-10 14:28 |
Resolving issue as `moved`. This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page. |
Notes |
Issue History | |||
Date Modified | Username | Field | Change |
2012-04-13 15:34 | devurandom | New Issue | |
2012-04-13 15:47 | devurandom | Note Added: 0029149 | |
2012-04-13 16:14 | David Cole | Note Added: 0029150 | |
2012-04-16 09:16 | Brad King | Note Added: 0029171 | |
2012-04-16 15:46 | Alex Neundorf | Assigned To | => Alex Neundorf |
2012-04-16 15:46 | Alex Neundorf | Status | new => assigned |
2012-04-16 15:49 | Alex Neundorf | Note Added: 0029185 | |
2012-04-16 17:40 | devurandom | Note Added: 0029195 | |
2012-04-18 15:10 | Alex Neundorf | Note Added: 0029223 | |
2012-04-18 15:15 | Brad King | Note Added: 0029224 | |
2012-04-18 15:15 | Brad King | Assigned To | Alex Neundorf => |
2012-04-18 15:15 | Brad King | Status | assigned => backlog |
2016-06-10 14:28 | Kitware Robot | Note Added: 0042024 | |
2016-06-10 14:28 | Kitware Robot | Status | backlog => resolved |
2016-06-10 14:28 | Kitware Robot | Resolution | open => moved |
2016-06-10 14:28 | Kitware Robot | Assigned To | => Kitware Robot |
2016-06-10 14:31 | Kitware Robot | Status | resolved => closed |
Issue History |
Copyright © 2000 - 2018 MantisBT Team |