CMakeLists.txt 891 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. cmake_minimum_required(VERSION 2.8)
  2. if(POLICY CMP0054)
  3. cmake_policy(SET CMP0054 NEW)
  4. endif()
  5. set(EXAMPLES
  6. capitalize
  7. condense
  8. filterkey
  9. filterkeydom
  10. jsonx
  11. lookaheadparser
  12. messagereader
  13. parsebyparts
  14. pretty
  15. prettyauto
  16. schemavalidator
  17. serialize
  18. simpledom
  19. simplereader
  20. simplepullreader
  21. simplewriter
  22. tutorial)
  23. include_directories("../include/")
  24. add_definitions(-D__STDC_FORMAT_MACROS)
  25. set_property(DIRECTORY PROPERTY COMPILE_OPTIONS ${EXTRA_CXX_FLAGS})
  26. if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
  27. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
  28. endif()
  29. foreach (example ${EXAMPLES})
  30. add_executable(${example} ${example}/${example}.cpp)
  31. endforeach()
  32. if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  33. target_link_libraries(parsebyparts pthread)
  34. endif()
  35. add_custom_target(examples ALL DEPENDS ${EXAMPLES})