Re: [llvm-dev] how to enable exceptions for one component

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] how to enable exceptions for one component

Jeremy Morse via llvm-dev

LLVM_ENABLE_EH is a global option, not a target property. For a single target, it’s more appropriate to use LLVM_REQUIRES_EH, which is also a variable you’ll need to set before calling add_llvm_component_library. You can do something like

 

set(LLVM_REQUIRES_EH_ORIGINAL ${LLVM_REQUIRES_EH})

set(LLVM_REQUIRES_EH YES)

add_llvm_component_library(LLVMTargetLibrary

  TargetFile1.cpp

  TargetFile2.cpp

  )

set(LLVM_REQUIRES_EH ${LLVM_REQUIRES_EH_ORIGINAL})

 

The implementation for this functionality lives in llvm/cmake/modules/AddLLVM.cmake [1], where you can see what effect LLVM_REQUIRES_EH has.

 

[1] https://github.com/llvm/llvm-project/blob/master/llvm/cmake/modules/AddLLVM.cmake

 

 

From: llvm-dev <[hidden email]> on behalf of "Davis, Alan via llvm-dev" <[hidden email]>
Reply-To: "Davis, Alan" <[hidden email]>
Date: Sunday, January 12, 2020 at 5:09 PM
To: LLVM Developers Mailing List <[hidden email]>
Subject: [llvm-dev] how to enable exceptions for one component

 

I’d like to enable exceptions for a single target-specific LLVM component which is built as library. That is, I’d like to allow it to throw exceptions to its (non-LLVM) client to signal errors. In the CMakeLists.txt for the component, I tried:

 

add_llvm_component_library(LLVMTargetLibrary

  TargetFile1.cpp

  TargetFile2.cpp

  )

 

set_property(TARGET LLVMTargetLibrary PROPERTY LLVM_ENABLE_EH ON)

 

But it still compiles with –fno-exceptions.

 

Thanks for any advice.

 

-Alan


_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] how to enable exceptions for one component

Jeremy Morse via llvm-dev

Perfect, thanks.

For the record, I had to also set/reset LLVM_REQUIRES_RTTI in the same way.

 

From: Shoaib Meenai [mailto:[hidden email]]
Sent: Monday, January 13, 2020 1:01 AM
To: Davis, Alan; LLVM Developers Mailing List
Subject: [EXTERNAL] Re: [llvm-dev] how to enable exceptions for one component

 

LLVM_ENABLE_EH is a global option, not a target property. For a single target, it’s more appropriate to use LLVM_REQUIRES_EH, which is also a variable you’ll need to set before calling add_llvm_component_library. You can do something like

 

set(LLVM_REQUIRES_EH_ORIGINAL ${LLVM_REQUIRES_EH})

set(LLVM_REQUIRES_EH YES)

add_llvm_component_library(LLVMTargetLibrary

  TargetFile1.cpp

  TargetFile2.cpp

  )

set(LLVM_REQUIRES_EH ${LLVM_REQUIRES_EH_ORIGINAL})

 

The implementation for this functionality lives in llvm/cmake/modules/AddLLVM.cmake [1], where you can see what effect LLVM_REQUIRES_EH has.

 

[1] https://github.com/llvm/llvm-project/blob/master/llvm/cmake/modules/AddLLVM.cmake

 

 

From: llvm-dev <[hidden email]> on behalf of "Davis, Alan via llvm-dev" <[hidden email]>
Reply-To: "Davis, Alan" <[hidden email]>
Date: Sunday, January 12, 2020 at 5:09 PM
To: LLVM Developers Mailing List <[hidden email]>
Subject: [llvm-dev] how to enable exceptions for one component

 

I’d like to enable exceptions for a single target-specific LLVM component which is built as library. That is, I’d like to allow it to throw exceptions to its (non-LLVM) client to signal errors. In the CMakeLists.txt for the component, I tried:

 

add_llvm_component_library(LLVMTargetLibrary

  TargetFile1.cpp

  TargetFile2.cpp

  )

 

set_property(TARGET LLVMTargetLibrary PROPERTY LLVM_ENABLE_EH ON)

 

But it still compiles with –fno-exceptions.

 

Thanks for any advice.

 

-Alan


_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev