[cmake-developers] [CMake 0013128]: find_package_handle_standard_args in CONFIG_MODE requires ${NAME}_CONFIG even if ${NAME}_FOUND

Mantis Bug Tracker mantis at public.kitware.com
Fri Apr 13 15:34:58 EDT 2012


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=13128 
====================================================================== 
Reported By:                devurandom
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   13128
Category:                   Modules
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2012-04-13 15:34 EDT
Last Modified:              2012-04-13 15:34 EDT
====================================================================== 
Summary:                    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.
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2012-04-13 15:34 devurandom     New Issue                                    
======================================================================




More information about the cmake-developers mailing list