CMakeLists.txt 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. cmake_minimum_required(VERSION 3.2)
  2. set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake)
  3. if(NOT DEFINED CMAKE_BUILD_TYPE)
  4. set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type")
  5. endif()
  6. project(zf_log)
  7. set(INSTALL_INCLUDE_DIR include CACHE PATH
  8. "Installation directory for header files")
  9. set(INSTALL_LIB_DIR lib CACHE PATH
  10. "Installation directory for libraries")
  11. set(INSTALL_CMAKE_DIR lib/cmake/zf_log CACHE PATH
  12. "Installation directory for CMake files")
  13. set(ZF_LOG_LIBRARY_PREFIX CACHE STRING
  14. "Prefix for all linker symbols exported by the library")
  15. option(ZF_LOG_CONFIGURE_INSTALL "Generate install target" ON)
  16. option(ZF_LOG_EXAMPLES "Build examples" OFF)
  17. option(ZF_LOG_TESTS "Build tests" OFF)
  18. option(ZF_LOG_PERF_TESTS "Build performance tests (requires Python)" OFF)
  19. option(ZF_LOG_USE_ANDROID_LOG "Use Android log by defaul when available" OFF)
  20. option(ZF_LOG_USE_NSLOG "Use NSLog (Apple System Log) by default when available" OFF)
  21. option(ZF_LOG_USE_DEBUGSTRING "Use OutputDebugString (Windows) by default when available" OFF)
  22. option(ZF_LOG_USE_CONFIG_HEADER "Include zf_log_config.h header file in zf_log compilation untis" OFF)
  23. option(ZF_LOG_OPTIMIZE_SIZE "Optimize for size (prefer size over speed)" OFF)
  24. add_subdirectory(zf_log)
  25. if(ZF_LOG_EXAMPLES)
  26. add_subdirectory(examples)
  27. endif()
  28. if(ZF_LOG_TESTS)
  29. enable_testing()
  30. add_subdirectory(tests)
  31. endif()
  32. if(ZF_LOG_PERF_TESTS)
  33. enable_testing()
  34. add_subdirectory(tests/perf)
  35. endif()
  36. if(ZF_LOG_CONFIGURE_INSTALL)
  37. export(EXPORT zf_log)
  38. install(EXPORT zf_log
  39. DESTINATION ${INSTALL_CMAKE_DIR})
  40. configure_file(zf_log-config.cmake.in zf_log-config.cmake @ONLY)
  41. install(FILES ${CMAKE_CURRENT_BINARY_DIR}/zf_log-config.cmake
  42. DESTINATION ${INSTALL_CMAKE_DIR})
  43. endif()