OpenEXRSetup.cmake sets CMAKE_DEBUG_POSTFIX
The OpenEXRSetup.cmake scripts sets the CMAKE_DEBUG_POSTFIX even if it is subproject. This overwrites the settings of the parent project and may cause problems the the cmake configuration.
Other cmake projects use a guard to avoid this. Something like if (NOT CMAKE_DEBUG_POSTFIX) set(CMAKE_DEBUG_POSTFIX "_d" CACHE STRING "Suffix for debug builds") endif()
Good catch, would you like submit a PR with your proposed change?
The fix from https://github.com/AcademySoftwareFoundation/openexr/pull/1987 causes a regression in some packaging settings. FreeBSD does not change API in debug builds, so we do not want to rename Debug-built libraries.
In prior releases, we could just call cmake with -DCMAKE_DEBUG_POSTFIX= and that was it. This approach no longer works after https://github.com/AcademySoftwareFoundation/openexr/commit/848f84ae7504adcd89ec0da182499d5cd4e3b245 which made the prior set(CMAKE_DEBUG_POSTFIX "_d" CACHE STRING "Suffix for debug builds") into a new if (NOT CMAKE_DEBUG_POSTFIX) set(CMAKE_DEBUG_POSTFIX "_d"), and what used to be a "set the prior cache variable to be empty" the override to empty now also triggers the _d default.
What WOULD work for us when packaging OpenEXR for FreeBSD is making line 94 of said commit to read if (NOT DEFINED CMAKE_DEBUG_POSTFIX) instead. @Debitsch-Faro and @cary-ilm would that also work for you? If yes, can we add another MR to revise the fix and the guard?
Also, as a side note, the commit I quote isn't auto-referenced. For Github and Gitlab projects, please be sure to reference issue numbers in your commit texts so they get linked.
The proposed fix will work for me.
Thank you for figuring this out Rasmus Debitsch
From: mandree @.> Sent: Dienstag, 28. Oktober 2025 19:19 To: AcademySoftwareFoundation/openexr @.> Cc: Rasmus Debitsch @.>; Mention @.> Subject: Re: [AcademySoftwareFoundation/openexr] OpenEXRSetup.cmake sets CMAKE_DEBUG_POSTFIX (Issue #1981)
CAUTION: This email originated from outside the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.
If you have clicked a link in this message with unexpected results, call IT immediately [https://avatars.githubusercontent.com/u/5079167?s=20&v=4]mandree left a comment (AcademySoftwareFoundation/openexr#1981)https://github.com/AcademySoftwareFoundation/openexr/issues/1981#issuecomment-3457859378
The fix from #1987https://github.com/AcademySoftwareFoundation/openexr/pull/1987 causes a regression in some packaging settings. FreeBSD does not change API in debug builds, so we do not want to rename Debug-built libraries.
In prior releases, we could just call cmake with -DCMAKE_DEBUG_POSTFIX= and that was it. This approach no longer works after 848f84ahttps://github.com/AcademySoftwareFoundation/openexr/commit/848f84ae7504adcd89ec0da182499d5cd4e3b245 which made the prior set(CMAKE_DEBUG_POSTFIX "_d" CACHE STRING "Suffix for debug builds") into a new if (NOT CMAKE_DEBUG_POSTFIX) set(CMAKE_DEBUG_POSTFIX "_d"), and what used to be a "set the prior cache variable to be empty" the override to empty now also triggers the _d default.
What WOULD work for us is making line 94 of said commit to read if (NOT DEFINED CMAKE_DEBUG_POSTFIX) instead. @Debitsch-Farohttps://github.com/Debitsch-Faro and @cary-ilmhttps://github.com/cary-ilm would that also work for you? If yes, can we add another MR to revise the fix and the guard?
— Reply to this email directly, view it on GitHubhttps://github.com/AcademySoftwareFoundation/openexr/issues/1981#issuecomment-3457859378, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BBQSYLDMHAWR6OZKB3CQH633Z6XPTAVCNFSM6AAAAABW22LYJCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTINJXHA2TSMZXHA. You are receiving this because you were mentioned.Message ID: @.@.>>