2013-02-03 18 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")