CPack `REQUIRED` in `cpack_add_component` is not working as intended with WiX

I am passing keyword REQUIRED to cpack_add_component, but the component my_lib still shows as optional with the WiX msi installer, meaning the user can still select “feature will be installed when required,” and selecting this option causes the component to not get installed. The same cpack_add_component command works as intended with NSIS installer generator on CPack. Adding set(CPACK_COMPONENT_MY_LIB_REQUIRED TRUE) before include(CPack) also doesn’t help with this issue.

I am able to reproduce the same issue with WiX toolset v6, v5, and v4. I would like to use CPACK_WIX_VERSION 4 instead of version 3. I have not tested with WiX v3.11.

Could someone please tell me what am I missing here, and could this be a bug with CPack WiX integration?

A snippet of my CMakeLists.txt for reproduction

  if(WIN32)
    set(CPACK_GENERATOR "WIX")
    set(CPACK_WIX_VERSION 4)
    set(CPACK_WIX_UPGRADE_GUID "<real-guid-redacted>")
  endif()
  include(CPack)
  cpack_add_component(my_lib
                      REQUIRED
                      DISPLAY_NAME "My Library"
                      DESCRIPTION "Library bin, required to install")

Feel free to comment if you have faced the same issue!