Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cross-compiler target linking failure #1740

Open
Kaltxi opened this issue Apr 30, 2024 · 1 comment
Open

Cross-compiler target linking failure #1740

Kaltxi opened this issue Apr 30, 2024 · 1 comment

Comments

@Kaltxi
Copy link

Kaltxi commented Apr 30, 2024

Hello!

Recently I've stumbled upon a problem while using OpenImageIO via vcpkg on windows, while using clang as my compiler. Vcpkg would build the packages using its default toolchain which means MSVC. This would lead to my user targets inheriting /EHsc flag from OpenEXR and Imath and failing to build with clang.

The problem turned out to be in these lines (and same corresponding lines in config/LibraryDefine.cmake for Imath:

if (MSVC)
set(_openexr_extra_flags "/EHsc")
endif()

As pointed out to me in microsoft/vcpkg#38466 using generator expression instead of if fixes the problem. In my local overlay port I simply replaced the if with set(_openexr_extra_flags "$<$<CXX_COMPILER_ID:MSVC>:/EHsc>") which would remove the flag completely for non-msvc compilers (+ the same change for Imath). I'm not sure this is entirely correct in this case and perhaps for other compilers corresponding exception handling flag should be publicly exported instead.

Could you advise on the need for this public compile flag and whether it is possible to fix it upstream?

@meshula
Copy link
Contributor

meshula commented May 1, 2024

Using a generator instead of an if makes a lot of sense. If you'd like to submit a PR to this project and Imath, that would be awesome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants