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