| 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 | |
|---|
| 20 | project( digitalme) |
|---|
| 21 | |
|---|
| 22 | # Include the local modules directory |
|---|
| 23 | |
|---|
| 24 | set( CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/ftk/CMakeModules") |
|---|
| 25 | |
|---|
| 26 | # Make sure the version of CMake is compatible with this script |
|---|
| 27 | |
|---|
| 28 | CMAKE_MINIMUM_REQUIRED( VERSION 2.4 FATAL_ERROR) |
|---|
| 29 | |
|---|
| 30 | if( 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) |
|---|
| 40 | endif( APPLE) |
|---|
| 41 | |
|---|
| 42 | include( 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 | |
|---|
| 47 | if( 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) |
|---|
| 64 | endif( APPLE) |
|---|
| 65 | |
|---|
| 66 | # Build type |
|---|
| 67 | |
|---|
| 68 | if( NOT CMAKE_BUILD_TYPE) |
|---|
| 69 | set( CMAKE_BUILD_TYPE Release) |
|---|
| 70 | endif( NOT CMAKE_BUILD_TYPE) |
|---|
| 71 | |
|---|
| 72 | if( CMAKE_BUILD_TYPE STREQUAL "Debug") |
|---|
| 73 | set( CMAKE_BUILD_TYPE Debug) |
|---|
| 74 | set( DEBUG_BUILD TRUE) |
|---|
| 75 | endif( CMAKE_BUILD_TYPE STREQUAL "Debug") |
|---|
| 76 | |
|---|
| 77 | if( DEBUG_BUILD) |
|---|
| 78 | message( STATUS "Debug ${PROJECT_NAME} build.") |
|---|
| 79 | add_definitions( -DFTK_DEBUG) |
|---|
| 80 | else( DEBUG_BUILD) |
|---|
| 81 | message( STATUS "Release ${PROJECT_NAME} build.") |
|---|
| 82 | set( CMAKE_CXX_FLAGS_RELEASE "-O") |
|---|
| 83 | endif( DEBUG_BUILD) |
|---|
| 84 | |
|---|
| 85 | #set( CMAKE_VERBOSE_MAKEFILE TRUE) |
|---|
| 86 | |
|---|
| 87 | # Define directories |
|---|
| 88 | |
|---|
| 89 | set( CMAKE_BINARY_DIR ${CMAKE_BINARY_DIR}/build) |
|---|
| 90 | set( PROJECT_BINARY_DIR ${CMAKE_BINARY_DIR}) |
|---|
| 91 | set( LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib CACHE PATH |
|---|
| 92 | "Single output directory for building all libraries.") |
|---|
| 93 | set( EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin CACHE PATH |
|---|
| 94 | "Single output directory for building all executables.") |
|---|
| 95 | set( BUILD_RESOURCE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/resources CACHE PATH |
|---|
| 96 | "Project resources directory.") |
|---|
| 97 | mark_as_advanced( LIBRARY_OUTPUT_PATH EXECUTABLE_OUTPUT_PATH |
|---|
| 98 | BUILD_RESOURCE_OUTPUT_PATH CERT_OUTPUT_PATH) |
|---|
| 99 | |
|---|
| 100 | # Create output directories |
|---|
| 101 | |
|---|
| 102 | if( NOT EXISTS ${BUILD_RESOURCE_OUTPUT_PATH}) |
|---|
| 103 | file( MAKE_DIRECTORY ${BUILD_RESOURCE_OUTPUT_PATH}) |
|---|
| 104 | endif( NOT EXISTS ${BUILD_RESOURCE_OUTPUT_PATH}) |
|---|
| 105 | |
|---|
| 106 | # Set the project version |
|---|
| 107 | |
|---|
| 108 | if( NOT PROJECT_VERSION) |
|---|
| 109 | include( FindSubversion OPTIONAL) |
|---|
| 110 | |
|---|
| 111 | if( Subversion_FOUND) |
|---|
| 112 | Subversion_WC_INFO( ${PROJECT_SOURCE_DIR} PROJECT) |
|---|
| 113 | endif( Subversion_FOUND) |
|---|
| 114 | |
|---|
| 115 | if( NOT PROJECT_WC_REVISION) |
|---|
| 116 | message( "Unable to determine subversion revision") |
|---|
| 117 | set( PROJECT_WC_REVISION 999999) |
|---|
| 118 | endif( NOT PROJECT_WC_REVISION) |
|---|
| 119 | |
|---|
| 120 | message( STATUS "Current subversion revision is ${PROJECT_WC_REVISION}") |
|---|
| 121 | |
|---|
| 122 | set( PROJECT_MAJOR_VERSION 0) |
|---|
| 123 | set( PROJECT_MINOR_VERSION 4) |
|---|
| 124 | set( PROJECT_REVISION ${PROJECT_WC_REVISION}) |
|---|
| 125 | set( PROJECT_VERSION "${PROJECT_MAJOR_VERSION}.${PROJECT_MINOR_VERSION}.${PROJECT_REVISION}") |
|---|
| 126 | endif( NOT PROJECT_VERSION) |
|---|
| 127 | |
|---|
| 128 | message( STATUS "Current project version is ${PROJECT_VERSION}") |
|---|
| 129 | |
|---|
| 130 | # Define the project version |
|---|
| 131 | |
|---|
| 132 | add_definitions( -DPROJECT_VERSION='"${PROJECT_VERSION}"') |
|---|
| 133 | |
|---|
| 134 | # Platform capabilities |
|---|
| 135 | |
|---|
| 136 | include( CheckSymbolExists) |
|---|
| 137 | check_symbol_exists( va_copy "stdarg.h" HAVE_VA_COPY) |
|---|
| 138 | |
|---|
| 139 | if( HAVE_VA_COPY) |
|---|
| 140 | add_definitions( -DHAVE_VA_COPY) |
|---|
| 141 | message( "Added definition for HAVE_VA_COPY") |
|---|
| 142 | endif( HAVE_VA_COPY) |
|---|
| 143 | |
|---|
| 144 | # Package definitions |
|---|
| 145 | |
|---|
| 146 | set( PACKAGE_NAME ${PROJECT_NAME}) |
|---|
| 147 | set( PACKAGE_VERSION ${PROJECT_VERSION}) |
|---|
| 148 | set( PACKAGE_RELEASE 0) |
|---|
| 149 | set( PACKAGE_MAINTAINER_NAME "Andrew Hodgkinson") |
|---|
| 150 | set( PACKAGE_MAINTAINER_EMAIL "ahodgkinson@novell.com") |
|---|
| 151 | set( PACKAGE_DESCRIPTION "A Microsoft CardSpace compatible identity selector." ) |
|---|
| 152 | set( PACKAGE_DESCRIPTION_SUMMARY "cbselector" ) |
|---|
| 153 | set( PACKAGE_DEPENDS "") |
|---|
| 154 | set( 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") |
|---|
| 155 | set( PACKAGE_RUNTIME_REQUIRES "libstdc++ openssl >= 0.9.7 gnome-keyring >= 0.4 gtk2 >= 2.8 libglade2 >= 2.6 libxml2 >= 2.6") |
|---|
| 156 | |
|---|
| 157 | set( PACKAGE_GROUP "Development Libraries" ) |
|---|
| 158 | set( PACKAGE_LICENSE "EPL, Other License(s), see package") |
|---|
| 159 | |
|---|
| 160 | set( SOURCE_PACKAGE_NAME "${PACKAGE_NAME}-${PACKAGE_VERSION}") |
|---|
| 161 | |
|---|
| 162 | # Installation location |
|---|
| 163 | |
|---|
| 164 | if( NOT PRODUCT_INSTALL_PREFIX) |
|---|
| 165 | |
|---|
| 166 | set( PRODUCT_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}) |
|---|
| 167 | |
|---|
| 168 | message( STATUS "CMake System = ${CMAKE_SYSTEM_NAME}") |
|---|
| 169 | |
|---|
| 170 | if( ${CMAKE_SYSTEM_NAME} STREQUAL "Linux") |
|---|
| 171 | set( PRODUCT_INSTALL_PREFIX |
|---|
| 172 | "${CMAKE_INSTALL_PREFIX}/lib/${PROJECT_NAME}") |
|---|
| 173 | endif( ${CMAKE_SYSTEM_NAME} STREQUAL "Linux") |
|---|
| 174 | |
|---|
| 175 | if( ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") |
|---|
| 176 | set( PRODUCT_INSTALL_PREFIX |
|---|
| 177 | "${CMAKE_INSTALL_PREFIX}/lib/${PROJECT_NAME}") |
|---|
| 178 | endif( ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") |
|---|
| 179 | |
|---|
| 180 | if( ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD") |
|---|
| 181 | set( PRODUCT_INSTALL_PREFIX |
|---|
| 182 | "${CMAKE_INSTALL_PREFIX}/lib/${PROJECT_NAME}") |
|---|
| 183 | endif( ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD") |
|---|
| 184 | |
|---|
| 185 | endif( NOT PRODUCT_INSTALL_PREFIX) |
|---|
| 186 | |
|---|
| 187 | message( STATUS "Product Install Prefix = ${PRODUCT_INSTALL_PREFIX}") |
|---|
| 188 | |
|---|
| 189 | # Source installation location |
|---|
| 190 | |
|---|
| 191 | if( NOT DISABLE_SOURCE_INSTALL) |
|---|
| 192 | |
|---|
| 193 | if( NOT SOURCE_INSTALL_PREFIX) |
|---|
| 194 | set( SOURCE_INSTALL_PREFIX |
|---|
| 195 | ${CMAKE_INSTALL_PREFIX}/src/packages/SOURCES/${SOURCE_PACKAGE_NAME}) |
|---|
| 196 | endif( NOT SOURCE_INSTALL_PREFIX) |
|---|
| 197 | |
|---|
| 198 | message( STATUS "Source Install Prefix = ${SOURCE_INSTALL_PREFIX}") |
|---|
| 199 | |
|---|
| 200 | endif( NOT DISABLE_SOURCE_INSTALL) |
|---|
| 201 | |
|---|
| 202 | # Include directories |
|---|
| 203 | |
|---|
| 204 | set( FTK_INCLUDE_DIRS |
|---|
| 205 | "${PROJECT_SOURCE_DIR}/ftk/include") |
|---|
| 206 | set( ISS_INCLUDE_DIRS |
|---|
| 207 | "${PROJECT_SOURCE_DIR}/iss/include") |
|---|
| 208 | |
|---|
| 209 | # Source directories |
|---|
| 210 | |
|---|
| 211 | add_subdirectory( ./ftk/src |
|---|
| 212 | ${LIBRARY_OUTPUT_PATH}/ftk) |
|---|
| 213 | add_subdirectory( ./iss/src |
|---|
| 214 | ${LIBRARY_OUTPUT_PATH}/iss) |
|---|
| 215 | |
|---|
| 216 | if( NOT APPLE) |
|---|
| 217 | add_subdirectory( ./ui/gtk/src |
|---|
| 218 | ${EXECUTABLE_OUTPUT_PATH}/bin) |
|---|
| 219 | endif( NOT APPLE) |
|---|
| 220 | |
|---|
| 221 | # Copy resources to the output directory |
|---|
| 222 | |
|---|
| 223 | # Install |
|---|
| 224 | |
|---|
| 225 | if( SOURCE_INSTALL_PREFIX) |
|---|
| 226 | |
|---|
| 227 | install( |
|---|
| 228 | FILES CMakeLists.txt |
|---|
| 229 | DESTINATION ${SOURCE_INSTALL_PREFIX} |
|---|
| 230 | ) |
|---|
| 231 | |
|---|
| 232 | install( |
|---|
| 233 | FILES configure |
|---|
| 234 | DESTINATION ${SOURCE_INSTALL_PREFIX} |
|---|
| 235 | PERMISSIONS OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE |
|---|
| 236 | ) |
|---|
| 237 | |
|---|
| 238 | install( |
|---|
| 239 | FILES ./AUTHORS |
|---|
| 240 | ./ChangeLog |
|---|
| 241 | ./COPYING |
|---|
| 242 | ./COPYRIGHT |
|---|
| 243 | ./INSTALL |
|---|
| 244 | ./NEWS |
|---|
| 245 | ./README |
|---|
| 246 | ./TODO |
|---|
| 247 | DESTINATION ${SOURCE_INSTALL_PREFIX} |
|---|
| 248 | ) |
|---|
| 249 | |
|---|
| 250 | endif( SOURCE_INSTALL_PREFIX) |
|---|
| 251 | |
|---|
| 252 | # RPM packages |
|---|
| 253 | |
|---|
| 254 | if( ${CMAKE_SYSTEM_NAME} STREQUAL "Linux") |
|---|
| 255 | include ( RPMBuild) |
|---|
| 256 | endif( ${CMAKE_SYSTEM_NAME} STREQUAL "Linux") |
|---|
| 257 | |
|---|
| 258 | if( RPMBUILD_FOUND) |
|---|
| 259 | add_rpm( ${PROJECT_NAME}) |
|---|
| 260 | endif( RPMBUILD_FOUND) |
|---|
| 261 | |
|---|
| 262 | # Project version |
|---|
| 263 | |
|---|
| 264 | add_custom_target( output_project_version ALL |
|---|
| 265 | COMMAND ${CMAKE_COMMAND} -E echo ${PROJECT_VERSION} > ${CMAKE_BINARY_DIR}/version |
|---|
| 266 | ) |
|---|
| 267 | |
|---|
| 268 | # Build type |
|---|
| 269 | |
|---|
| 270 | add_custom_target( output_build_type ALL |
|---|
| 271 | COMMAND ${CMAKE_COMMAND} -E echo ${CMAKE_BUILD_TYPE} > ${CMAKE_BINARY_DIR}/build-type |
|---|
| 272 | ) |
|---|