PageRenderTime 14ms CodeModel.GetById 9ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/CMakeLists.txt

https://code.google.com/
CMake | 136 lines | 98 code | 21 blank | 17 comment | 10 complexity | ec7ced09ccfe84363b59c24036d116ba MD5 | raw file
  1cmake_minimum_required(VERSION 2.6)
  2project(flvmeta C)
  3
  4set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH})
  5
  6set(FLVMETA_VERSION "1.1.0")
  7set(FLVMETA_RELEASE yes)
  8
  9# check whether we are building a release or a git snapshot
 10if(NOT FLVMETA_RELEASE)
 11  # check for git
 12  find_program(GIT "git")
 13  mark_as_advanced(GIT)
 14  # check whether we are in a git repository
 15  find_file(DOT_GIT ".git" ${CMAKE_SOURCE_DIR})
 16  mark_as_advanced(DOT_GIT)
 17  if(GIT AND DOT_GIT)
 18    # retrieve current revision
 19    execute_process(
 20      COMMAND "${GIT}" rev-parse --short HEAD
 21      WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
 22      OUTPUT_VARIABLE   GIT_RELEASE
 23      OUTPUT_STRIP_TRAILING_WHITESPACE
 24    )
 25    set(FLVMETA_VERSION "${FLVMETA_VERSION}-g${GIT_RELEASE}")
 26  endif(GIT AND DOT_GIT)
 27endif(NOT FLVMETA_RELEASE)
 28
 29# generic variables
 30set(PACKAGE           "flvmeta")
 31set(PACKAGE_NAME      ${PACKAGE})
 32set(PACKAGE_BUGREPORT "flvmeta-discussion@googlegroups.com")
 33set(PACKAGE_VERSION   "${FLVMETA_VERSION}")
 34set(PACKAGE_STRING    "${PACKAGE_NAME} ${PACKAGE_VERSION}")
 35
 36# build options
 37set(
 38  FLVMETA_USE_SYSTEM_LIBYAML FALSE
 39  CACHE BOOL "Link flvmeta to the installed version of libyaml"
 40)
 41
 42#platform tests
 43include(CheckFunctionExists)
 44include(CheckIncludeFile)
 45include(CheckTypeSize)
 46include(TestBigEndian)
 47
 48check_include_file(sys/types.h  HAVE_SYS_TYPES_H)
 49check_include_file(stdint.h     HAVE_STDINT_H)
 50check_include_file(stddef.h     HAVE_STDDEF_H)
 51check_include_file(inttypes.h   HAVE_INTTYPES_H)
 52
 53check_type_size("double"      SIZEOF_DOUBLE)
 54check_type_size("float"       SIZEOF_FLOAT)
 55check_type_size("long double" SIZEOF_LONG_DOUBLE)
 56
 57if(WIN32)
 58  add_definitions(-D_FILE_OFFSET_BITS=64)
 59endif(WIN32)
 60
 61# MSVC before VS 2010 did not have stdint.h
 62if(MSVC AND NOT HAVE_STDINT_H)
 63  set(int16_t  1)
 64  set(int32_t  1)
 65  set(int64_t  1)
 66  set(int8_t   1)
 67  set(uint16_t 1)
 68  set(uint32_t 1)
 69  set(uint64_t 1)
 70  set(uint8_t  1)
 71endif(MSVC AND NOT HAVE_STDINT_H)
 72
 73test_big_endian(IS_BIGENDIAN)
 74if(IS_BIGENDIAN)
 75  set(WORDS_BIGENDIAN 1)
 76endif(IS_BIGENDIAN)
 77
 78# large file support
 79check_function_exists("fseeko" HAVE_FSEEKO)
 80if(HAVE_FSEEKO)
 81  execute_process(
 82    COMMAND getconf LFS_CFLAGS
 83    OUTPUT_VARIABLE LFS_CFLAGS
 84    ERROR_QUIET
 85  )
 86  if(LFS_CFLAGS)
 87    add_definitions(${LFS_CFLAGS})
 88  endif(LFS_CFLAGS)
 89endif(HAVE_FSEEKO)
 90
 91# configuration file
 92configure_file(config-cmake.h.in ${CMAKE_BINARY_DIR}/config.h)
 93include_directories(${CMAKE_BINARY_DIR})
 94add_definitions(-DHAVE_CONFIG_H)
 95
 96# Visual C++ specific configuration
 97if(MSVC)
 98  # use static library
 99  set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /MT")
100  
101  # C runtime deprecation in Visual C++ 2005 and later
102  add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE)
103endif(MSVC)
104
105# installation
106set(CPACK_PACKAGE_VENDOR "Marc Noirot <marc.noirot@gmail.com>")
107set(CPACK_PACKAGE_VERSION ${FLVMETA_VERSION})
108set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/COPYING)
109set(CPACK_RESOURCE_FILE_README ${CMAKE_SOURCE_DIR}/README)
110set(CPACK_SOURCE_IGNORE_FILES "/*build*;/CVS/;/\\\\.svn/;/\\\\.bzr/;/\\\\.hg/;/\\\\.git/;\\\\.swp$;\\\\.#;/#")
111set(CPACK_SOURCE_PACKAGE_FILE_NAME "flvmeta-${PACKAGE_VERSION}-src")
112
113if(WIN32)
114  if (CMAKE_CL_64)
115    set(EXECUTABLE_TYPE "64")
116  else(CMAKE_CL_64)
117    set(EXECUTABLE_TYPE "32")
118  endif(CMAKE_CL_64)
119
120  set(CPACK_PACKAGE_FILE_NAME "flvmeta-${PACKAGE_VERSION}-win${EXECUTABLE_TYPE}")
121  set(CPACK_GENERATOR ZIP)
122  install(FILES ${CMAKE_SOURCE_DIR}/README  DESTINATION . RENAME Readme.txt)
123  install(FILES ${CMAKE_SOURCE_DIR}/COPYING DESTINATION . RENAME License.txt)
124  install(FILES ${CMAKE_SOURCE_DIR}/NEWS    DESTINATION . RENAME Changelog.txt)
125else(WIN32)
126  set(CPACK_PACKAGE_FILE_NAME "flvmeta-${PACKAGE_VERSION}")
127endif(WIN32)
128
129include(CPack)
130
131add_subdirectory(src)
132add_subdirectory(man)
133
134# tests
135#enable_testing()
136#add_subdirectory(tests)