CMakeLists.txt 2.3 KB

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