CMakeLists.txt 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. # if (COMPILER_HAS_DEPRECATED)
  9. # shared_build_fail("Libshared l; return l.libshared_deprecated();" "Built use of deprecated class method. This should not be possible.")
  10. # else()
  11. # shared_build_pass("Libshared l; return l.libshared_deprecated();" "Built use of deprecated class method. This should not be possible.")
  12. # endif()
  13. if (COMPILER_HAS_HIDDEN_VISIBILITY)
  14. shared_build_fail("Libshared l; return l.libshared_excluded();" "Built use of excluded class method. This should not be possible.")
  15. else()
  16. # There is no MSVC equivalent to hiding symbols.
  17. shared_build_pass("Libshared l; return l.libshared_excluded();" "Built use of excluded class method. This is possible on MSVC.")
  18. endif()
  19. if (WIN32 OR COMPILER_HAS_HIDDEN_VISIBILITY)
  20. shared_build_fail("LibsharedNotExported l; return l.libshared();" "Built use of not-exported class method. This should not be possible.")
  21. shared_build_fail("LibsharedNotExported l; return l.libshared_not_exported();" "Built use of not-exported class method. This should not be possible.")
  22. shared_build_fail("LibsharedNotExported l; return l.libshared_excluded();" "Built use of not-exported class method. This should not be possible.")
  23. shared_build_fail("LibsharedExcluded l; return l.libshared();" "Built use of excluded class method. This should not be possible.")
  24. shared_build_fail("LibsharedExcluded l; return l.libshared_not_exported();" "Built use of excluded class method. This should not be possible.")
  25. shared_build_fail("LibsharedExcluded l; return l.libshared_excluded();" "Built use of excluded class method. This should not be possible.")
  26. shared_build_fail("return libshared_excluded();" "Built use of excluded function. This should not be possible.")
  27. shared_build_fail("return libshared_not_exported();" "Built use of not-exported function. This should not be possible.")
  28. else()
  29. shared_build_pass("LibsharedNotExported l; return l.libshared();" "Built use of not-exported class method.")
  30. shared_build_pass("LibsharedNotExported l; return l.libshared_not_exported();" "Built use of not-exported class method.")
  31. shared_build_pass("LibsharedNotExported l; return l.libshared_excluded();" "Built use of not-exported class method.")
  32. shared_build_pass("LibsharedExcluded l; return l.libshared();" "Built use of excluded class method.")
  33. shared_build_pass("LibsharedExcluded l; return l.libshared_not_exported();" "Built use of excluded class method.")
  34. shared_build_pass("LibsharedExcluded l; return l.libshared_excluded();" "Built use of excluded class method.")
  35. shared_build_pass("return libshared_excluded();" "Built use of excluded function.")
  36. shared_build_pass("return libshared_not_exported();" "Built use of not-exported function.")
  37. endif()