Skip to content

Commit

Permalink
Set no RTTI flag for all compilers
Browse files Browse the repository at this point in the history
  • Loading branch information
certik committed Oct 8, 2019
1 parent d2292cc commit f51944e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ if (NOT (CMAKE_BUILD_TYPE STREQUAL "Debug" OR
message(FATAL_ERROR "CMAKE_BUILD_TYPE must be one of: Debug, Release (current value: '${CMAKE_BUILD_TYPE}')")
endif ()

if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(LFORTRAN_CXX_NO_RTTI_FLAG "-fno-rtti")
elseif (CMAKE_CXX_COMPILER_ID MATCHES Clang)
set(LFORTRAN_CXX_NO_RTTI_FLAG "-fno-rtti")
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(LFORTRAN_CXX_NO_RTTI_FLAG "/GR-")
endif ()

# build a CPack driven installer package
include(InstallRequiredSystemLibraries)
Expand Down Expand Up @@ -67,7 +74,7 @@ if (WITH_LLVM)
#set_property(TARGET p::llvm PROPERTY INTERFACE_COMPILE_OPTIONS
# ${LLVM_DEFINITIONS})
set_property(TARGET p::llvm PROPERTY INTERFACE_COMPILE_OPTIONS
$<$<COMPILE_LANGUAGE:CXX>:-fno-rtti>)
$<$<COMPILE_LANGUAGE:CXX>:${LFORTRAN_CXX_NO_RTTI_FLAG}>)
set_property(TARGET p::llvm PROPERTY INTERFACE_LINK_LIBRARIES
${llvm_libs})
endif()
Expand Down

0 comments on commit f51944e

Please sign in to comment.