cmake_minimum_required(VERSION 2.8) set(EXAMPLES capitalize condense jsonx messagereader parsebyparts pretty prettyauto schemavalidator serialize simpledom simplereader simplewriter tutorial) include_directories("../include/") add_definitions(-D__STDC_FORMAT_MACROS) if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -Werror -Wall -Wextra -Weffc++ -Wswitch-default") elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wall -Wextra -Weffc++ -Wswitch-default -Wfloat-equal -Wimplicit-fallthrough -Weverything") set(CMAKE_LINK_FLAGS "${CMAKE_LINK_FLAGS} -lpthread") elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") add_definitions(-D_CRT_SECURE_NO_WARNINGS=1) endif() foreach (example ${EXAMPLES}) add_executable(${example} ${example}/${example}.cpp) endforeach() add_custom_target(examples ALL DEPENDS ${EXAMPLES})