| 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( RESOURCE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/resources CACHE PATH |
|---|
| 96 | "Project resources directory.") |
|---|
| 97 | set( CERT_OUTPUT_PATH ${RESOURCE_OUTPUT_PATH}/certs) |
|---|
| 98 | mark_as_advanced( LIBRARY_OUTPUT_PATH EXECUTABLE_OUTPUT_PATH |
|---|
| 99 | RESOURCE_OUTPUT_PATH CERT_OUTPUT_PATH) |
|---|
| 100 | |
|---|
| 101 | # Create output directories |
|---|
| 102 | |
|---|
| 103 | if( NOT EXISTS ${RESOURCE_OUTPUT_PATH}) |
|---|
| 104 | file( MAKE_DIRECTORY ${RESOURCE_OUTPUT_PATH}) |
|---|
| 105 | endif( NOT EXISTS ${RESOURCE_OUTPUT_PATH}) |
|---|
| 106 | |
|---|
| 107 | # Set the project version |
|---|
| 108 | |
|---|
| 109 | if( 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}") |
|---|
| 127 | endif( NOT PROJECT_VERSION) |
|---|
| 128 | |
|---|
| 129 | message( STATUS "Current project version is ${PROJECT_VERSION}") |
|---|
| 130 | |
|---|
| 131 | # Define the project version |
|---|
| 132 | |
|---|
| 133 | add_definitions( -DPROJECT_VERSION='"${PROJECT_VERSION}"') |
|---|
| 134 | |
|---|
| 135 | # Platform capabilities |
|---|
| 136 | |
|---|
| 137 | include( CheckSymbolExists) |
|---|
| 138 | check_symbol_exists( va_copy "stdarg.h" HAVE_VA_COPY) |
|---|
| 139 | |
|---|
| 140 | if( HAVE_VA_COPY) |
|---|
| 141 | add_definitions( -DHAVE_VA_COPY) |
|---|
| 142 | message( "Added definition for HAVE_VA_COPY") |
|---|
| 143 | endif( HAVE_VA_COPY) |
|---|
| 144 | |
|---|
| 145 | # Package definitions |
|---|
| 146 | |
|---|
| 147 | set( PACKAGE_NAME ${PROJECT_NAME}) |
|---|
| 148 | set( PACKAGE_VERSION ${PROJECT_VERSION}) |
|---|
| 149 | set( PACKAGE_RELEASE 0) |
|---|
| 150 | set( PACKAGE_MAINTAINER_NAME "Andrew Hodgkinson") |
|---|
| 151 | set( PACKAGE_MAINTAINER_EMAIL "ahodgkinson@novell.com") |
|---|
| 152 | set( PACKAGE_DESCRIPTION "A Microsoft CardSpace compatible identity selector." ) |
|---|
| 153 | set( PACKAGE_DESCRIPTION_SUMMARY "cbselector" ) |
|---|
| 154 | set( PACKAGE_DEPENDS "") |
|---|
| 155 | 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") |
|---|
| 156 | set( PACKAGE_RUNTIME_REQUIRES "libstdc++ openssl >= 0.9.7 gnome-keyring >= 0.4 gtk2 >= 2.8 libglade2 >= 2.6 libxml2 >= 2.6") |
|---|
| 157 | |
|---|
| 158 | set( PACKAGE_GROUP "Development Libraries" ) |
|---|
| 159 | set( PACKAGE_LICENSE "EPL, Other License(s), see package") |
|---|
| 160 | |
|---|
| 161 | set( SOURCE_PACKAGE_NAME "${PACKAGE_NAME}-${PACKAGE_VERSION}") |
|---|
| 162 | |
|---|
| 163 | # Installation location |
|---|
| 164 | |
|---|
| 165 | if( 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 | |
|---|
| 186 | endif( NOT PRODUCT_INSTALL_PREFIX) |
|---|
| 187 | |
|---|
| 188 | message( STATUS "Product Install Prefix = ${PRODUCT_INSTALL_PREFIX}") |
|---|
| 189 | |
|---|
| 190 | # Source installation location |
|---|
| 191 | |
|---|
| 192 | if( 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 | |
|---|
| 201 | endif( NOT DISABLE_SOURCE_INSTALL) |
|---|
| 202 | |
|---|
| 203 | # Include directories |
|---|
| 204 | |
|---|
| 205 | set( FTK_INCLUDE_DIRS |
|---|
| 206 | "${PROJECT_SOURCE_DIR}/ftk/include") |
|---|
| 207 | set( ISS_INCLUDE_DIRS |
|---|
| 208 | "${PROJECT_SOURCE_DIR}/iss/include") |
|---|
| 209 | |
|---|
| 210 | # Source directories |
|---|
| 211 | |
|---|
| 212 | add_subdirectory( ./ftk/src |
|---|
| 213 | ${LIBRARY_OUTPUT_PATH}/ftk) |
|---|
| 214 | add_subdirectory( ./iss/src |
|---|
| 215 | ${LIBRARY_OUTPUT_PATH}/iss) |
|---|
| 216 | |
|---|
| 217 | if( NOT APPLE) |
|---|
| 218 | add_subdirectory( ./ui/gtk/src |
|---|
| 219 | ${EXECUTABLE_OUTPUT_PATH}/bin) |
|---|
| 220 | endif( NOT APPLE) |
|---|
| 221 | |
|---|
| 222 | # Copy resources to the output directory |
|---|
| 223 | |
|---|
| 224 | if( 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) |
|---|
| 237 | endif( RESOURCE_OUTPUT_PATH) |
|---|
| 238 | |
|---|
| 239 | # Install |
|---|
| 240 | |
|---|
| 241 | install( |
|---|
| 242 | FILES ${CERT_OUTPUT_PATH}/ca-bundle.crt |
|---|
| 243 | DESTINATION ${PRODUCT_INSTALL_PREFIX}/certs |
|---|
| 244 | ) |
|---|
| 245 | |
|---|
| 246 | if( 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 | |
|---|
| 284 | endif( SOURCE_INSTALL_PREFIX) |
|---|
| 285 | |
|---|
| 286 | # RPM packages |
|---|
| 287 | |
|---|
| 288 | if( ${CMAKE_SYSTEM_NAME} STREQUAL "Linux") |
|---|
| 289 | include ( RPMBuild) |
|---|
| 290 | endif( ${CMAKE_SYSTEM_NAME} STREQUAL "Linux") |
|---|
| 291 | |
|---|
| 292 | if( RPMBUILD_FOUND) |
|---|
| 293 | add_rpm( ${PROJECT_NAME}) |
|---|
| 294 | endif( RPMBUILD_FOUND) |
|---|
| 295 | |
|---|
| 296 | # Project version |
|---|
| 297 | |
|---|
| 298 | add_custom_target( output_project_version ALL |
|---|
| 299 | COMMAND ${CMAKE_COMMAND} -E echo ${PROJECT_VERSION} > ${CMAKE_BINARY_DIR}/version |
|---|
| 300 | ) |
|---|
| 301 | |
|---|
| 302 | # Build type |
|---|
| 303 | |
|---|
| 304 | add_custom_target( output_build_type ALL |
|---|
| 305 | COMMAND ${CMAKE_COMMAND} -E echo ${CMAKE_BUILD_TYPE} > ${CMAKE_BINARY_DIR}/build-type |
|---|
| 306 | ) |
|---|