2008-03-25 18:27:18 +03:00
|
|
|
cmake_minimum_required (VERSION 2.6)
|
2007-05-08 18:58:35 +04:00
|
|
|
project(Framework)
|
2007-08-01 21:04:45 +04:00
|
|
|
|
2007-08-14 19:45:15 +04:00
|
|
|
add_library(foo SHARED
|
|
|
|
foo.cxx
|
|
|
|
foo.h
|
|
|
|
foo2.h
|
2008-09-05 23:51:19 +04:00
|
|
|
fooExtensionlessResource
|
2007-08-14 19:45:15 +04:00
|
|
|
fooPublic.h
|
2008-09-05 23:51:19 +04:00
|
|
|
fooPublicExtensionlessHeader
|
2007-08-14 19:45:15 +04:00
|
|
|
fooPrivate.h
|
2008-09-05 23:51:19 +04:00
|
|
|
fooPrivateExtensionlessHeader
|
2007-08-14 19:45:15 +04:00
|
|
|
fooNeither.h
|
|
|
|
fooBoth.h
|
|
|
|
test.lua
|
2008-04-08 08:06:47 +04:00
|
|
|
fooDeepPublic.h
|
2007-08-14 19:45:15 +04:00
|
|
|
)
|
2008-04-08 08:06:47 +04:00
|
|
|
set_property(SOURCE fooDeepPublic.h
|
|
|
|
PROPERTY MACOSX_PACKAGE_LOCATION Headers/Deep
|
|
|
|
)
|
2007-10-10 19:06:15 +04:00
|
|
|
set(foo_ver ver4)
|
|
|
|
|
2007-08-01 21:04:45 +04:00
|
|
|
set_target_properties(foo PROPERTIES
|
2007-05-08 19:53:39 +04:00
|
|
|
FRAMEWORK TRUE
|
2007-10-10 19:06:15 +04:00
|
|
|
FRAMEWORK_VERSION ${foo_ver}
|
2008-09-05 23:51:19 +04:00
|
|
|
PRIVATE_HEADER "fooPrivate.h;fooBoth.h;fooPrivateExtensionlessHeader"
|
|
|
|
PUBLIC_HEADER "foo.h;foo2.h;fooPublic.h;fooBoth.h;fooPublicExtensionlessHeader"
|
|
|
|
RESOURCE "fooExtensionlessResource;test.lua"
|
2008-04-08 08:06:47 +04:00
|
|
|
INSTALL_NAME_DIR "@executable_path/../../../Library/Frameworks"
|
2008-04-14 23:27:27 +04:00
|
|
|
DEBUG_POSTFIX -d
|
2007-05-08 18:58:35 +04:00
|
|
|
)
|
2007-10-10 19:06:15 +04:00
|
|
|
# fooBoth.h is listed as both public and private... (private wins...)
|
|
|
|
# fooNeither.h is listed as neither public nor private...
|
|
|
|
|
2007-05-08 18:58:35 +04:00
|
|
|
add_executable(bar bar.cxx)
|
|
|
|
target_link_libraries(bar foo)
|
2007-08-24 21:30:41 +04:00
|
|
|
install(TARGETS foo bar
|
2007-10-10 19:06:15 +04:00
|
|
|
RUNTIME DESTINATION Applications/CMakeTestsFramework/bin
|
|
|
|
FRAMEWORK DESTINATION Library/Frameworks
|
2008-01-28 22:46:58 +03:00
|
|
|
LIBRARY DESTINATION lib
|
|
|
|
ARCHIVE DESTINATION lib
|
2007-10-10 19:06:15 +04:00
|
|
|
|
|
|
|
# These are ignored on the Mac... and things are automatically placed in
|
|
|
|
# their appropriate Framework sub-folder at build time. (And then the built
|
|
|
|
# framework is copied recursively when it is installed.)
|
|
|
|
PRIVATE_HEADER DESTINATION share/foo-${foo_ver}/PrivateHeaders
|
|
|
|
PUBLIC_HEADER DESTINATION include/foo-${foo_ver}
|
|
|
|
RESOURCE DESTINATION share/foo-${foo_ver}/Resources
|
|
|
|
# But they are required to be present so that installing a framework on other
|
|
|
|
# other platforms will install the pieces of the framework without having to
|
|
|
|
# duplicate install rules for the pieces of the framework.
|
2007-08-24 21:30:41 +04:00
|
|
|
)
|
2007-08-01 21:04:45 +04:00
|
|
|
|
2016-10-13 20:51:10 +03:00
|
|
|
# test that framework post-build commands run
|
|
|
|
add_custom_command(TARGET foo POST_BUILD COMMAND ${CMAKE_COMMAND} -E touch foo-post-build)
|
|
|
|
add_custom_target(fooCustom ALL COMMAND ${CMAKE_COMMAND} -E copy foo-post-build foo-custom)
|
|
|
|
add_dependencies(fooCustom foo)
|
|
|
|
|
2007-08-01 21:04:45 +04:00
|
|
|
# Make a static library and apply the framework properties to it to verify
|
|
|
|
# that everything still builds correctly, but it will not actually produce
|
|
|
|
# a framework... The framework properties only apply when the library type
|
|
|
|
# is SHARED.
|
|
|
|
#
|
2007-08-14 19:45:15 +04:00
|
|
|
add_library(fooStatic STATIC
|
|
|
|
foo.cxx
|
|
|
|
foo.h
|
|
|
|
foo2.h
|
2008-09-05 23:51:19 +04:00
|
|
|
fooExtensionlessResource
|
2007-08-14 19:45:15 +04:00
|
|
|
fooPublic.h
|
2008-09-05 23:51:19 +04:00
|
|
|
fooPublicExtensionlessHeader
|
2007-08-14 19:45:15 +04:00
|
|
|
fooPrivate.h
|
2008-09-05 23:51:19 +04:00
|
|
|
fooPrivateExtensionlessHeader
|
2007-08-14 19:45:15 +04:00
|
|
|
fooNeither.h
|
|
|
|
fooBoth.h
|
|
|
|
test.lua
|
2008-09-05 23:51:19 +04:00
|
|
|
fooDeepPublic.h
|
2007-08-14 19:45:15 +04:00
|
|
|
)
|
2007-08-01 21:04:45 +04:00
|
|
|
set_target_properties(fooStatic PROPERTIES
|
|
|
|
FRAMEWORK TRUE
|
2007-08-14 19:45:15 +04:00
|
|
|
FRAMEWORK_VERSION none
|
2007-08-01 21:04:45 +04:00
|
|
|
)
|
|
|
|
add_executable(barStatic bar.cxx)
|
|
|
|
target_link_libraries(barStatic fooStatic)
|
2007-10-10 19:06:15 +04:00
|
|
|
|
|
|
|
include(CPack)
|