hdf5 icon indicating copy to clipboard operation
hdf5 copied to clipboard

CMake: Disable UNITY_BUILD

Open jschueller opened this issue 6 months ago • 2 comments

Useful to avoid compilation errors from a top-level project that uses UNITY_BUILD, eg vtk. UNITY_BUILD seems error-prone to support properly here because of the macros, lets disable it for most targets.

jschueller avatar Jan 02 '24 14:01 jschueller

This might be better to disable it globally instead of for individual targets; If no explicit UNITY_BUILD_MODE has been specified, CMake will default to BATCH. However; CMAKE_UNITY_BUILD variable is used to initialize the UNITY_BUILD property of targets when they are created. By default, this variable is not set, which will result in unity builds being disabled.

I'm guessing that if hdf5 is within another project that sets UNITY_BUILD is the reason for this. I think we need to use the HDF5_EXTERNALLY_CONFIGURED variable perhaps to disable it for hdf5?

byrnHDF avatar Jan 02 '24 17:01 byrnHDF

no need, it can be disabled inconditionnally until someone wants to add support for it; if you set CMAKE_UNITY_BUILD global variable even inside hdf5 the build will fail too

jschueller avatar Jan 02 '24 17:01 jschueller