CMakeLists.txt 1.31 KB
Newer Older
1
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.6)
2 3 4
INCLUDE(CheckIncludeFiles)
INCLUDE(TestBigEndian)
INCLUDE(CheckCSourceCompiles)
5
INCLUDE(cmake/macros.cmake)
6 7 8 9 10 11 12 13 14
PROJECT(libaec)
SET(libaec_VERSION_MAJOR 0)
SET(libaec_VERSION_MINOR 2)
SET(CMAKE_BUILD_TYPE Release)
ENABLE_TESTING()

CHECK_INCLUDE_FILES(malloc.h HAVE_MALLOC_H)
CHECK_INCLUDE_FILES(stdint.h HAVE_STDINT_H)
TEST_BIG_ENDIAN(WORDS_BIGENDIAN)
15 16 17 18 19 20
CHECK_CLZLL(HAVE_DECL___BUILTIN_CLZLL)
IF(NOT HAVE_DECL___BUILTIN_CLZLL)
  CHECK_BSR64(HAVE_BSR64)
ENDIF(NOT HAVE_DECL___BUILTIN_CLZLL)
FIND_INLINE_KEYWORD()
FIND_RESTRICT_KEYWORD()
21 22

CONFIGURE_FILE(
23
  ${CMAKE_CURRENT_SOURCE_DIR}/cmake/config.h.in
Mathis Rosenhauer's avatar
Mathis Rosenhauer committed
24 25
  ${CMAKE_CURRENT_BINARY_DIR}/config.h
  )
Mathis Rosenhauer's avatar
Mathis Rosenhauer committed
26 27 28 29 30 31 32 33
ADD_DEFINITIONS("-DHAVE_CONFIG_H")

# Allow the developer to select if Dynamic or Static libraries are built
OPTION (BUILD_SHARED_LIBS "Build Shared Libraries" OFF)
IF (BUILD_SHARED_LIBS)
  # User wants to build Dynamic Libraries,
  # so change the LIB_TYPE variable to CMake keyword 'SHARED'
  SET (LIB_TYPE SHARED)
34 35
ELSE(BUILD_SHARED_LIBS)
  SET (LIB_TYPE STATIC)
Mathis Rosenhauer's avatar
Mathis Rosenhauer committed
36
ENDIF (BUILD_SHARED_LIBS)
Mathis Rosenhauer's avatar
Mathis Rosenhauer committed
37

38
INCLUDE_DIRECTORIES("${PROJECT_BINARY_DIR}")
Mathis Rosenhauer's avatar
Mathis Rosenhauer committed
39
INCLUDE_DIRECTORIES("${PROJECT_BINARY_DIR}/src")
40 41
INCLUDE_DIRECTORIES("${PROJECT_SOURCE_DIR}/src")

42
ADD_SUBDIRECTORY(src)
43 44 45 46 47
IF(WIN32)
  ADD_SUBDIRECTORY(tests)
ELSE(WIN32)
  ADD_SUBDIRECTORY(tests EXCLUDE_FROM_ALL)
ENDIF(WIN32)