Reorganize CMake sections.

This commit is contained in:
Romuald Conty 2010-04-26 12:59:23 +00:00
parent 194faf56fb
commit 27ccf67503

View file

@ -10,13 +10,17 @@ SET(PACKAGE_NAME "libnfc")
SET(PACKAGE_VERSION ${VERSION}) SET(PACKAGE_VERSION ${VERSION})
SET(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") SET(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
# config.h
IF(NOT MSVC) IF(NOT MSVC)
SET(_XOPEN_SOURCE 600) SET(_XOPEN_SOURCE 600)
ENDIF(NOT MSVC) ENDIF(NOT MSVC)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_SOURCE_DIR}/config.h) CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_SOURCE_DIR}/config.h)
ADD_DEFINITIONS("-DHAVE_CONFIG_H")
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/include) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/include)
# Win32
IF(MSVC) IF(MSVC)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/win32 ${CMAKE_CURRENT_SOURCE_DIR}/win32/stdint) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/win32 ${CMAKE_CURRENT_SOURCE_DIR}/win32/stdint)
ENDIF(MSVC) ENDIF(MSVC)
@ -24,15 +28,17 @@ ENDIF(MSVC)
# make it easy to locate CMake modules for finding libraries # make it easy to locate CMake modules for finding libraries
SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules/") SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules/")
# Options
SET(LIBNFC_DEBUG_OUTPUT OFF CACHE BOOL "Debug output of communication with the NFC chip")
IF(LIBNFC_DEBUG_OUTPUT)
ADD_DEFINITIONS(-DDEBUG -g3)
ENDIF(LIBNFC_DEBUG_OUTPUT)
# Doxygen # Doxygen
SET(builddir "${CMAKE_BINARY_DIR}") SET(builddir "${CMAKE_BINARY_DIR}")
SET(top_srcdir "${CMAKE_SOURCE_DIR}") SET(top_srcdir "${CMAKE_SOURCE_DIR}")
INCLUDE(UseDoxygen) INCLUDE(UseDoxygen)
SET(LIBNFC_DEBUG_OUTPUT OFF CACHE BOOL "Debug output of communication with the NFC chip")
SET(LIBNFC_SERIAL_AUTOPROBE_ENABLED OFF CACHE BOOL "Allow serial ports to be probed (can seriously disturb connected serial devices)")
INCLUDE(LibnfcDrivers)
IF(DEFINED CMAKE_INSTALL_LIBDIR) IF(DEFINED CMAKE_INSTALL_LIBDIR)
SET(libdir ${CMAKE_INSTALL_LIBDIR}) SET(libdir ${CMAKE_INSTALL_LIBDIR})
ELSE(DEFINED CMAKE_INSTALL_LIBDIR) ELSE(DEFINED CMAKE_INSTALL_LIBDIR)
@ -51,17 +57,7 @@ IF(NOT DEFINED SHARE_INSTALL_PREFIX)
SET(SHARE_INSTALL_PREFIX share) SET(SHARE_INSTALL_PREFIX share)
ENDIF(NOT DEFINED SHARE_INSTALL_PREFIX) ENDIF(NOT DEFINED SHARE_INSTALL_PREFIX)
IF(LIBNFC_SERIAL_AUTOPROBE_ENABLED) # Additonnal GCC flags
ADD_DEFINITIONS("-DSERIAL_AUTOPROBE_ENABLED")
ENDIF(LIBNFC_SERIAL_AUTOPROBE_ENABLED)
IF(LIBNFC_DEBUG_OUTPUT)
ADD_DEFINITIONS(-DDEBUG -g3)
ENDIF(LIBNFC_DEBUG_OUTPUT)
# CMake have config.h generation, so we must define this
ADD_DEFINITIONS("-DHAVE_CONFIG_H")
IF(CMAKE_COMPILER_IS_GNU_CC) IF(CMAKE_COMPILER_IS_GNU_CC)
# Make sure we will not miss some warnings ;) # Make sure we will not miss some warnings ;)
ADD_DEFINITIONS(-Wall -pedantic -std=c99) ADD_DEFINITIONS(-Wall -pedantic -std=c99)