0

I am using CMake to create my VS2012 solution, I need to set a code generation option to compile code in a specific way.

enter image description here

I need to set the C++ Exceptions to a specific setting.

How do I go about this? So far I've been trying this

SET_TARGET_PROPERTIES(swaretrievalobjects1000 PROPERTIES COMPILE_FLAGS "Yes with Extern C functions (/EHs)")

Is this correct or totally wrong?

3
  • Have you tried it, and checked what happens when you do it? Commented Apr 10, 2014 at 16:02
  • yep tried it and get an error which stops my build Commented Apr 11, 2014 at 7:53
  • So the answer to "is this correct or totally wrong?" seems kind of obvious then... ;) Commented Apr 11, 2014 at 11:07

2 Answers 2

3

For the newer versions of cmake 2.8.12+ you can use add_compile_options:

# cmake_minimum_required(VERSION 2.8.12) add_compile_options(/EHs) 

alternatively for an older cmake you can set the settings explicitly with,

IF (WIN32) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHs") ENDIF (WIN32) 

And don't forget to delete the CMakeCache.txt file.

Sign up to request clarification or add additional context in comments.

Comments

1

I was on the right track

IF(WIN32) IF(MSVC) IF(MSVC_VERSION EQUAL 1700) SET_TARGET_PROPERTIES(swaretrievalobjects1000 PROPERTIES COMPILE_FLAGS "/EHs") ENDIF(MSVC_VERSION EQUAL 1700) ENDIF(MSVC) ENDIF(WIN32) 

Is what i used in the end also had to make sure it was in the correct place towards the end of file.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.