2019-09-18 04:30:00 +08:00
|
|
|
#vim: et ts =4 sts = 4 sw = 4 tw = 0
|
|
|
|
set(EXAMPLES
|
2020-02-13 22:20:46 +01:00
|
|
|
readFromString
|
|
|
|
readFromStream
|
|
|
|
stringWrite
|
|
|
|
streamWrite
|
|
|
|
)
|
2019-09-18 04:30:00 +08:00
|
|
|
add_definitions(-D_GLIBCXX_USE_CXX11_ABI)
|
|
|
|
|
2019-12-31 20:38:39 -07:00
|
|
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
2020-01-20 13:21:14 -07:00
|
|
|
add_compile_options(-Wall -Wextra)
|
2019-12-31 20:38:39 -07:00
|
|
|
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
2020-02-13 22:20:46 +01:00
|
|
|
add_definitions(
|
|
|
|
-D_SCL_SECURE_NO_WARNINGS
|
|
|
|
-D_CRT_SECURE_NO_WARNINGS
|
|
|
|
-D_WIN32_WINNT=0x601
|
|
|
|
-D_WINSOCK_DEPRECATED_NO_WARNINGS
|
|
|
|
)
|
2019-09-18 04:30:00 +08:00
|
|
|
endif()
|
|
|
|
|
2020-02-13 22:20:46 +01:00
|
|
|
foreach(example ${EXAMPLES})
|
|
|
|
add_executable(${example} ${example}/${example}.cpp)
|
|
|
|
target_include_directories(${example} PUBLIC ${CMAKE_SOURCE_DIR}/include)
|
|
|
|
target_link_libraries(${example} jsoncpp_lib)
|
2019-09-18 04:30:00 +08:00
|
|
|
endforeach()
|
|
|
|
|
|
|
|
add_custom_target(examples ALL DEPENDS ${EXAMPLES})
|