install(CODE) does not get target platform information set
I cross-compile from Linux to Windows using MinGW. If I check WIN32 and UNIX variables in my normal CMake everything is as expected (i.e. WIN32 is TRUE). In install(CODE) CMAKE_CROSSCOMPILING is still true, but WIN32 is FALSE and UNIX is TRUE. This breaks e.g. BundleUtilities, that does tool lookups based on the target platform. I had to add code like this:
install(CODE "set(WIN32 ${WIN32})
set(UNIX ${UNIX})
fixup_bundle(...)")