CMakeLists.txt (rapidjson-1.0.2) | : | CMakeLists.txt (rapidjson-1.1.0) | ||
---|---|---|---|---|
include(CheckCXXCompilerFlag) | ||||
set(UNITTEST_SOURCES | set(UNITTEST_SOURCES | |||
allocatorstest.cpp | allocatorstest.cpp | |||
bigintegertest.cpp | bigintegertest.cpp | |||
documenttest.cpp | documenttest.cpp | |||
dtoatest.cpp | ||||
encodedstreamtest.cpp | encodedstreamtest.cpp | |||
encodingstest.cpp | encodingstest.cpp | |||
fwdtest.cpp | ||||
filestreamtest.cpp | filestreamtest.cpp | |||
itoatest.cpp | itoatest.cpp | |||
istreamwrappertest.cpp | ||||
jsoncheckertest.cpp | jsoncheckertest.cpp | |||
namespacetest.cpp | namespacetest.cpp | |||
pointertest.cpp | ||||
prettywritertest.cpp | prettywritertest.cpp | |||
ostreamwrappertest.cpp | ||||
readertest.cpp | readertest.cpp | |||
regextest.cpp | ||||
schematest.cpp | ||||
simdtest.cpp | simdtest.cpp | |||
strfunctest.cpp | ||||
stringbuffertest.cpp | stringbuffertest.cpp | |||
strtodtest.cpp | strtodtest.cpp | |||
unittest.cpp | unittest.cpp | |||
valuetest.cpp | valuetest.cpp | |||
writertest.cpp) | writertest.cpp) | |||
find_program(CCACHE_FOUND ccache) | ||||
if(CCACHE_FOUND) | ||||
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache) | ||||
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache) | ||||
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") | ||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qunused-arguments -fcolor-diagn | ||||
ostics") | ||||
endif() | ||||
endif(CCACHE_FOUND) | ||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") | if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") | |||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wall -Wextra -Weffc++ -Wswi tch-default -Wfloat-equal") | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wall -Wextra -Weffc++ -Wswi tch-default -Wfloat-equal") | |||
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang") | elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang") | |||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wall -Wextra -Weffc++ -Wswi | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wall -Wextra -Weffc++ -Wswi | |||
tch-default -Wfloat-equal") | tch-default -Wfloat-equal -Wimplicit-fallthrough -Weverything") | |||
# If the user is running a newer version of Clang that includes the | ||||
# -Wdouble-promotion, we will ignore that warning. | ||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 3.7) | ||||
CHECK_CXX_COMPILER_FLAG("-Wno-double-promotion" HAS_NO_DOUBLE_PROMOTION) | ||||
if (HAS_NO_DOUBLE_PROMOTION) | ||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-double-promotion") | ||||
endif() | ||||
endif() | ||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") | elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") | |||
add_definitions(-D_CRT_SECURE_NO_WARNINGS=1) | # Force to always compile with /W4 | |||
if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]") | ||||
string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} | ||||
") | ||||
else() | ||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4") | ||||
endif() | ||||
# Force to always compile with /WX | ||||
if(CMAKE_CXX_FLAGS MATCHES "/WX-") | ||||
string(REGEX REPLACE "/WX-" "/WX" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") | ||||
else() | ||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /WX") | ||||
endif() | ||||
endif() | endif() | |||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DRAPIDJSON_HAS_STDSTRING=1") | ||||
add_library(namespacetest STATIC namespacetest.cpp) | add_library(namespacetest STATIC namespacetest.cpp) | |||
add_executable(unittest ${UNITTEST_SOURCES}) | add_executable(unittest ${UNITTEST_SOURCES}) | |||
target_link_libraries(unittest ${TEST_LIBRARIES} namespacetest) | target_link_libraries(unittest ${TEST_LIBRARIES} namespacetest) | |||
add_dependencies(tests unittest) | add_dependencies(tests unittest) | |||
add_test(NAME unittest | add_test(NAME unittest | |||
COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/unittest | COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/unittest | |||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/bin) | WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/bin) | |||
End of changes. 12 change blocks. | ||||
3 lines changed or deleted | 46 lines changed or added |