2010-06-15 14 views
7

el siguiente código se imprime nadaEn CMake, ¿cómo funciona CHECK_INCLUDE_FILE_CXX?

CHECK_INCLUDE_FILE_CXX(glog/logging.h GLOG_INCLUDE) 
IF(GLOG_INCLUDE) 
    MESSAGE("YY") 
ENDIF(GLOG_INCLUDE) 

Pero tengo el siguiente conjunto variable de entorno:

export CPLUS_INCLUDE_PATH=/usr/local/include 

Y, "ls /usr/local/include/glog/logging.h" devuelve el archivo .

He intentado utilizar

include_directories("/usr/local/include") 

pero aún no está definido GLOG_INCLUDE después (no logging.h restos encontrados.)

Respuesta

7

Tome un vistazo a la CheckIncludeFileCXX.cmake. Debe estar en un directorio en su instalación de cmake (lo tengo en /usr/share/cmake-2.8/Modules).

Este archivo estados:

# The following variables may be set before calling this macro to 
# modify the way the check is run: 
# 
# CMAKE_REQUIRED_FLAGS = string of compile command line flags 
# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) 
# CMAKE_REQUIRED_INCLUDES = list of include directories 
# 

para que pueda probar el establecimiento de esta variable antes de titularse el comando, así:

set (CMAKE_REQUIRED_INCLUDES "/usr/local/include") 
CHECK_INCLUDE_FILE_CXX(glog/logging.h GLOG_INCLUDE) 
IF(GLOG_INCLUDE) 
    MESSAGE("YY") 
ENDIF(GLOG_INCLUDE) 
+1

supongo que es raro que este módulo no puede usar sistema incluye caminos... – avtomaton