alandefreitas/cpp-actions

`no-rtti` factor

Closed this issue · 2 comments

There should be a factor that adds -fno-rtti and /GR- for CMake builds and also rtti=off for the b2 workflow

Something like this seems to suffice:

B2_ARGS+=(${{ (inputs['no-rtti'] == 'true' && '"rtti=off"') || '' }})

I've also come to learn, /GR- on msvc toolchains seems to necessitate us explicitly passing /EHsc which I assumed it did by default but I guess it doesn't. Updating the code to appned entry['cxxflags'] += ' /GR- /EHsc' seems to work fine in practice.

I've included the rtti option for the b2-workflow action. true adds rtti=on to the args, false adds rtti=on to the args, and everything else adds nothing. I'll convert this action to JavaScript at some point to make it easier to maintain.

About always recommending '/EHsc'` directly from the matrix, this should remain as the user's responsibility because it's not composable or generic enough and can minimize surprises because the convention in CMake is not to assume the user has to pass required flags manually: if only the user needs /EHsc, they can provide it via the command line. If the project always needs /EHsc with no exception on MSVC, then it should embed it in the (interface) target.