1#vim: et ts =4 sts = 4 sw = 4 tw = 0 2set(EXAMPLES 3 readFromString 4 readFromStream 5 stringWrite 6 streamWrite 7) 8add_definitions(-D_GLIBCXX_USE_CXX11_ABI) 9 10if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang") 11 add_compile_options(-Wall -Wextra) 12elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") 13 add_definitions( 14 -D_SCL_SECURE_NO_WARNINGS 15 -D_CRT_SECURE_NO_WARNINGS 16 -D_WIN32_WINNT=0x601 17 -D_WINSOCK_DEPRECATED_NO_WARNINGS 18 ) 19endif() 20 21foreach(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) 25endforeach() 26 27add_custom_target(examples ALL DEPENDS ${EXAMPLES}) 28