CMakeLists.txt 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. macro(shared_build_pass Source Message)
  2. build_pass("libshared.h" "libshared" "libshared" "${Source}" ${Message})
  3. endmacro()
  4. macro(shared_build_fail Source Message)
  5. build_fail("libshared.h" "libshared" "libshared" "${Source}" ${Message})
  6. endmacro()
  7. shared_build_pass("Libshared l; return l.libshared_exported();" "Failed to build exported")
  8. shared_build_pass("return libshared_exported();" "Failed to build exported function.")
  9. # if (COMPILER_HAS_DEPRECATED)
  10. # shared_build_fail("Libshared l; return l.libshared_deprecated();" "Built use of deprecated class method. This should not be possible.")
  11. # else()
  12. # shared_build_pass("Libshared l; return l.libshared_deprecated();" "Built use of deprecated class method. This should not be possible.")
  13. # endif()
  14. if (COMPILER_HAS_HIDDEN_VISIBILITY)
  15. shared_build_fail("Libshared l; return l.libshared_excluded();" "Built use of excluded class method. This should not be possible.")
  16. else()
  17. # There is no MSVC equivalent to hiding symbols.
  18. shared_build_pass("Libshared l; return l.libshared_excluded();" "Built use of excluded class method. This is possible on MSVC.")
  19. endif()
  20. if (WIN32 OR COMPILER_HAS_HIDDEN_VISIBILITY)
  21. shared_build_fail("LibsharedNotExported l; return l.libshared();" "Built use of not-exported class method. This should not be possible.")
  22. shared_build_fail("LibsharedNotExported l; return l.libshared_not_exported();" "Built use of not-exported class method. This should not be possible.")
  23. shared_build_fail("LibsharedNotExported l; return l.libshared_excluded();" "Built use of not-exported class method. This should not be possible.")
  24. shared_build_fail("LibsharedExcluded l; return l.libshared();" "Built use of excluded class method. This should not be possible.")
  25. shared_build_fail("LibsharedExcluded l; return l.libshared_not_exported();" "Built use of excluded class method. This should not be possible.")
  26. shared_build_fail("LibsharedExcluded l; return l.libshared_excluded();" "Built use of excluded class method. This should not be possible.")
  27. shared_build_fail("return libshared_excluded();" "Built use of excluded function. This should not be possible.")
  28. shared_build_fail("return libshared_not_exported();" "Built use of not-exported function. This should not be possible.")
  29. else()
  30. shared_build_pass("LibsharedNotExported l; return l.libshared();" "Built use of not-exported class method.")
  31. shared_build_pass("LibsharedNotExported l; return l.libshared_not_exported();" "Built use of not-exported class method.")
  32. shared_build_pass("LibsharedNotExported l; return l.libshared_excluded();" "Built use of not-exported class method.")
  33. shared_build_pass("LibsharedExcluded l; return l.libshared();" "Built use of excluded class method.")
  34. shared_build_pass("LibsharedExcluded l; return l.libshared_not_exported();" "Built use of excluded class method.")
  35. shared_build_pass("LibsharedExcluded l; return l.libshared_excluded();" "Built use of excluded class method.")
  36. shared_build_pass("return libshared_excluded();" "Built use of excluded function.")
  37. shared_build_pass("return libshared_not_exported();" "Built use of not-exported function.")
  38. endif()