Skip to content

allow to modify or remove the postfix for debug builds #5600

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

Merged

Conversation

MarDiehl
Copy link
Contributor

closes #4647

derobins
derobins previously approved these changes Jun 13, 2025
@derobins
Copy link
Member

Needs a release note, at the very least

@byrnHDF
Copy link
Contributor

byrnHDF commented Jun 13, 2025

I don't like this change as is - first the default can be overridden easiy;
set (CMAKE_DEBUG_POSTFIX "")

Second it is altering a setting that could be relied on due to it being a long standing setting.

Copy link
Contributor

@byrnHDF byrnHDF left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is not the way to do this and why just for NOT win32.

@github-project-automation github-project-automation bot moved this from To be triaged to In progress in HDF5 - TRIAGE & TRACK Jun 13, 2025
@derobins
Copy link
Member

I don't like this change as is - first the default can be overridden easiy;
set (CMAKE_DEBUG_POSTFIX "")

Second it is altering a setting that could be relied on due to it being a long standing setting.

The default should be to do what other libraries do and not have a suffix. Anyone who cares about this can change it, but I think most people don't want to change linker commands when building a debug library. Windows is different since the debug library will link to the debug CRT.

@derobins
Copy link
Member

As for "long standing settings", 2.0 is the time to do the right thing instead of the traditional thing. Also, this isn't this only a long-standing thing on CMake?

@@ -476,8 +476,6 @@ macro (HDF_DIR_PATHS package_prefix)
if(NOT CMAKE_DEBUG_POSTFIX)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add an option here "ENABLE_DEBUG_NAME_EXT" that is normally OFF. That is what this code was supposed to accomplish, just to make it easy and optional.
This way one does not need to remember that if I want an extension that I need to set it on Linux but skip WIN32. Easier to change one setting without regard to platform.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about making CMAKE_DEBUG_POSTFIX accesible via the commandline, i.e.-DCMAKE_DEBUG_POSTFIX=?

@byrnHDF
Copy link
Contributor

byrnHDF commented Jun 16, 2025

We should just move these settings (the whole if-else) to the cacheinit.cmake file as that is the intended use for that file.

@MarDiehl MarDiehl force-pushed the MarDiehl/4647_no-CMAKE_DEBUG_POSTFIX branch from 563e373 to 93f1e55 Compare June 16, 2025 16:31
@@ -40,6 +40,8 @@ set (HDF_TEST_EXPRESS "2" CACHE STRING "Control testing framework (0-3)" FORCE)

set (HDF5_MINGW_STATIC_GCC_LIBS ON CACHE BOOL "Statically link libgcc/libstdc++" FORCE)

set (CMAKE_DEBUG_POSTFIX "" CACHE STRING "Filename postfix for debug builds" FORCE)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just replace this with the whole thing:
if(NOT CMAKE_DEBUG_POSTFIX)
if (WIN32)
set (CMAKE_DEBUG_POSTFIX "_D")
else ()
set (CMAKE_DEBUG_POSTFIX "_debug")
endif ()
endif ()

@MarDiehl MarDiehl force-pushed the MarDiehl/4647_no-CMAKE_DEBUG_POSTFIX branch from 93f1e55 to 840438c Compare June 16, 2025 16:59
byrnHDF
byrnHDF previously approved these changes Jun 16, 2025
@jhendersonHDF
Copy link
Collaborator

@byrnHDF Does this handle setting of a postfix for developer builds of the library?

@byrnHDF
Copy link
Contributor

byrnHDF commented Jun 16, 2025

@byrnHDF Does this handle setting of a postfix for developer builds of the library?

Yes this affects the $CONFIG:Developer>: generator instances

vchoi-hdfgroup
vchoi-hdfgroup previously approved these changes Jun 16, 2025
@MarDiehl MarDiehl force-pushed the MarDiehl/4647_no-CMAKE_DEBUG_POSTFIX branch from 840438c to 20670fa Compare June 17, 2025 08:38
@MarDiehl
Copy link
Contributor Author

Tested locally, works as expected.
Force pushed to update commit message.

@MarDiehl MarDiehl changed the title no "_debug" postfix for debug builds on Linux allow to modify or remove the postfix for debug builds Jun 17, 2025
Copy link
Collaborator

@lrknox lrknox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs a release note - probably 2 or 3 lines, one to describe the problem, one to describe the change, and one saying Fixes or Fixed GitHub issue #4647. This should be added to the top of the Bug Fixes / Configuration section at ~ line 743 of release_docs/RELEASE.txt file.

The cause of the netCDF test failures is known and unrelated to this pull request.

@MarDiehl MarDiehl dismissed stale reviews from vchoi-hdfgroup and byrnHDF via 296205b June 17, 2025 19:31
@MarDiehl MarDiehl force-pushed the MarDiehl/4647_no-CMAKE_DEBUG_POSTFIX branch from 20670fa to 296205b Compare June 17, 2025 19:31
lrknox
lrknox previously approved these changes Jun 17, 2025
vchoi-hdfgroup
vchoi-hdfgroup previously approved these changes Jun 18, 2025
@@ -742,6 +742,11 @@ Bug Fixes since HDF5-2.0.0 release

Configuration
-------------
- Allow to set postfix of target file names for debug builds
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove default setting of CMAKE_DEBUG_POSTFIX if not set.

Move the default setting of CMAKE_DEBUG_POSTFIX to the cacheinit,cmake file usually used by testing. If CMAKE_DEBUG_POSTFIX is not set with a -D option then CMAKE_DEBUG_POSTFIX will be the default provided by CMake itself,

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find "Remove default setting of CMAKE_DEBUG_POSTFIX if not set." misleading. cacheinit.cmake is part of the release (at least the current), so when building HDF5 the old behavior of having postfixes for debug build is restored.

There is also no such thing as a default provided by CMake.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove default setting of CMAKE_DEBUG_POSTFIX if not set.

yes should just be:
Remove default setting of CMAKE_DEBUG_POSTFIX

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cacheinit.cmake is provided just for testing and convenience and should only be used if the settings agrree with your expectations. The file can be usedas is with overrides or editing. There are many alternatives. The preferred method now is to use Presets.

This change affects the preferred Presets method by removing the settings. The binaries we build for publication (which do not build debug) use the Presets method. Future changes will be to eliminate the cacheinit.cmake file for a "Testing" CMakeUsersPresets.json file that we would create and use.
Since the default CMake setting for this CMAKE_DEBUG_POSTFIX isn't implemented the result is that it is the empty string, which is what we want.

Copy link
Contributor

@byrnHDF byrnHDF left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change release note

Move the default setting of CMAKE_DEBUG_POSTFIX to the cacheinit.cmake file
usually used by testing. If CMAKE_DEBUG_POSTFIX is not set with a -D option
then CMAKE_DEBUG_POSTFIX will be the default provided by CMake itself.
@MarDiehl MarDiehl dismissed stale reviews from vchoi-hdfgroup and lrknox via 345a9f5 June 20, 2025 10:43
@MarDiehl MarDiehl force-pushed the MarDiehl/4647_no-CMAKE_DEBUG_POSTFIX branch from 296205b to 345a9f5 Compare June 20, 2025 10:43
@lrknox lrknox merged commit b89f178 into HDFGroup:develop Jun 20, 2025
76 checks passed
@github-project-automation github-project-automation bot moved this from In progress to Done in HDF5 - TRIAGE & TRACK Jun 20, 2025
@MarDiehl
Copy link
Contributor Author

thanks for all the support!

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

Successfully merging this pull request may close these issues.

Remove the _debug prefixes for CMake debug builds (linux)
6 participants