I'm wondering if adding a whole extra file here is necessary. Seems to me that you could just perform the 3-line test for compatible compilers, and the one-line setting of flag, right in the main CMakeLists.txt and save people the trouble of having to look in a second file to figure out what those macros do.  If it took 100 lines of CMake code to determine the compiler compatibility, I would certainly agree that it should be encapsulated into a macro and put out of the way in another file.  For less than 10 lines total, I think that splitting it into a second file may merely obfuscate.