compiletest.cpp 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. #ifdef TEST_GENERATOR_EXPRESSIONS
  23. #ifndef CMAKE_IS_DECLARATIVE
  24. #error Expect declarative definition
  25. #endif
  26. #ifdef GE_NOT_DEFINED
  27. #error Expect not defined generator expression
  28. #endif
  29. #ifndef ARGUMENT
  30. #error Expected define expanded from list
  31. #endif
  32. #ifndef LIST
  33. #error Expected define expanded from list
  34. #endif
  35. // TEST_GENERATOR_EXPRESSIONS
  36. #endif
  37. #ifndef BUILD_IS_DEBUG
  38. # error "BUILD_IS_DEBUG not defined!"
  39. #endif
  40. #ifndef BUILD_IS_NOT_DEBUG
  41. # error "BUILD_IS_NOT_DEBUG not defined!"
  42. #endif
  43. // Check per-config definitions.
  44. #ifdef TEST_CONFIG_DEBUG
  45. # if !BUILD_IS_DEBUG
  46. # error "BUILD_IS_DEBUG false with TEST_CONFIG_DEBUG!"
  47. # endif
  48. # if BUILD_IS_NOT_DEBUG
  49. # error "BUILD_IS_NOT_DEBUG true with TEST_CONFIG_DEBUG!"
  50. # endif
  51. #else
  52. # if BUILD_IS_DEBUG
  53. # error "BUILD_IS_DEBUG true without TEST_CONFIG_DEBUG!"
  54. # endif
  55. # if !BUILD_IS_NOT_DEBUG
  56. # error "BUILD_IS_NOT_DEBUG false without TEST_CONFIG_DEBUG!"
  57. # endif
  58. #endif
  59. int main(int argc, char **argv)
  60. {
  61. return 0;
  62. }