diff options
author | Brad King <brad.king@kitware.com> | 2015-05-13 14:18:30 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-05-13 14:29:36 (GMT) |
commit | fe633c27027856a7ce4b344f8fc1f2f1da8a917c (patch) | |
tree | 4906b8f39cbd9787b79fff55d9c76340a8536102 | |
parent | 0a10370aedd3cc08ebe2a8c0909406859058e146 (diff) | |
download | CastXML-fe633c27027856a7ce4b344f8fc1f2f1da8a917c.zip CastXML-fe633c27027856a7ce4b344f8fc1f2f1da8a917c.tar.gz CastXML-fe633c27027856a7ce4b344f8fc1f2f1da8a917c.tar.bz2 |
Require CLANG_RESOURCE_DIR to be found to build CastXML
CastXML cannot function correctly without Clang resources, so
fail with an error from CMake if they cannot be found.
GitHub-Issue: 12
-rw-r--r-- | CMakeLists.txt | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index b277547..4e852c4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -62,19 +62,30 @@ endif() set(CLANG_RESOURCE_DIR "" CACHE PATH "Clang resource directory") if(NOT CLANG_RESOURCE_DIR) set(v ${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}) + set(tried "") foreach(d ${LLVM_LIBRARY_DIRS}) if(IS_DIRECTORY "${d}/clang/${v}/include") set(CLANG_RESOURCE_DIR ${d}/clang/${v}) break() endif() + set(tried "${tried}\n ${d}/clang/${v}") endforeach() + if(NOT CLANG_RESOURCE_DIR) + if(tried) + set(tried " Tried:${tried}") + endif() + message(FATAL_ERROR "Could not find CLANG_RESOURCE_DIR.${tried}" + "\n" + "Please set CLANG_RESOURCE_DIR to the Clang SDK directory containing " + "\"include/stddef.h\", typically of the form \"<prefix>/lib/clang/${v}\"." + ) + endif() + unset(tried) endif() -if(CLANG_RESOURCE_DIR) - install(DIRECTORY ${CLANG_RESOURCE_DIR}/include - DESTINATION "${CastXML_INSTALL_DATA_DIR}/clang" - ) -endif() +install(DIRECTORY ${CLANG_RESOURCE_DIR}/include + DESTINATION "${CastXML_INSTALL_DATA_DIR}/clang" + ) add_subdirectory(src) |