Use check_symbol_exists() to check macros defined by compiler and deduce enabled MIPS features like mips16. If for example mips16 is enabled, define MIPS_IS_MIPS16_ENABLED flag. Then use this flags to include feature specific test cases or disable tests unsupported for the feature.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
Is it possible to set MIPSARCH to something like mips16xxx like mips32 and mups32r2? If not, you are right and using MATCHES is the best choice.
My thinking was that they're both substring matches and the shorter version is a bit simpler. Having dug into it a bit more it looks like MIPSARCH has just been transcribed from the Makefile where it was an arbitrary string provided by one of our internal buildbots. 'mips16' is the only MIPS16-related value I can see.
In light of that, we probably shouldn't require the user to provide it and instead figure it out from the CFLAGS/CXXFLAGS by checking for __mips16 with check_symbol_exists(). Similarly for the other checks on MIPSARCH.
Use check_symbol_exists to automatically deduce enabled MIPS features, set the corresponding 'flags' and check this flag in CMakeLists.txt files.