compiletest.cpp 657 B

123456789101112131415161718192021222324252627282930313233
  1. #ifndef CMAKE_IS_FUN
  2. #error Expect CMAKE_IS_FUN definition
  3. #endif
  4. #if CMAKE_IS != Fun
  5. #error Expect CMAKE_IS=Fun definition
  6. #endif
  7. template<bool test>
  8. struct CMakeStaticAssert;
  9. template<>
  10. struct CMakeStaticAssert<true> {};
  11. static const char fun_string[] = CMAKE_IS_;
  12. #ifndef NO_SPACES_IN_DEFINE_VALUES
  13. static const char very_fun_string[] = CMAKE_IS_REALLY;
  14. #endif
  15. enum {
  16. StringLiteralTest1 = sizeof(CMakeStaticAssert<sizeof(CMAKE_IS_) == sizeof("Fun")>)
  17. #ifndef NO_SPACES_IN_DEFINE_VALUES
  18. ,
  19. StringLiteralTest2 = sizeof(CMakeStaticAssert<sizeof(CMAKE_IS_REALLY) == sizeof("Very Fun")>)
  20. #endif
  21. };
  22. int main(int argc, char **argv)
  23. {
  24. return 0;
  25. }