You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
1.5 KiB

SET(CNAME "json2torrent")
SET(VERSION 0.01)
PROJECT(${CNAME} C)
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
# cmake modules
INCLUDE(CheckIncludeFile)
INCLUDE(CheckLibraryExists)
INCLUDE(CheckFunctionExists)
IF (NOT CMAKE_BUILD_TYPE)
SET (CMAKE_BUILD_TYPE Debug)
SET (CMAKE_C_FLAGS "-ggdb -O0 -Wall -pedantic -DDEBUG")
ENDIF (NOT CMAKE_BUILD_TYPE)
# set paths
SET(CMAKE_INSTALL_PREFIX "/usr")
SET(INSTALL_BIN "${CMAKE_INSTALL_PREFIX}/bin")
SET(INSTALL_LIB "${CMAKE_INSTALL_PREFIX}/lib")
IF (NOT LIBDIR)
SET (LIBDIR "lib")
ENDIF (NOT LIBDIR)
SET(REQUIRED_HEADERS
"ctype.h" "stdbool.h" "stdio.h"
"stdint.h" "stdlib.h" "string.h")
FOREACH (HDR ${REQUIRED_HEADERS})
CHECK_INCLUDE_FILE (${HDR} TEST_H)
IF (NOT TEST_H)
MESSAGE(FATAL_ERROR "Build aborted.")
ENDIF (NOT TEST_H)
UNSET(TEST_H CACHE)
ENDFOREACH()
## checks
# yajl (yet another json library)
FIND_LIBRARY(LIB_YAJL yajl)
IF (LIB_YAJL)
SET (BUILD_LIBS ${BUILD_LIBS} ${LIB_YAJL})
SET (YAJL_FOUND "FOUND")
ELSE (LIB_YAJL)
MESSAGE (SEND_ERROR "yajl not found")
ENDIF (LIB_YAJL)
MESSAGE (STATUS "------------------------------------------")
MESSAGE (STATUS "Build type is: ${CMAKE_BUILD_TYPE}")
MESSAGE (STATUS "")
MESSAGE (STATUS "Install prefix: ${CMAKE_INSTALL_PREFIX}")
MESSAGE (STATUS "Binaries directory: ${INSTALL_BIN}")
MESSAGE (STATUS "")
MESSAGE (STATUS "Required libraries:")
MESSAGE (STATUS " yajl: ${YAJL_FOUND}")
MESSAGE (STATUS "")
MESSAGE (STATUS "------------------------------------------")
ADD_SUBDIRECTORY (src)