root/trunk/digitalme/CMakeLists.txt @ 1200

Revision 1200, 8.9 kB (checked in by ahodgkinson, 3 years ago)

digitalme: Misc. project restructuring.

  • Property svn:eol-style set to native
Line 
1#------------------------------------------------------------------------------
2# Desc:
3# Tabs: 3
4#
5# Copyright (c) 2007 Novell, Inc. All Rights Reserved.
6#
7# This program and the accompanying materials are made available
8# under the terms of the Eclipse Public License v1.0 which
9# accompanies this distribution, and is available at
10# http://www.eclipse.org/legal/epl-v10.html
11#
12# To contact Novell about this file by physical or electronic mail,
13# you may find current contact information at www.novell.com.
14#
15# $Id$
16#
17# Author: Andrew Hodgkinson <ahodgkinson@novell.com>
18#------------------------------------------------------------------------------
19
20project( digitalme)
21
22# Include the local modules directory
23
24set( CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/ftk/CMakeModules")
25
26# Make sure the version of CMake is compatible with this script
27
28CMAKE_MINIMUM_REQUIRED( VERSION 2.4 FATAL_ERROR)
29
30if( APPLE)
31        if( ${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4
32                AND ${CMAKE_PATCH_VERSION} LESS 7)
33                message( "Warning: A critical CMake bug exists in 2.4.6 and below.  "
34                                        "Trying to build Universal Binaries will result in a compile "
35                                        "error that seems unrelated.  Either avoid building Universal "
36                                        "Binaries by changing the CMAKE_OSX_ARCHITECTURES field to list "
37                                        "only your architecture, or upgrade to a newer version of CMake.")
38  endif( ${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4
39                AND ${CMAKE_PATCH_VERSION} LESS 7)
40endif( APPLE)
41
42include( CheckStandardIncludes)
43
44# Configure to build universal binaries.  Build 32-bit Intel/PPC on 10.4 and
45# 32/64-bit Intel/PPC on >= 10.5
46
47if( APPLE)
48        if( NOT OSX_CONFIG_HAS_BEEN_RUN_BEFORE)
49                if( EXISTS /Developer/SDKs/10.5.sdk)
50                        set( CMAKE_OSX_ARCHITECTURES "ppc;i386;ppc64;x86_64" CACHE STRING "Build architectures for OSX" FORCE)
51                        set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=10.5"
52                                CACHE STRING "Flags used by the compiler during all build types." FORCE)
53                else( EXISTS /Developer/SDKs/10.5.sdk)
54                        if( EXISTS /Developer/SDKs/MacOSX10.4u.sdk)
55                                set( CMAKE_OSX_ARCHITECTURES "ppc;i386" CACHE STRING "Build architectures for OSX" FORCE)
56                                set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=10.4"
57                                        CACHE STRING "Flags used by the compiler during all build types." FORCE)
58                        else( EXISTS /Developer/SDKs/MacOSX10.4u.sdk)
59                                # No Universal Binary support
60                        endif( EXISTS /Developer/SDKs/MacOSX10.4u.sdk)
61                endif( EXISTS /Developer/SDKs/10.5.sdk)
62                set( OSX_CONFIG_HAS_BEEN_RUN_BEFORE TRUE)
63        endif( NOT OSX_CONFIG_HAS_BEEN_RUN_BEFORE)
64endif( APPLE)
65
66# Build type
67
68if( NOT CMAKE_BUILD_TYPE)
69        set( CMAKE_BUILD_TYPE Release)
70endif( NOT CMAKE_BUILD_TYPE)
71
72if( CMAKE_BUILD_TYPE STREQUAL "Debug")
73        set( CMAKE_BUILD_TYPE Debug)
74        set( DEBUG_BUILD TRUE)
75endif( CMAKE_BUILD_TYPE STREQUAL "Debug")
76
77if( DEBUG_BUILD)
78        message( STATUS "Debug ${PROJECT_NAME} build.")
79        add_definitions( -DFTK_DEBUG)
80else( DEBUG_BUILD)
81        message( STATUS "Release ${PROJECT_NAME} build.")
82        set( CMAKE_CXX_FLAGS_RELEASE "-O")
83endif( DEBUG_BUILD)
84
85#set( CMAKE_VERBOSE_MAKEFILE TRUE)
86
87# Define directories
88
89set( CMAKE_BINARY_DIR ${CMAKE_BINARY_DIR}/build)
90set( PROJECT_BINARY_DIR ${CMAKE_BINARY_DIR})
91set( LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib CACHE PATH
92    "Single output directory for building all libraries.")
93set( EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin CACHE PATH
94    "Single output directory for building all executables.")
95set( RESOURCE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/resources CACHE PATH
96         "Project resources directory.")
97set( CERT_OUTPUT_PATH ${RESOURCE_OUTPUT_PATH}/certs)
98mark_as_advanced( LIBRARY_OUTPUT_PATH EXECUTABLE_OUTPUT_PATH
99        RESOURCE_OUTPUT_PATH CERT_OUTPUT_PATH) 
100
101# Create output directories
102
103if( NOT EXISTS ${RESOURCE_OUTPUT_PATH})
104        file( MAKE_DIRECTORY ${RESOURCE_OUTPUT_PATH})
105endif( NOT EXISTS ${RESOURCE_OUTPUT_PATH})
106
107# Set the project version
108
109if( NOT PROJECT_VERSION)
110        include( FindSubversion OPTIONAL)
111       
112        if( Subversion_FOUND)
113                Subversion_WC_INFO( ${PROJECT_SOURCE_DIR} PROJECT)
114        endif( Subversion_FOUND)
115       
116        if( NOT PROJECT_WC_REVISION)
117                message( "Unable to determine subversion revision")
118                set( PROJECT_WC_REVISION 999999)
119        endif( NOT PROJECT_WC_REVISION)
120       
121        message( STATUS "Current subversion revision is ${PROJECT_WC_REVISION}")
122       
123        set( PROJECT_MAJOR_VERSION 0)
124        set( PROJECT_MINOR_VERSION 4)
125        set( PROJECT_REVISION ${PROJECT_WC_REVISION})
126        set( PROJECT_VERSION "${PROJECT_MAJOR_VERSION}.${PROJECT_MINOR_VERSION}.${PROJECT_REVISION}")
127endif( NOT PROJECT_VERSION)
128
129message( STATUS "Current project version is ${PROJECT_VERSION}")
130
131# Define the project version
132
133add_definitions( -DPROJECT_VERSION='"${PROJECT_VERSION}"')
134
135# Platform capabilities
136
137include( CheckSymbolExists)
138check_symbol_exists( va_copy "stdarg.h" HAVE_VA_COPY)
139
140if( HAVE_VA_COPY)
141        add_definitions( -DHAVE_VA_COPY)
142        message( "Added definition for HAVE_VA_COPY")
143endif( HAVE_VA_COPY)
144
145# Package definitions
146
147set( PACKAGE_NAME ${PROJECT_NAME})
148set( PACKAGE_VERSION ${PROJECT_VERSION})
149set( PACKAGE_RELEASE 0)
150set( PACKAGE_MAINTAINER_NAME "Andrew Hodgkinson")
151set( PACKAGE_MAINTAINER_EMAIL "ahodgkinson@novell.com")
152set( PACKAGE_DESCRIPTION "A Microsoft CardSpace compatible identity selector." )
153set( PACKAGE_DESCRIPTION_SUMMARY "cbselector" )
154set( PACKAGE_DEPENDS "")
155set( PACKAGE_BUILD_REQUIRES "gcc-c++ cmake >= 2.4 libglade2-devel >= 2.6 openssl-devel >= 0.9.7 gnome-keyring-devel >= 0.4 libxml2-devel >= 2.6 make >= 3.8")
156set( PACKAGE_RUNTIME_REQUIRES "libstdc++ openssl >= 0.9.7 gnome-keyring >= 0.4 gtk2 >= 2.8 libglade2 >= 2.6 libxml2 >= 2.6")
157
158set( PACKAGE_GROUP "Development Libraries" )
159set( PACKAGE_LICENSE "EPL, Other License(s), see package")
160
161set( SOURCE_PACKAGE_NAME "${PACKAGE_NAME}-${PACKAGE_VERSION}")
162
163# Installation location
164
165if( NOT PRODUCT_INSTALL_PREFIX)
166
167        set( PRODUCT_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
168       
169        message( STATUS "CMake System = ${CMAKE_SYSTEM_NAME}")
170       
171        if( ${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
172                set( PRODUCT_INSTALL_PREFIX
173                        "${CMAKE_INSTALL_PREFIX}/lib/${PROJECT_NAME}")
174        endif( ${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
175       
176        if( ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
177                set( PRODUCT_INSTALL_PREFIX
178                        "${CMAKE_INSTALL_PREFIX}/lib/${PROJECT_NAME}")
179        endif( ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
180       
181        if( ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
182                set( PRODUCT_INSTALL_PREFIX
183                        "${CMAKE_INSTALL_PREFIX}/lib/${PROJECT_NAME}")
184        endif( ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
185       
186endif( NOT PRODUCT_INSTALL_PREFIX)
187
188message( STATUS "Product Install Prefix = ${PRODUCT_INSTALL_PREFIX}")
189
190# Source installation location
191
192if( NOT DISABLE_SOURCE_INSTALL)
193
194        if( NOT SOURCE_INSTALL_PREFIX)
195                set( SOURCE_INSTALL_PREFIX
196                        ${CMAKE_INSTALL_PREFIX}/src/packages/SOURCES/${SOURCE_PACKAGE_NAME})
197        endif( NOT SOURCE_INSTALL_PREFIX)
198
199        message( STATUS "Source Install Prefix = ${SOURCE_INSTALL_PREFIX}")
200
201endif( NOT DISABLE_SOURCE_INSTALL)
202
203# Include directories
204
205set( FTK_INCLUDE_DIRS
206        "${PROJECT_SOURCE_DIR}/ftk/include")
207set( ISS_INCLUDE_DIRS
208        "${PROJECT_SOURCE_DIR}/iss/include")
209
210# Source directories
211
212add_subdirectory( ./ftk/src
213        ${LIBRARY_OUTPUT_PATH}/ftk)
214add_subdirectory( ./iss/src
215        ${LIBRARY_OUTPUT_PATH}/iss)
216
217if( NOT APPLE)
218        add_subdirectory( ./ui/gtk/src
219                ${EXECUTABLE_OUTPUT_PATH}/bin)
220endif( NOT APPLE)
221
222# Copy resources to the output directory
223
224if( RESOURCE_OUTPUT_PATH)
225        set( CERT_INPUT_PATH ./ftk/certs)
226       
227        file( GLOB cert_resource_files ${CERT_INPUT_PATH}/*.crt)
228
229        if( NOT EXISTS ${CERT_OUTPUT_PATH})
230                file( MAKE_DIRECTORY ${CERT_OUTPUT_PATH})
231        endif( NOT EXISTS ${CERT_OUTPUT_PATH})
232
233        foreach( resource_file ${cert_resource_files})
234                execute_process( COMMAND ${CMAKE_COMMAND}
235                        -E copy ${resource_file} ${CERT_OUTPUT_PATH})
236        endforeach( resource_file)
237endif( RESOURCE_OUTPUT_PATH)
238
239# Install
240
241install(
242        FILES ${CERT_OUTPUT_PATH}/ca-bundle.crt
243        DESTINATION ${PRODUCT_INSTALL_PREFIX}/certs
244)
245
246if( SOURCE_INSTALL_PREFIX)
247
248        install(
249                FILES ${CERT_OUTPUT_PATH}/ca-bundle.crt
250                DESTINATION ${SOURCE_INSTALL_PREFIX}/certs
251        )
252       
253        install(
254                FILES CMakeLists.txt
255                DESTINATION ${SOURCE_INSTALL_PREFIX}
256        )
257
258        install(
259                FILES configure
260                DESTINATION ${SOURCE_INSTALL_PREFIX}
261                PERMISSIONS OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE
262        )
263       
264        file( GLOB CUSTOM_CMAKE_MODULES
265                ${CMAKE_MODULE_PATH}/*.cmake)
266       
267        install(
268                FILES ${CUSTOM_CMAKE_MODULES}
269                DESTINATION ${SOURCE_INSTALL_PREFIX}/CMakeModules
270        )
271       
272        install(
273                FILES ./AUTHORS
274                                ./ChangeLog
275                                ./COPYING
276                                ./COPYRIGHT
277                                ./INSTALL
278                                ./NEWS
279                                ./README
280                                ./TODO
281                DESTINATION ${SOURCE_INSTALL_PREFIX}
282        )
283       
284endif( SOURCE_INSTALL_PREFIX)
285
286# RPM packages
287
288if( ${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
289        include ( RPMBuild)
290endif( ${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
291
292if( RPMBUILD_FOUND)
293        add_rpm( ${PROJECT_NAME})
294endif( RPMBUILD_FOUND)
295
296# Project version
297
298add_custom_target( output_project_version ALL
299        COMMAND ${CMAKE_COMMAND} -E echo ${PROJECT_VERSION} > ${CMAKE_BINARY_DIR}/version
300)
301
302# Build type
303
304add_custom_target( output_build_type ALL
305        COMMAND ${CMAKE_COMMAND} -E echo ${CMAKE_BUILD_TYPE} > ${CMAKE_BINARY_DIR}/build-type
306)
Note: See TracBrowser for help on using the browser.