CMake的FIND_PACKAGE未设置变量

dmo*_*mon 5 cmake

我目前正在尝试编写我的第一个非平凡的CMake项目,但是我无法检查FIND_PACKAGE()的任何输出,因为它似乎并未将值赋予我期望的全局变量!例如,以下代码:

MESSAGE("CMake version: ${CMAKE_VERSION}")
FIND_PACKAGE(Armadillo)
IF(Armadillo_FOUND)
    MESSAGE("Found Armadillo.")
    MESSAGE("Armadillo include dir is: ${ARMADILLO_INCLUDE_DIR}")
    MESSAGE("Armadillo lib's to be linked against: ${Armadillo_LIBRARIES}")
    MESSAGE("Armadillo lib version: ${PACKAGE_FIND_VERSION}")
ENDIF(Armadillo_FOUND)
Run Code Online (Sandbox Code Playgroud)

产生以下终端输出

/build]$ CMake version: 2.6.4
/build]$ Found Armadillo.
/build]$ Armadillo include dir is:
/build]$ Armadillo lib's to be linked against:
/build]$ Armadillo lib version:
Run Code Online (Sandbox Code Playgroud)

我知道这是很基本的,但是从所有教程中我都可以发现这应该产生有用的输出。有任何想法吗??

arr*_*owd 4

FindArmadillo.cmake中有这样一条注释:

# The following variables are set when ARMADILLO is found:
#  HAVE_ARMADILLO       = Set to true, if all components of ARMADILLO have been
#                         found.
#  ARMADILLO_INCLUDES   = Include path for the header files of ARMADILLO
#  ARMADILLO_LIBRARIES  = Link these to use ARMADILLO
#  ARMADILLO_LFLAGS     = Linker flags (optional)
Run Code Online (Sandbox Code Playgroud)