預計

2015-06-30 105 views
0

我FindEigen.cmake當CMake的不扔錯誤如下:預計

find_path(EIGEN_INCLUDE_DIR NAMES Eigen/Core 
    PATHS 
    PATH_SUFFIXES eigen3 
    ${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty 
    /usr/local/include 
    /usr/local/homebrew/include # Mac OS X 
    /opt/local/var/macports/software # Mac OS X 
    /opt/local/include 
    /usr/include) 

# handle the QUIETLY and REQUIRED arguments and set EIGEN_FOUND to TRUE if 
# all listed variables are TRUE 
INCLUDE(FindPackageHandleStandardArgs) 
FIND_PACKAGE_HANDLE_STANDARD_ARGS(EIGEN DEFAULT_MSG EIGEN_INCLUDE_DIR) 

這是從我的CMakeLists.txt文件名爲如下:

find_package(Eigen REQUIRED) 

的消息我從回來cmake gui是:

Could NOT find EIGEN (missing: EIGEN_INCLUDE_DIR) 

但這不是錯誤,並且配置成功完成。我的理解是,REQUIRED選項意味着cmake應該拋出一個錯誤並停止,如果找不到該包,並且FIND_PACKAGE_HANDLE_STANDARD_ARGS方法應該執行該操作。但這不是爲我發生的。任何想法爲什麼不呢?

回答

0

嘗試使用required_vars

FIND_PACKAGE_HANDLE_STANDARD_ARGS(EIGEN REQUIRED_VARS EIGEN_INCLUDE_DIR) 
+0

這對我不起作用,無論是。此外,在調用find_package時,它並不檢查包是否實際需要。 – user664303