dota17 | e9ccbe0 | 2019-09-18 04:30:00 +0800 | [diff] [blame] | 1 | #vim: et ts =4 sts = 4 sw = 4 tw = 0 |
| 2 | cmake_minimum_required(VERSION 3.1) |
| 3 | |
| 4 | set(EXAMPLES |
Claus Klein | a6fe8e2 | 2020-02-13 22:20:46 +0100 | [diff] [blame] | 5 | readFromString |
| 6 | readFromStream |
| 7 | stringWrite |
| 8 | streamWrite |
| 9 | ) |
dota17 | e9ccbe0 | 2019-09-18 04:30:00 +0800 | [diff] [blame] | 10 | add_definitions(-D_GLIBCXX_USE_CXX11_ABI) |
| 11 | set_property(DIRECTORY PROPERTY COMPILE_OPTIONS ${EXTRA_CXX_FLAGS}) |
| 12 | |
| 13 | if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") |
Claus Klein | a6fe8e2 | 2020-02-13 22:20:46 +0100 | [diff] [blame] | 14 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra ") |
| 15 | else() |
| 16 | add_definitions( |
| 17 | -D_SCL_SECURE_NO_WARNINGS |
| 18 | -D_CRT_SECURE_NO_WARNINGS |
| 19 | -D_WIN32_WINNT=0x601 |
| 20 | -D_WINSOCK_DEPRECATED_NO_WARNINGS |
| 21 | ) |
dota17 | e9ccbe0 | 2019-09-18 04:30:00 +0800 | [diff] [blame] | 22 | endif() |
| 23 | |
Claus Klein | a6fe8e2 | 2020-02-13 22:20:46 +0100 | [diff] [blame] | 24 | foreach(example ${EXAMPLES}) |
| 25 | add_executable(${example} ${example}/${example}.cpp) |
| 26 | target_include_directories(${example} PUBLIC ${CMAKE_SOURCE_DIR}/include) |
| 27 | target_link_libraries(${example} jsoncpp_lib) |
dota17 | e9ccbe0 | 2019-09-18 04:30:00 +0800 | [diff] [blame] | 28 | endforeach() |
| 29 | |
| 30 | add_custom_target(examples ALL DEPENDS ${EXAMPLES}) |