CMakeLists.txt 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. # Copyright (c) 2011 Milo Yip (miloyip@gmail.com)
  2. # Copyright (c) 2013 Rafal Jeczalik (rjeczalik@gmail.com)
  3. # Distributed under the MIT License (see license.txt file)
  4. cmake_minimum_required(VERSION 2.8)
  5. set(EXAMPLES
  6. capitalize
  7. condense
  8. jsonx
  9. messagereader
  10. pretty
  11. prettyauto
  12. schemavalidator
  13. serialize
  14. simpledom
  15. simplereader
  16. simplewriter
  17. tutorial)
  18. include_directories("../include/")
  19. add_definitions(-D__STDC_FORMAT_MACROS)
  20. if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
  21. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wall -Wextra -Weffc++ -Wswitch-default")
  22. elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  23. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wall -Wextra -Weffc++ -Wswitch-default -Wfloat-equal -Wimplicit-fallthrough -Weverything")
  24. elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
  25. add_definitions(-D_CRT_SECURE_NO_WARNINGS=1)
  26. endif()
  27. foreach (example ${EXAMPLES})
  28. add_executable(${example} ${example}/${example}.cpp)
  29. endforeach()
  30. add_custom_target(examples ALL DEPENDS ${EXAMPLES})