The binary you create for Linux won't run on Windows, but as long as you stick to cross-platform code, thecode itself should be compilable on Windows and macOS. However often there are some minor adjustments required, if not for the code, then certainly for the CMake script.
As for cross-platform compilation, i.e. building a binary on Linux that would run on Windows, I can't recommend trying to do that, because it's quite complicated and at the end of the day, there's no guarantee that it will actually work. Thus it's much easier to start up a Windows virtual machine and build it natively.