CMakeLists.txt 930 B

123456789101112131415161718192021222324252627282930313233343536
  1. cmake_minimum_required(VERSION 2.8)
  2. set(EXAMPLES
  3. capitalize
  4. condense
  5. jsonx
  6. messagereader
  7. parsebyparts
  8. pretty
  9. prettyauto
  10. schemavalidator
  11. serialize
  12. simpledom
  13. simplereader
  14. simplewriter
  15. tutorial)
  16. include_directories("../include/")
  17. add_definitions(-D__STDC_FORMAT_MACROS)
  18. if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
  19. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -Werror -Wall -Wextra -Weffc++ -Wswitch-default")
  20. elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  21. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wall -Wextra -Weffc++ -Wswitch-default -Wfloat-equal -Wimplicit-fallthrough -Weverything")
  22. endif()
  23. foreach (example ${EXAMPLES})
  24. add_executable(${example} ${example}/${example}.cpp)
  25. endforeach()
  26. if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  27. target_link_libraries(parsebyparts pthread)
  28. endif()
  29. add_custom_target(examples ALL DEPENDS ${EXAMPLES})