GenerateExportHeader: This macro can only be used with libraries?

CMake Warning at /Users/runner/work/_temp/-295072365/cmake-4.2.1-macos-universal/CMake.app/Contents/share/cmake-4.2/Modules/GenerateExportHeader.cmake:690 (message):
  This macro can only be used with libraries
Call Stack (most recent call first):
  CMakeLists.txt:64 (generate_export_header)

I have a header only library which may be build as CXX_MODULE.

To build Windows dll, I need to export the public interfaces.

But NOT, if I build only an interface library.

With this cmake configure warning the build fails caused by missing header file?

My solution is: