blob: 230d1bd7bb177a6e6fd4cc3cf5e1e8b4a74c677e [file] [log] [blame]
dota17e9ccbe02019-09-18 04:30:00 +08001#vim: et ts =4 sts = 4 sw = 4 tw = 0
dota17e9ccbe02019-09-18 04:30:00 +08002set(EXAMPLES
Claus Kleina6fe8e22020-02-13 22:20:46 +01003 readFromString
4 readFromStream
5 stringWrite
6 streamWrite
7)
dota17e9ccbe02019-09-18 04:30:00 +08008add_definitions(-D_GLIBCXX_USE_CXX11_ABI)
dota17e9ccbe02019-09-18 04:30:00 +08009
Joel Johnson8a5e7922019-12-31 20:38:39 -070010if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
Joel Johnson524234e2020-01-20 13:21:14 -070011 add_compile_options(-Wall -Wextra)
Joel Johnson8a5e7922019-12-31 20:38:39 -070012elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
Claus Kleina6fe8e22020-02-13 22:20:46 +010013 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 )
dota17e9ccbe02019-09-18 04:30:00 +080019endif()
20
Claus Kleina6fe8e22020-02-13 22:20:46 +010021foreach(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)
dota17e9ccbe02019-09-18 04:30:00 +080025endforeach()
26
27add_custom_target(examples ALL DEPENDS ${EXAMPLES})