CMakeLists.txt 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. project(Framework)
  2. add_library(foo SHARED
  3. foo.cxx
  4. foo.h
  5. foo2.h
  6. fooPublic.h
  7. fooPrivate.h
  8. fooNeither.h
  9. fooBoth.h
  10. test.lua
  11. )
  12. set(foo_ver ver4)
  13. set_target_properties(foo PROPERTIES
  14. FRAMEWORK TRUE
  15. FRAMEWORK_VERSION ${foo_ver}
  16. PRIVATE_HEADER "fooPrivate.h;fooBoth.h"
  17. PUBLIC_HEADER "foo.h;foo2.h;fooPublic.h;fooBoth.h"
  18. RESOURCE "test.lua"
  19. )
  20. # fooBoth.h is listed as both public and private... (private wins...)
  21. # fooNeither.h is listed as neither public nor private...
  22. add_executable(bar bar.cxx)
  23. target_link_libraries(bar foo)
  24. install(TARGETS foo bar
  25. RUNTIME DESTINATION Applications/CMakeTestsFramework/bin
  26. FRAMEWORK DESTINATION Library/Frameworks
  27. # These are ignored on the Mac... and things are automatically placed in
  28. # their appropriate Framework sub-folder at build time. (And then the built
  29. # framework is copied recursively when it is installed.)
  30. PRIVATE_HEADER DESTINATION share/foo-${foo_ver}/PrivateHeaders
  31. PUBLIC_HEADER DESTINATION include/foo-${foo_ver}
  32. RESOURCE DESTINATION share/foo-${foo_ver}/Resources
  33. # But they are required to be present so that installing a framework on other
  34. # other platforms will install the pieces of the framework without having to
  35. # duplicate install rules for the pieces of the framework.
  36. )
  37. # Make a static library and apply the framework properties to it to verify
  38. # that everything still builds correctly, but it will not actually produce
  39. # a framework... The framework properties only apply when the library type
  40. # is SHARED.
  41. #
  42. add_library(fooStatic STATIC
  43. foo.cxx
  44. foo.h
  45. foo2.h
  46. fooPublic.h
  47. fooPrivate.h
  48. fooNeither.h
  49. fooBoth.h
  50. test.lua
  51. )
  52. set_target_properties(fooStatic PROPERTIES
  53. FRAMEWORK TRUE
  54. FRAMEWORK_VERSION none
  55. )
  56. add_executable(barStatic bar.cxx)
  57. target_link_libraries(barStatic fooStatic)
  58. include(CPack)