123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196 |
- CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
- PROJECT(PARADEVS CXX C)
- ENABLE_TESTING()
- SET(PARADEVS_MAJOR 1)
- SET(PARADEVS_MINOR 0)
- SET(PARADEVS_PATCH 0)
- SET(PARADEVS_EXTRA "")
- SET(PARADEVS_VERSION "${PARADEVS_MAJOR}.${PARADEVS_MINOR}.${PARADEVS_PATCH}")
- SET(PARADEVS_VERSION_SHORT "${PARADEVS_MAJOR}.${PARADEVS_MINOR}")
- SET(PARADEVS_NAME "paradevs")
- SET(PARADEVS_NAME_VERSION "${PARADEVS_NAME}-${PARADEVS_VERSION}")
- SET(PARADEVS_LOCALE_NAME "${PARADEVS_NAME}-${PARADEVS_MAJOR}-${PARADEVS_MINOR}")
- IF ("${PARADEVS_EXTRA}" STREQUAL "")
- SET(PARADEVS_COMPLETE "${PARADEVS_MAJOR}.${PARADEVS_MINOR}.${PARADEVS_PATCH}")
- ELSE ("${PARADEVS_EXTRA}" STREQUAL "")
- SET(PARADEVS_COMPLETE "${PARADEVS_MAJOR}.${PARADEVS_MINOR}.${PARADEVS_PATCH}-${PARADEVS_EXTRA}")
- ENDIF ("${PARADEVS_EXTRA}" STREQUAL "")
- SET(PARADEVS_NAME_COMPLETE "${PARADEVS_NAME}-${PARADEVS_COMPLETE}")
- #
- # Installation variables
- #
- SET(PARADEVS_LIBRARY_DIRS "lib/vle-${PARADEVS_VERSION_SHORT}")
- SET(PARADEVS_INCLUDE_DIRS "include/vle-${PARADEVS_VERSION_SHORT}/vle")
- SET(PARADEVS_INCLUDE_DIR "include/vle-${PARADEVS_VERSION_SHORT}")
- SET(PARADEVS_MANPAGE_PATH "share/man/man1")
- SET(PARADEVS_SHARE_DIRS "share/vle-${PARADEVS_VERSION_SHORT}")
- #
- # Append the library version information to the library target
- # properties.
- #
- SET (PARADEVS_LIBRARY_PROPERTIES VERSION 0)
- SET (PARADEVS_APP_PROPERTIES SOVERSION "${PARADEVS_MAJOR}.${PARADEVS_MINOR}"
- VERSION "${PARADEVS_MAJOR}.${PARADEVS_MINOR}")
- #
- # CPack configuration
- #
- INCLUDE(CMakeCPack.cmake)
- #
- # Debug mode
- #
- IF (CMAKE_COMPILER_IS_GNUCC AND CMAKE_COMPILER_IS_GNUCXX)
- SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra")
- SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
- IF (UNIX)
- SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic")
- SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic")
- ENDIF (UNIX)
- ENDIF (CMAKE_COMPILER_IS_GNUCC AND CMAKE_COMPILER_IS_GNUCXX)
- if (CMAKE_BUILD_TYPE STREQUAL "")
- SET(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Choose the type of build" FORCE)
- endif ()
- #
- # Modules
- #
- INCLUDE(CheckIncludeFileCXX)
- INCLUDE(CheckIncludeFile)
- INCLUDE(CheckLibraryExists)
- INCLUDE(CMakeDetermineCCompiler)
- #
- # Check libraries with pkgconfig
- #
- FIND_PACKAGE(PkgConfig REQUIRED)
- # FIXME use old-style link directories for now
- IF (COMMAND CMAKE_POLICY)
- CMAKE_POLICY(SET CMP0003 OLD)
- ENDIF (COMMAND CMAKE_POLICY)
- PKG_CHECK_MODULES(GLIBMM REQUIRED glibmm-2.4)
- PKG_CHECK_MODULES(LIBXML REQUIRED libxml-2.0)
- #
- # Test the libboost header and libboost-text library.
- #
- OPTION(WITH_TEST "use the libboost test unit library [default: on]" ON)
- SET(Boost_USE_MULTITHREADED ON)
- SET(Boost_USE_STATIC_LIBS OFF)
- SET(Boost_NO_SYSTEM_PATHS OFF)
- SET(Boost_USE_STATIC_RUNTIME ON)
- IF (WIN32)
- SET(Boost_THREADAPI "win32")
- ENDIF (WIN32)
- SET(Boost_DETAILED_FAILURE_MSG FALSE)
- SET(Boost_DEBUG FALSE)
- FIND_PACKAGE(Boost COMPONENTS unit_test_framework serialization filesystem
- system date_time regex thread)
- IF (NOT Boost_SERIALIZATION_FOUND)
- MESSAGE(FATAL_ERROR "The boost serialization library is required")
- ENDIF (NOT Boost_SERIALIZATION_FOUND)
- IF (NOT Boost_FILESYSTEM_FOUND)
- MESSAGE(FATAL_ERROR "The boost filesystem library is required")
- ENDIF (NOT Boost_FILESYSTEM_FOUND)
- IF (NOT Boost_REGEX_FOUND)
- MESSAGE(FATAL_ERROR "The boost regex library is required")
- ENDIF (NOT Boost_REGEX_FOUND)
- IF (NOT Boost_DATE_TIME_FOUND)
- MESSAGE(FATAL_ERROR "The boost date_time library is required")
- ENDIF (NOT Boost_DATE_TIME_FOUND)
- IF (NOT Boost_THREAD_FOUND)
- MESSAGE(FATAL_ERROR "The boost thread library is required")
- ENDIF (NOT Boost_THREAD_FOUND)
- IF (Boost_MINOR_VERSION AND ${Boost_MINOR_VERSION} LESS "35")
- SET(Boost_SYSTEM_LIBRARY "")
- ENDIF (Boost_MINOR_VERSION AND ${Boost_MINOR_VERSION} LESS "35")
- IF (Boost_MINOR_VERSION AND ${Boost_MINOR_VERSION} LESS "41")
- SET(PARADEVS_HAVE_BOOST_SPIRIT2 0 CACHE INTERNAL "" FORCE)
- ELSE (Boost_MINOR_VERSION AND ${Boost_MINOR_VERSION} LESS "41")
- SET(PARADEVS_HAVE_BOOST_SPIRIT2 1 CACHE INTERNAL "" FORCE)
- ENDIF (Boost_MINOR_VERSION AND ${Boost_MINOR_VERSION} LESS "41")
- IF (WITH_TEST)
- IF (Boost_UNIT_TEST_FRAMEWORK_FOUND)
- SET(HAVE_UNITTESTFRAMEWORK 1 CACHE INTERNAL "" FORCE)
- ENDIF (Boost_UNIT_TEST_FRAMEWORK_FOUND)
- ENDIF (WITH_TEST)
- #
- # Generate the config.h
- #
- CHECK_INCLUDE_FILE_CXX(cxxabi.h PARADEVS_HAVE_GCC_ABI_DEMANGLE)
- CHECK_INCLUDE_FILE_CXX(execinfo.h PARADEVS_HAVE_EXECINFO)
- CHECK_INCLUDE_FILE_CXX(signal.h PARADEVS_HAVE_SIGNAL)
- INCLUDE_DIRECTORIES(${PARADEVS_BINARY_DIR})
- #
- # Generate the vle.pc pkg-config file.
- # Build some variable to build a correct Win32 pkg config file with:
- # prefix=/target to detect the DIRNAME
- # cflag=-Iboost_1_34_1 for the directory
- #
- SET(PARADEVS_PKGCONFIG_PREFIXPATH "${CMAKE_INSTALL_PREFIX}")
- SET(PARADEVS_PKGCONFIG_BOOSTINCLUDE_DIRS "${Boost_INCLUDE_DIRS}")
- SET(PARADEVS_PKGCONFIG_LIBDIR "lib")
- CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/src/paradevs.pc.in
- ${PARADEVS_BINARY_DIR}/paradevs-${PARADEVS_VERSION_SHORT}.pc @ONLY)
- INSTALL(FILES ${PARADEVS_BINARY_DIR}/paradevs-${PARADEVS_VERSION_SHORT}.pc
- DESTINATION lib/pkgconfig)
- #
- # Install the README
- #
- IF(UNIX)
- INSTALL(FILES "README" DESTINATION "${PARADEVS_SHARE_DIRS}")
- INSTALL(FILES "COPYING" DESTINATION "${PARADEVS_SHARE_DIRS}")
- ELSE(UNIX)
- INSTALL(FILES "README" DESTINATION "${PARADEVS_SHARE_DIRS}" RENAME "Readme.txt")
- INSTALL(FILES "COPYING" DESTINATION "${PARADEVS_SHARE_DIRS}" RENAME "CopyRight.txt")
- ENDIF(UNIX)
- #
- # Browse the src subdirectory
- #
- ADD_SUBDIRECTORY(src)
- #
- # Status
- #
- MESSAGE(STATUS "- - - -")
- MESSAGE(STATUS "${PARADEVS_NAME_COMPLETE} configured successfully")
- MESSAGE(STATUS "Using ${CMAKE_INSTALL_PREFIX} for installation")
- MESSAGE(STATUS "Build type ${CMAKE_BUILD_TYPE}")
- IF (PARADEVS_HAVE_GCC_ABI_DEMANGLE)
- MESSAGE(STATUS "Build with GCC ABI Demangle...: yes")
- ENDIF (PARADEVS_HAVE_GCC_ABI_DEMANGLE)
- IF (PARADEVS_HAVE_EXECINFO)
- MESSAGE(STATUS "Build with execinfo.h.........: yes")
- ENDIF (PARADEVS_HAVE_EXECINFO)
- IF (Boost_FOUND)
- MESSAGE(STATUS "Build with boost..............: yes")
- ENDIF (Boost_FOUND)
- IF (HAVE_UNITTESTFRAMEWORK)
- MESSAGE(STATUS "Build unit test...............: yes")
- ENDIF (HAVE_UNITTESTFRAMEWORK)
- MESSAGE(STATUS "- - - -")
- # vim:tw=0:ts=8:tw=0:sw=2:sts=2
|