2013-02-03 19 views
3

在的CMakeLists.txt,我想检查bzlib.h存在:如何在包含文件不存在时优雅地失败CMake?

include(CheckIncludeFiles) 
check_include_file(bzlib.h HAVE_BZLIB_H) 
if(NOT HAVE_BZLIB_H) 
    # How can I exit cmake with an error message if bzlib.h does not exists? 
endif() 
+2

你应该可以解决'if',将其改为'如果(不是HAVE_BZLIB_H )'。 – Zhen

回答

7

这是很容易: message(FATAL_ERROR "Your message")