CMakeLists.txt 839 B

12345678910111213141516171819202122232425262728293031
  1. #vim: et ts =4 sts = 4 sw = 4 tw = 0
  2. cmake_minimum_required(VERSION 3.1)
  3. set(EXAMPLES
  4. readFromString
  5. readFromStream
  6. stringWrite
  7. streamWrite
  8. )
  9. add_definitions(-D_GLIBCXX_USE_CXX11_ABI)
  10. set_property(DIRECTORY PROPERTY COMPILE_OPTIONS ${EXTRA_CXX_FLAGS})
  11. if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
  12. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra ")
  13. else()
  14. add_definitions(
  15. -D_SCL_SECURE_NO_WARNINGS
  16. -D_CRT_SECURE_NO_WARNINGS
  17. -D_WIN32_WINNT=0x601
  18. -D_WINSOCK_DEPRECATED_NO_WARNINGS
  19. )
  20. endif()
  21. foreach(example ${EXAMPLES})
  22. add_executable(${example} ${example}/${example}.cpp)
  23. target_include_directories(${example} PUBLIC ${CMAKE_SOURCE_DIR}/include)
  24. target_link_libraries(${example} jsoncpp_lib)
  25. endforeach()
  26. add_custom_target(examples ALL DEPENDS ${EXAMPLES})