-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
107 lines (84 loc) · 3.5 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
cmake_minimum_required(VERSION 3.15.2)
project(cppcheckOnModernJson)
find_program(
CONAN
NAMES conan.exe
HINTS "C:\\Program Files\\Conan\\conan")
if(${CONAN}-NOTFOUND)
message(FATAL_ERROR "Conan not found")
endif(${CONAN}-NOTFOUND)
execute_process(
COMMAND
${CONAN} install ${CMAKE_CURRENT_LIST_DIR} -s arch=x86 -s build_type=Debug
-s compiler.runtime=MTd --build=missing
COMMAND
${CONAN} install ${CMAKE_CURRENT_LIST_DIR} -s arch=x86 -s build_type=Release
-s compiler.runtime=MT --build=missing
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
include(${CMAKE_BINARY_DIR}/conanbuildinfo_multi.cmake)
conan_basic_setup(TARGETS)
add_executable(Conan_Jsonformoderncpp ${CMAKE_CURRENT_LIST_DIR}/src/main)
set_source_files_properties(Conan_Jsonformoderncpp PROPERTIES CXX_STANDARD 17)
target_link_libraries(Conan_Jsonformoderncpp
PRIVATE CONAN_PKG::jsonformoderncpp)
# ==============================================================================
include(ExternalProject)
ExternalProject_Add(
OfficialLastReleaseRepository
GIT_REPOSITORY https://github.com/nlohmann/json.git
GIT_TAG v3.7.3
BUILD_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND "")
add_executable(OfficialLastRelease_Jsonformoderncpp
${CMAKE_CURRENT_LIST_DIR}/src/main)
set_source_files_properties(OfficialLastRelease_Jsonformoderncpp PROPERTIES
CXX_STANDARD 17)
add_dependencies(OfficialLastRelease_Jsonformoderncpp
OfficialLastReleaseRepository)
ExternalProject_Get_Property(OfficialLastReleaseRepository SOURCE_DIR)
target_include_directories(OfficialLastRelease_Jsonformoderncpp
PRIVATE ${SOURCE_DIR}/include)
# ==============================================================================
include(ExternalProject)
ExternalProject_Add(
PersonalForkRepository
GIT_REPOSITORY https://github.com/Xav83/json.git
GIT_TAG origin/removeMoreCppcheckWarnings
BUILD_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND "")
add_executable(PersonalFork_Jsonformoderncpp ${CMAKE_CURRENT_LIST_DIR}/src/main)
set_source_files_properties(PersonalFork_Jsonformoderncpp PROPERTIES
CXX_STANDARD 17)
add_dependencies(PersonalFork_Jsonformoderncpp PersonalForkRepository)
ExternalProject_Get_Property(PersonalForkRepository SOURCE_DIR)
target_include_directories(PersonalFork_Jsonformoderncpp
PRIVATE ${SOURCE_DIR}/include)
# ==============================================================================
find_program(
CPPCHECK
NAMES cppcheck cppcheck.exe
HINTS "C:\\Program Files\\Cppcheck")
if(${CPPCHECK} MATCHES CPPCHECK-NOTFOUND)
message(FATAL_ERROR "Cppcheck not found")
endif(${CPPCHECK} MATCHES CPPCHECK-NOTFOUND)
enable_testing()
add_test(
NAME cppcheck_OfficialLastRelease_Jsonformoderncpp
COMMAND ${CPPCHECK} --error-exitcode=1
--enable=warning,style,performance,portability --std=c++11
--project=OfficialLastRelease_Jsonformoderncpp.vcxproj
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
add_test(
NAME cppcheck_Conan_Jsonformoderncpp
COMMAND ${CPPCHECK} --error-exitcode=1
--enable=warning,style,performance,portability --std=c++11
--project=Conan_Jsonformoderncpp.vcxproj
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
add_test(
NAME cppcheck_PersonalForkRepository
COMMAND ${CPPCHECK} --error-exitcode=1
--enable=warning,style,performance,portability --std=c++11
--project=PersonalFork_Jsonformoderncpp.vcxproj
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})