dota17 | e9ccbe0 | 2019-09-18 04:30:00 +0800 | [diff] [blame] | 1 | #vim: et ts =4 sts = 4 sw = 4 tw = 0 |
dota17 | e9ccbe0 | 2019-09-18 04:30:00 +0800 | [diff] [blame] | 2 | set(EXAMPLES |
Claus Klein | a6fe8e2 | 2020-02-13 22:20:46 +0100 | [diff] [blame] | 3 | readFromString |
| 4 | readFromStream |
| 5 | stringWrite |
| 6 | streamWrite |
| 7 | ) |
dota17 | e9ccbe0 | 2019-09-18 04:30:00 +0800 | [diff] [blame] | 8 | add_definitions(-D_GLIBCXX_USE_CXX11_ABI) |
dota17 | e9ccbe0 | 2019-09-18 04:30:00 +0800 | [diff] [blame] | 9 | |
Joel Johnson | 8a5e792 | 2019-12-31 20:38:39 -0700 | [diff] [blame] | 10 | if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang") |
Joel Johnson | 524234e | 2020-01-20 13:21:14 -0700 | [diff] [blame] | 11 | add_compile_options(-Wall -Wextra) |
Joel Johnson | 8a5e792 | 2019-12-31 20:38:39 -0700 | [diff] [blame] | 12 | elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") |
Claus Klein | a6fe8e2 | 2020-02-13 22:20:46 +0100 | [diff] [blame] | 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 | ) |
dota17 | e9ccbe0 | 2019-09-18 04:30:00 +0800 | [diff] [blame] | 19 | endif() |
| 20 | |
Claus Klein | a6fe8e2 | 2020-02-13 22:20:46 +0100 | [diff] [blame] | 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) |
dota17 | e9ccbe0 | 2019-09-18 04:30:00 +0800 | [diff] [blame] | 25 | endforeach() |
| 26 | |
| 27 | add_custom_target(examples ALL DEPENDS ${EXAMPLES}) |