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.

83 lines
2.2 KiB

  1. project (log4cplus)
  2. cmake_minimum_required (VERSION 2.8.0)
  3. set (log4cplus_version_major 1)
  4. set (log4cplus_version_minor 1)
  5. set (log4cplus_version_patch 0)
  6. set (log4cplus_soversion 0)
  7. set (log4cplus_postfix "")
  8. if(CMAKE_COMPILER_IS_GNUCC)
  9. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
  10. else(CLANG)
  11. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -stdlib=libc++")
  12. endif()
  13. option(LOG4CPLUS_BUILD_TESTING "Build the test suite." ON)
  14. find_package (Threads)
  15. message (STATUS "Threads: ${CMAKE_THREAD_LIBS_INIT}")
  16. set(BUILD_SHARED_LIBS FALSE CACHE BOOL "If TRUE, log4cplus is built as a shared library, otherwise as a static library")
  17. if (WIN32)
  18. set (UNICODE_DEFAULT ON)
  19. else (WIN32)
  20. set (UNICODE_DEFAULT OFF)
  21. endif (WIN32)
  22. if (MSVC)
  23. set (LOG4CPLUS_WORKING_LOCALE_DEFAULT ON)
  24. else (MSVC)
  25. set (LOG4CPLUS_WORKING_LOCALE_DEFAULT OFF)
  26. endif (MSVC)
  27. option(LOG4CPLUS_WORKING_LOCALE "Define for compilers/standard libraries that support more than just the C locale."
  28. ${LOG4CPLUS_WORKING_LOCALE_DEFAULT})
  29. option(LOG4CPLUS_WORKING_C_LOCALE
  30. "Define for compilers/standard libraries that have working C locale."
  31. OFF)
  32. option (LOG4CPLUS_QT4 "Build with Qt4DebugAppender" OFF)
  33. option(UNICODE "Build with tchar = wchar_t" ${UNICODE_DEFAULT})
  34. option(WITH_ICONV "Use iconv() for char->wchar_t conversion."
  35. OFF)
  36. if (UNICODE)
  37. set (log4cplus_postfix "${log4cplus_postfix}U")
  38. endif (UNICODE)
  39. if (WITH_ICONV)
  40. set(LOG4CPLUS_WITH_ICONV 1)
  41. endif ()
  42. set (log4cplus "log4cplus${log4cplus_postfix}")
  43. include(ConfigureChecks.cmake)
  44. configure_file(include/log4cplus/config.h.cmake.in
  45. ${log4cplus_BINARY_DIR}/include/log4cplus/config.h @ONLY)
  46. configure_file(include/log4cplus/config/defines.hxx.cmake.in
  47. ${log4cplus_BINARY_DIR}/include/log4cplus/config/defines.hxx @ONLY)
  48. include_directories (${log4cplus_SOURCE_DIR}/include
  49. ${log4cplus_BINARY_DIR}/include
  50. )
  51. if (LOG4CPLUS_BUILD_TESTING)
  52. enable_testing()
  53. endif (LOG4CPLUS_BUILD_TESTING)
  54. add_subdirectory (src)
  55. add_subdirectory (loggingserver)
  56. if (LOG4CPLUS_BUILD_TESTING)
  57. add_subdirectory (tests)
  58. endif (LOG4CPLUS_BUILD_TESTING)
  59. if (LOG4CPLUS_QT4)
  60. add_subdirectory (qt4debugappender)
  61. endif (LOG4CPLUS_QT4)
  62. include(Log4CPlusCPack.cmake)