CMakeLists.txt 2.1 KB

12345678910111213141516171819202122232425262728293031
  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 (NOT ${CMAKE_CXX_COMPILER_ID} MATCHES Borland)
  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. shared_build_fail("LibsharedNotExported l; return l.libshared();" "Built use of not-exported class method. This should not be possible.")
  20. shared_build_fail("LibsharedNotExported l; return l.libshared_not_exported();" "Built use of not-exported class method. This should not be possible.")
  21. shared_build_fail("LibsharedNotExported l; return l.libshared_excluded();" "Built use of not-exported class method. This should not be possible.")
  22. shared_build_fail("LibsharedExcluded l; return l.libshared();" "Built use of excluded class method. This should not be possible.")
  23. shared_build_fail("LibsharedExcluded l; return l.libshared_not_exported();" "Built use of excluded class method. This should not be possible.")
  24. shared_build_fail("LibsharedExcluded l; return l.libshared_excluded();" "Built use of excluded class method. This should not be possible.")
  25. shared_build_fail("return libshared_excluded();" "Built use of excluded function. This should not be possible.")
  26. shared_build_fail("return libshared_not_exported();" "Built use of not-exported function. This should not be possible.")