In CMakeLists.txt, I would like to check that bzlib.h exists:
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()
cmake is searched first in CMAKE_MODULE_PATH , then in the CMake module directory. There is one exception to this: if the file which calls include() is located itself in the CMake builtin module directory, then first the CMake builtin module directory is searched and CMAKE_MODULE_PATH afterwards.
CMakeLists. txt file contains a set of directives and instructions describing the project's source files and targets (executable, library, or both). When you create a new project, CLion generates CMakeLists. txt file automatically and places it in the project root directory.
CMake is a meta build system that uses scripts called CMakeLists to generate build files for a specific environment (for example, makefiles on Unix machines). When you create a new CMake project in CLion, a CMakeLists. txt file is automatically generated under the project root.
Cmake allows to provide cross platform build files that would generate platform specific project/make files for particular compilation/platform. cmake . inside your project's directory on Windows platform,Cmake will generate all the necessary project/solution files ( . sln etc.).
It's quite easy:
message( FATAL_ERROR "Your message" )
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With