Setting global compiler flags #39974
Unanswered
mikehallmusco
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a Visual Studio Solution for which I am trying to create a port. The Solution contains C++ and C# and Managed C++ (CLR) projects. I am using the
vcpkg_msbuild_install
function to build the Solution. The problem is that this function generates a target file with compiler options that are incompatible with my projects' compiler options. Specifically,/EHsc
is not compatible with/clr
. The generated target file contains the following line.<AdditionalOptions Condition="'$(Configuration)'=='Release'">%(AdditionalOptions) -nologo -DWIN32 -D_WINDOWS -W3 -utf-8 -GR -EHsc -MP -MD -O2 -Oi -Gy -DNDEBUG -Z7 /WX-</AdditionalOptions>
Is there anyway to set these compiler options? Or remove them? Since I'd rather let the Solution file and Project files dictate their own compiler options.
I looked through the
vcpkg_msbuild_install
function's cmake, I then found thez_vcpkg_msbuild_create_props
function's cmake. This indicates that the compiler options are coming from theVCPKG_COMBINED_CXX_FLAGS_DEBUG
variable. I cannot inspect or set this in my port's cmake.Is the solution here to create a custom triplet? Or is there a way to set the global compiler options?
After some more investigation, I see that those compiler switches come from the
windows.cmake
toolchain file. Some of the compiler and linker options defined in there seem strange. Why was/EHsc
chosen? Because it is in the toolchain the only way to change it is with a custom toolchain file.Beta Was this translation helpful? Give feedback.
All reactions