CMakeLists.txt 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. LIBRARY DESTINATION lib
  28. ARCHIVE DESTINATION lib
  29. # These are ignored on the Mac... and things are automatically placed in
  30. # their appropriate Framework sub-folder at build time. (And then the built
  31. # framework is copied recursively when it is installed.)
  32. PRIVATE_HEADER DESTINATION share/foo-${foo_ver}/PrivateHeaders
  33. PUBLIC_HEADER DESTINATION include/foo-${foo_ver}
  34. RESOURCE DESTINATION share/foo-${foo_ver}/Resources
  35. # But they are required to be present so that installing a framework on other
  36. # other platforms will install the pieces of the framework without having to
  37. # duplicate install rules for the pieces of the framework.
  38. )
  39. # Make a static library and apply the framework properties to it to verify
  40. # that everything still builds correctly, but it will not actually produce
  41. # a framework... The framework properties only apply when the library type
  42. # is SHARED.
  43. #
  44. add_library(fooStatic STATIC
  45. foo.cxx
  46. foo.h
  47. foo2.h
  48. fooPublic.h
  49. fooPrivate.h
  50. fooNeither.h
  51. fooBoth.h
  52. test.lua
  53. )
  54. set_target_properties(fooStatic PROPERTIES
  55. FRAMEWORK TRUE
  56. FRAMEWORK_VERSION none
  57. )
  58. add_executable(barStatic bar.cxx)
  59. target_link_libraries(barStatic fooStatic)
  60. include(CPack)