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

[freeimage] link openexr and imath with PRIVATE keyword #43898

Open
Aostas opened this issue Feb 18, 2025 · 0 comments
Open

[freeimage] link openexr and imath with PRIVATE keyword #43898

Aostas opened this issue Feb 18, 2025 · 0 comments
Assignees
Labels
category:port-feature The issue is with a library, which is requesting new capabilities that didn’t exist

Comments

@Aostas
Copy link

Aostas commented Feb 18, 2025

Is your feature request related to a problem? Please describe.

Both openxr and imath have set INTERFACE_COMPILE_OPTIONS=/EHsc, causing my program to be forced to set /EHsc when linking with freeimage, and I cannot change it to /EHa.
Usually, I can change it by using the following method

add_compile_options(/EHa)
STRING(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})

But, INTERFACE_COMPILE_OPTIONS will be set after compile_options, causing the previously set /EHa option to be overridden.

I can work around this issue by using the following method, but I don't think it's a good approach.

find_package(freeimage CONFIG REQUIRED)
add_library(freeimage_wrapper STATIC wrapper/wrapper.cc) # wapper.cc is an empty source file
target_link_libraries(freeimage_wrapper PRIVATE freeimage::FreeImage)
target_link_libraries(${PROJECT_NAME} PRIVATE freeimage_wrapper)

Proposed solution

Link openexr and imath with PRIVATE keyword

Describe alternatives you've considered

No response

Additional context

No response

@Aostas Aostas added the category:port-feature The issue is with a library, which is requesting new capabilities that didn’t exist label Feb 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:port-feature The issue is with a library, which is requesting new capabilities that didn’t exist
Projects
None yet
Development

No branches or pull requests

2 participants