2015-08-10 18:11:25 +08:00
|
|
|
cmake_minimum_required(VERSION 2.8)
|
2014-11-04 00:36:24 +02:00
|
|
|
|
|
|
|
set(EXAMPLES
|
|
|
|
capitalize
|
|
|
|
condense
|
2016-02-09 00:09:39 +08:00
|
|
|
jsonx
|
2014-11-04 00:36:24 +02:00
|
|
|
messagereader
|
2016-02-21 17:23:23 +08:00
|
|
|
parsebyparts
|
2014-11-04 00:36:24 +02:00
|
|
|
pretty
|
|
|
|
prettyauto
|
2016-01-29 15:24:23 +08:00
|
|
|
schemavalidator
|
2014-11-04 00:36:24 +02:00
|
|
|
serialize
|
|
|
|
simpledom
|
|
|
|
simplereader
|
|
|
|
simplewriter
|
|
|
|
tutorial)
|
2015-08-10 18:11:25 +08:00
|
|
|
|
|
|
|
include_directories("../include/")
|
2014-11-04 00:36:24 +02:00
|
|
|
|
2016-02-09 00:53:49 +08:00
|
|
|
add_definitions(-D__STDC_FORMAT_MACROS)
|
|
|
|
|
2015-02-11 14:10:09 +02:00
|
|
|
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
2016-02-27 19:57:30 +01:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -Werror -Wall -Wextra -Weffc++ -Wswitch-default")
|
2015-02-11 14:10:09 +02:00
|
|
|
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
2016-03-04 14:09:56 +08:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wall -Wextra -Weffc++ -Wswitch-default -Wfloat-equal -Wimplicit-fallthrough -Weverything")
|
2015-02-11 14:10:09 +02:00
|
|
|
endif()
|
|
|
|
|
2014-11-04 00:36:24 +02:00
|
|
|
foreach (example ${EXAMPLES})
|
2014-11-11 17:16:51 +02:00
|
|
|
add_executable(${example} ${example}/${example}.cpp)
|
2014-11-04 00:36:24 +02:00
|
|
|
endforeach()
|
2014-11-11 17:50:32 +02:00
|
|
|
|
2016-03-04 16:37:04 +08:00
|
|
|
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
|
|
|
target_link_libraries(parsebyparts pthread)
|
|
|
|
endif()
|
|
|
|
|
2014-11-11 17:50:32 +02:00
|
|
|
add_custom_target(examples ALL DEPENDS ${EXAMPLES})
|