forked from cieslarmichal/faker-cxx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
148 lines (125 loc) · 4.56 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
cmake_minimum_required(VERSION 3.22)
set(PROJECT_NAME faker-cxx)
project(${PROJECT_NAME} CXX)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED YES)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
option(BUILD_FAKER_TESTS DEFAULT ON)
if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++20 /permissive- /bigobj")
else()
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic -Wconversion -Wformat -Werror"
)
endif()
set(LIBRARY_NAME faker-cxx)
set(FAKER_SOURCES
src/modules/animal/Animal.cpp
src/modules/book/Book.cpp
src/modules/color/Color.cpp
src/modules/commerce/Commerce.cpp
src/modules/company/Company.cpp
src/modules/datatype/Datatype.cpp
src/modules/date/Date.cpp
src/modules/finance/Finance.cpp
src/modules/food/Food.cpp
src/modules/helper/Helper.cpp
src/modules/internet/Internet.cpp
src/modules/location/Location.cpp
src/modules/lorem/Lorem.cpp
src/modules/number/Number.cpp
src/modules/person/Person.cpp
src/modules/string/String.cpp
src/modules/word/Word.cpp
src/modules/phone/Phone.cpp
src/common/BioHelper.cpp
src/common/StringHelper.cpp
src/common/FormatHelper.cpp
src/common/LuhnCheck.cpp
src/common/mappers/precisionMapper/PrecisionMapper.cpp
src/modules/system/System.cpp
src/modules/database/Database.cpp
src/modules/music/Music.cpp
src/modules/movie/Movie.cpp
src/modules/git/Git.cpp
src/modules/hacker/Hacker.cpp
src/modules/sport/Sport.cpp
src/modules/videoGame/VideoGame.cpp
src/modules/medicine/Medicine.cpp
src/modules/weather/Weather.cpp
src/common/WeatherHelper.cpp
src/modules/airline/Airline.cpp
src/modules/image/Image.cpp
src/modules/crypto/Crypto.cpp
src/modules/computer/Computer.cpp
src/modules/vehicle/Vehicle.cpp)
set(FAKER_UT_SOURCES
src/modules/animal/AnimalTest.cpp
src/modules/book/BookTest.cpp
src/modules/color/ColorTest.cpp
src/modules/commerce/CommerceTest.cpp
src/modules/company/CompanyTest.cpp
src/modules/datatype/DatatypeTest.cpp
src/modules/date/DateTest.cpp
src/modules/finance/FinanceTest.cpp
src/modules/food/FoodTest.cpp
src/modules/internet/InternetTest.cpp
src/modules/location/LocationTest.cpp
src/modules/lorem/LoremTest.cpp
src/modules/number/NumberTest.cpp
src/modules/person/PersonTest.cpp
src/modules/string/StringTest.cpp
src/modules/word/WordTest.cpp
src/common/StringHelperTest.cpp
src/modules/phone/PhoneTest.cpp
src/modules/helper/HelperTest.cpp
src/common/LuhnCheckTest.cpp
src/common/FormatHelperTest.cpp
src/common/mappers/precisionMapper/PrecisionMapperTest.cpp
src/modules/system/SystemTest.cpp
src/modules/database/DatabaseTest.cpp
src/modules/music/MusicTest.cpp
src/modules/movie/MovieTest.cpp
src/modules/git/GitTest.cpp
src/modules/hacker/HackerTest.cpp
src/modules/sport/SportTest.cpp
src/modules/videoGame/VideoGameTest.cpp
src/modules/medicine/MedicineTest.cpp
src/modules/weather/WeatherTest.cpp
src/common/WeatherHelperTest.cpp
src/modules/airline/AirlineTest.cpp
src/modules/image/ImageTest.cpp
src/modules/crypto/CryptoTest.cpp
src/modules/computer/ComputerTest.cpp
src/modules/vehicle/VehicleTest.cpp)
add_library(${LIBRARY_NAME} ${FAKER_SOURCES})
target_include_directories(
${LIBRARY_NAME}
INTERFACE "${CMAKE_CURRENT_LIST_DIR}/include"
PRIVATE "${CMAKE_CURRENT_LIST_DIR}/include" ${FMT_INCLUDE_DIR})
add_subdirectory(externals/fmt)
set(FMT_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/externals/fmt/include")
target_link_libraries(${LIBRARY_NAME} PRIVATE fmt)
if(BUILD_FAKER_TESTS)
add_subdirectory(externals/googletest)
set(GTEST_INCLUDE_DIR
"${CMAKE_SOURCE_DIR}/externals/googletest/googletest/include")
set(GMOCK_INCLUDE_DIR
"${CMAKE_SOURCE_DIR}/externals/googletest/googlemock/include")
enable_testing()
set(target_code_coverage_ALL 1)
include("cmake/cmake-coverage.cmake")
add_code_coverage_all_targets()
add_executable(${LIBRARY_NAME}-UT ${FAKER_UT_SOURCES})
target_link_libraries(${LIBRARY_NAME}-UT PRIVATE gtest_main gmock_main
faker-cxx)
target_include_directories(
${LIBRARY_NAME}-UT
PRIVATE ${FMT_INCLUDE_DIR} ${GTEST_INCLUDE_DIR} ${GMOCK_INCLUDE_DIR}
${CMAKE_CURRENT_LIST_DIR})
add_test(
NAME ${LIBRARY_NAME}-UT
COMMAND ${LIBRARY_NAME}-UT
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR})
target_code_coverage(${LIBRARY_NAME}-UT ALL)
endif()