From acd58dac6f950a4c6eece2b05f7ae5d7467efe72 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 2 Dec 2015 09:30:08 -0500 Subject: Respect LLVM/Clang options for exception handling and rtti Add flags as needed to compile our sources consistently with those from LLVM/Clang against which we will link. GitHub-Issue: 40 --- CMakeLists.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b906e7b..b56b0a8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,13 +40,19 @@ if(NOT CastXML_INSTALL_MAN_DIR) endif() if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") + if(NOT LLVM_ENABLE_EH) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions") + endif() + if(NOT LLVM_ENABLE_RTTI) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti") + endif() if(CYGWIN OR MINGW) # Use GNU extensions on Windows as LLVM upstream does. set(std_cxx11 "-std=gnu++11") else() set(std_cxx11 "-std=c++11") endif() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti ${std_cxx11}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${std_cxx11}") endif() set(KWSYS_NAMESPACE cxsys) -- cgit v0.12