CMakeLists.txt 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729
  1. ####################################################################################################################
  2. ####################################################################################################################
  3. ####################################################################################################################
  4. # General
  5. ####################################################################################################################
  6. ####################################################################################################################
  7. ####################################################################################################################
  8. ##########################################################
  9. # Basic
  10. ##########################################################
  11. cmake_minimum_required(VERSION 3.17)
  12. project(ls_std VERSION 2022.1.0)
  13. set(MODULE_NAME_BOXING ls_std_boxing)
  14. set(MODULE_NAME_CORE ls_std_core)
  15. set(MODULE_NAME_ENCODING ls_std_encoding)
  16. set(MODULE_NAME_EVENT ls_std_event)
  17. set(MODULE_NAME_IO ls_std_io)
  18. set(MODULE_NAME_LOGIC ls_std_logic)
  19. set(MODULE_NAME_TIME ls_std_time)
  20. set(GOOGLE_TEST_MODULE googletest-1.11.0)
  21. ##########################################################
  22. # Options
  23. ##########################################################
  24. option(LS_STD_BUILD_WITH_TESTS "Build project with tests..." ON)
  25. option(LS_STD_BUILD_STATIC "Build ls_std static library..." ON)
  26. option(LS_STD_BUILD_SHARED "Build ls_std shared library..." OFF)
  27. option(LS_STD_BUILD_MODULE "Build ls_std module library..." OFF)
  28. set(TARGET_COUNTER 0)
  29. if (${LS_STD_BUILD_STATIC})
  30. math(EXPR TARGET_COUNTER "${TARGET_COUNTER} + 1")
  31. message("${PROJECT_NAME}: [Goal] static library")
  32. endif ()
  33. if (${LS_STD_BUILD_SHARED})
  34. math(EXPR TARGET_COUNTER "${TARGET_COUNTER} + 1")
  35. message("${PROJECT_NAME}: [Goal] shared library")
  36. endif ()
  37. if (${LS_STD_BUILD_MODULE})
  38. math(EXPR TARGET_COUNTER "${TARGET_COUNTER} + 1")
  39. message("${PROJECT_NAME}: [Goal] module library")
  40. endif ()
  41. if (TARGET_COUNTER GREATER 1)
  42. message("${PROJECT_NAME}: [Error] only one goal supported at the same time!")
  43. return()
  44. endif ()
  45. ##########################################################
  46. # Compiler Settings
  47. ##########################################################
  48. message("${PROJECT_NAME}: Setting compiler flags...")
  49. set(CMAKE_CXX_STANDARD 11)
  50. set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
  51. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
  52. ######################################################
  53. # Include Directories
  54. ######################################################
  55. message("${PROJECT_NAME}: Adding include directories...")
  56. if (${LS_STD_BUILD_WITH_TESTS})
  57. include_directories(${CMAKE_CURRENT_SOURCE_DIR}/test)
  58. include_directories(${CMAKE_CURRENT_LIST_DIR}/test/lib/${GOOGLE_TEST_MODULE}/googletest/include)
  59. include_directories(${CMAKE_CURRENT_LIST_DIR}/test/lib/${GOOGLE_TEST_MODULE}/googlemock/include)
  60. endif ()
  61. include_directories(${CMAKE_CURRENT_LIST_DIR}/include)
  62. ######################################################
  63. # Add Other CMake Dependencies
  64. ######################################################
  65. message("${PROJECT_NAME}: Adding additional cmake dependencies...")
  66. if (${LS_STD_BUILD_WITH_TESTS})
  67. add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/test/lib/${GOOGLE_TEST_MODULE})
  68. endif ()
  69. ####################################################################################################################
  70. ####################################################################################################################
  71. ####################################################################################################################
  72. # Source Files Modularization
  73. ####################################################################################################################
  74. ####################################################################################################################
  75. ####################################################################################################################
  76. set(SOURCE_FILES_BOXING
  77. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls_std/boxing/Boolean.cpp
  78. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls_std/boxing/Double.cpp
  79. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls_std/boxing/Float.cpp
  80. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls_std/boxing/Integer.cpp
  81. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls_std/boxing/Long.cpp
  82. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls_std/boxing/String.cpp)
  83. set(SOURCE_FILES_CORE
  84. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls_std/core/Class.cpp
  85. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls_std/core/Version.cpp)
  86. set(SOURCE_FILES_ENCODING
  87. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls_std/encoding/Base64.cpp)
  88. set(SOURCE_FILES_EVENT
  89. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls_std/event/serialization/SerializableJsonEvent.cpp
  90. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls_std/event/Event.cpp
  91. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls_std/event/EventHandler.cpp
  92. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls_std/event/EventManager.cpp
  93. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls_std/event/Narrator.cpp)
  94. set(SOURCE_FILES_IO
  95. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls_std/io/kv/KvDocument.cpp
  96. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls_std/io/kv/KvFileReader.cpp
  97. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls_std/io/kv/KvPair.cpp
  98. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls_std/io/kv/KvParser.cpp
  99. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls_std/io/logging/Logger.cpp
  100. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls_std/io/logging/LogLevel.cpp
  101. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls_std/io/xml/XmlAttribute.cpp
  102. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls_std/io/xml/XmlDeclaration.cpp
  103. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls_std/io/xml/XmlDocument.cpp
  104. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls_std/io/xml/XmlNode.cpp
  105. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls_std/io/xml/XmlParser.cpp
  106. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls_std/io/xml/XmlReader.cpp
  107. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls_std/io/File.cpp
  108. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls_std/io/FileOutputStream.cpp
  109. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls_std/io/FileReader.cpp
  110. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls_std/io/FileWriter.cpp
  111. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls_std/io/StandardOutputWriter.cpp
  112. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls_std/io/StorableFile.cpp)
  113. set(SOURCE_FILES_LOGIC
  114. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls_std/logic/serialization/SerializableJsonState.cpp
  115. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls_std/logic/serialization/SerializableJsonStateConnection.cpp
  116. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls_std/logic/serialization/SerializableJsonStateMachine.cpp
  117. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls_std/logic/State.cpp
  118. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls_std/logic/StateConnection.cpp
  119. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls_std/logic/StateMachine.cpp)
  120. set(SOURCE_FILES_TIME
  121. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls_std/time/Date.cpp)
  122. ####################################################################################################################
  123. ####################################################################################################################
  124. ####################################################################################################################
  125. # Test Files Modularization
  126. ####################################################################################################################
  127. ####################################################################################################################
  128. ####################################################################################################################
  129. if (${LS_STD_BUILD_WITH_TESTS})
  130. set(TEST_FILES_BOXING
  131. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/boxing/BooleanTest.cpp
  132. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/boxing/DoubleTest.cpp
  133. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/boxing/FloatTest.cpp
  134. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/boxing/IntegerTest.cpp
  135. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/boxing/LongTest.cpp
  136. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/boxing/StringTest.cpp)
  137. set(TEST_FILES_CORE
  138. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/core/exception/EventNotHandledExceptionTest.cpp
  139. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/core/exception/EventNotSubscribedExceptionTest.cpp
  140. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/core/exception/FileNotFoundExceptionTest.cpp
  141. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/core/exception/FileOperationExceptionTest.cpp
  142. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/core/exception/IllegalArgumentExceptionTest.cpp
  143. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/core/exception/IllegalArithmeticOperationExceptionTest.cpp
  144. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/core/exception/IncompleteJsonExceptionTest.cpp
  145. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/core/exception/NullPointerExceptionTest.cpp
  146. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/core/utils/RegexUtilsTest.cpp
  147. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/core/utils/STLUtilsTest.cpp
  148. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/core/ClassTest.cpp
  149. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/core/LibraryVersionTest.cpp
  150. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/core/VersionTest.cpp)
  151. set(TEST_FILES_ENCODING
  152. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/encoding/Base64Test.cpp)
  153. set(TEST_FILES_EVENT
  154. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/event/serialization/SerializableJsonEventTest.cpp
  155. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/event/EventHandlerTest.cpp
  156. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/event/EventManagerTest.cpp
  157. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/event/EventTest.cpp
  158. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/event/NarratorTest.cpp
  159. ${CMAKE_CURRENT_SOURCE_DIR}/test/classes/event/Colour.cpp
  160. ${CMAKE_CURRENT_SOURCE_DIR}/test/classes/event/DailyNewsAgency.cpp
  161. ${CMAKE_CURRENT_SOURCE_DIR}/test/classes/event/GossipNewsAgency.cpp
  162. ${CMAKE_CURRENT_SOURCE_DIR}/test/classes/event/GossipNewsEvent.cpp
  163. ${CMAKE_CURRENT_SOURCE_DIR}/test/classes/event/NewsAgency.cpp
  164. ${CMAKE_CURRENT_SOURCE_DIR}/test/classes/event/SeriousNewsEvent.cpp
  165. ${CMAKE_CURRENT_SOURCE_DIR}/test/classes/event/TestDataCar.cpp
  166. ${CMAKE_CURRENT_SOURCE_DIR}/test/classes/event/TestDataMercedesCar.cpp)
  167. set(TEST_FILES_IO
  168. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/kv/KvDocumentTest.cpp
  169. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/kv/KvFileReaderTest.cpp
  170. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/kv/KvPairTest.cpp
  171. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/kv/KvParserTest.cpp
  172. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/logging/LoggerTest.cpp
  173. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/logging/LogLevelTest.cpp
  174. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/xml/XmlAttributeTest.cpp
  175. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/xml/XmlDeclarationTest.cpp
  176. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/xml/XmlDocumentTest.cpp
  177. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/xml/XmlNodeTest.cpp
  178. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/xml/XmlParserTest.cpp
  179. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/xml/XmlParserTestWrapperTest.cpp
  180. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/xml/XmlReaderTest.cpp
  181. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/FileOutputStreamTest.cpp
  182. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/FileReaderTest.cpp
  183. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/FileTest.cpp
  184. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/FileWriterTest.cpp
  185. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/StandardOutputWriterTest.cpp
  186. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/StorableFileTest.cpp
  187. ${CMAKE_CURRENT_SOURCE_DIR}/test/classes/io/xml/TestDataFactory.cpp
  188. ${CMAKE_CURRENT_SOURCE_DIR}/test/classes/io/xml/XmlParserTestWrapper.cpp)
  189. set(TEST_FILES_LOGIC
  190. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/logic/serialization/SerializableJsonStateConnectionTest.cpp
  191. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/logic/serialization/SerializableJsonStateMachineTest.cpp
  192. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/logic/serialization/SerializableJsonStateTest.cpp
  193. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/logic/StateConnectionTest.cpp
  194. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/logic/StateMachineTest.cpp
  195. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/logic/StateTest.cpp
  196. ${CMAKE_CURRENT_SOURCE_DIR}/test/classes/logic/TestDataFactory.cpp)
  197. set(TEST_FILES_SERIALIZATION
  198. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/serialization/JsonTest.cpp)
  199. set(TEST_FILES_TIME
  200. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/time/DateTest.cpp)
  201. endif ()
  202. ####################################################################################################################
  203. ####################################################################################################################
  204. ####################################################################################################################
  205. # Test Suite Builds
  206. ####################################################################################################################
  207. ####################################################################################################################
  208. ####################################################################################################################
  209. ##########################################################
  210. # Build Tests (boxing)
  211. ##########################################################
  212. if (${LS_STD_BUILD_WITH_TESTS})
  213. message("${MODULE_NAME_BOXING}: Building tests...")
  214. add_executable(${MODULE_NAME_BOXING}_test ${TEST_FILES_BOXING})
  215. endif ()
  216. ##########################################################
  217. # Build Tests (core)
  218. ##########################################################
  219. if (${LS_STD_BUILD_WITH_TESTS})
  220. message("${MODULE_NAME_CORE}: Building tests...")
  221. add_executable(${MODULE_NAME_CORE}_test ${TEST_FILES_CORE})
  222. endif ()
  223. ##########################################################
  224. # Build Tests (encoding)
  225. ##########################################################
  226. if (${LS_STD_BUILD_WITH_TESTS})
  227. message("${MODULE_NAME_ENCODING}: Building tests...")
  228. add_executable(${MODULE_NAME_ENCODING}_test ${TEST_FILES_ENCODING})
  229. endif ()
  230. ##########################################################
  231. # Build Tests (event)
  232. ##########################################################
  233. if (${LS_STD_BUILD_WITH_TESTS})
  234. message("${MODULE_NAME_EVENT}: Building tests...")
  235. add_executable(${MODULE_NAME_EVENT}_test ${TEST_FILES_EVENT})
  236. endif ()
  237. ##########################################################
  238. # Build Tests (io)
  239. ##########################################################
  240. if (${LS_STD_BUILD_WITH_TESTS})
  241. message("${MODULE_NAME_IO}: Building tests...")
  242. add_executable(${MODULE_NAME_IO}_test ${TEST_FILES_IO})
  243. endif ()
  244. ##########################################################
  245. # Build Tests (logic)
  246. ##########################################################
  247. if (${LS_STD_BUILD_WITH_TESTS})
  248. message("${MODULE_NAME_LOGIC}: Building tests...")
  249. add_executable(${MODULE_NAME_LOGIC}_test ${TEST_FILES_LOGIC})
  250. endif ()
  251. ##########################################################
  252. # Build Tests (time)
  253. ##########################################################
  254. if (${LS_STD_BUILD_WITH_TESTS})
  255. message("${MODULE_NAME_TIME}: Building tests...")
  256. add_executable(${MODULE_NAME_TIME}_test ${TEST_FILES_TIME})
  257. endif ()
  258. ##########################################################
  259. # Build Tests (all)
  260. ##########################################################
  261. if (${LS_STD_BUILD_WITH_TESTS})
  262. message("${PROJECT_NAME}: Building tests...")
  263. add_executable(${PROJECT_NAME}_test
  264. ${TEST_FILES_BOXING}
  265. ${TEST_FILES_CORE}
  266. ${TEST_FILES_ENCODING}
  267. ${TEST_FILES_EVENT}
  268. ${TEST_FILES_IO}
  269. ${TEST_FILES_LOGIC}
  270. ${TEST_FILES_SERIALIZATION}
  271. ${TEST_FILES_TIME})
  272. endif ()
  273. ####################################################################################################################
  274. ####################################################################################################################
  275. ####################################################################################################################
  276. # Build Library Binaries
  277. ####################################################################################################################
  278. ####################################################################################################################
  279. ####################################################################################################################
  280. ##########################################################
  281. # Build Library (boxing)
  282. ##########################################################
  283. message("${PROJECT_NAME}: Building ${MODULE_NAME_BOXING} library version ${PROJECT_VERSION}...")
  284. if (${LS_STD_BUILD_STATIC})
  285. add_library("${MODULE_NAME_BOXING}" STATIC ${SOURCE_FILES_BOXING})
  286. set_target_properties("${MODULE_NAME_BOXING}" PROPERTIES DEBUG_POSTFIX "_d")
  287. endif ()
  288. if (${LS_STD_BUILD_SHARED})
  289. add_library("${MODULE_NAME_BOXING}" SHARED ${SOURCE_FILES_BOXING})
  290. set_target_properties("${MODULE_NAME_BOXING}" PROPERTIES DEBUG_POSTFIX "_d")
  291. endif ()
  292. if (${LS_STD_BUILD_MODULE})
  293. add_library("${MODULE_NAME_BOXING}" MODULE ${SOURCE_FILES_BOXING})
  294. set_target_properties("${MODULE_NAME_BOXING}" PROPERTIES DEBUG_POSTFIX "_d")
  295. endif ()
  296. ##########################################################
  297. # Build Library (core)
  298. ##########################################################
  299. message("${PROJECT_NAME}: Building ${MODULE_NAME_CORE} library version ${PROJECT_VERSION}...")
  300. if (${LS_STD_BUILD_STATIC})
  301. add_library("${MODULE_NAME_CORE}" STATIC ${SOURCE_FILES_CORE})
  302. set_target_properties("${MODULE_NAME_CORE}" PROPERTIES DEBUG_POSTFIX "_d")
  303. endif ()
  304. if (${LS_STD_BUILD_SHARED})
  305. add_library("${MODULE_NAME_CORE}" SHARED ${SOURCE_FILES_CORE})
  306. set_target_properties("${MODULE_NAME_CORE}" PROPERTIES DEBUG_POSTFIX "_d")
  307. endif ()
  308. if (${LS_STD_BUILD_MODULE})
  309. add_library("${MODULE_NAME_CORE}" MODULE ${SOURCE_FILES_CORE})
  310. set_target_properties("${MODULE_NAME_CORE}" PROPERTIES DEBUG_POSTFIX "_d")
  311. endif ()
  312. ##########################################################
  313. # Build Library (encoding)
  314. ##########################################################
  315. message("${PROJECT_NAME}: Building ${MODULE_NAME_ENCODING} library version ${PROJECT_VERSION}...")
  316. if (${LS_STD_BUILD_STATIC})
  317. add_library("${MODULE_NAME_ENCODING}" STATIC ${SOURCE_FILES_ENCODING})
  318. set_target_properties("${MODULE_NAME_ENCODING}" PROPERTIES DEBUG_POSTFIX "_d")
  319. endif ()
  320. if (${LS_STD_BUILD_SHARED})
  321. add_library("${MODULE_NAME_ENCODING}" SHARED ${SOURCE_FILES_ENCODING})
  322. set_target_properties("${MODULE_NAME_ENCODING}" PROPERTIES DEBUG_POSTFIX "_d")
  323. endif ()
  324. if (${LS_STD_BUILD_MODULE})
  325. add_library("${MODULE_NAME_ENCODING}" MODULE ${SOURCE_FILES_ENCODING})
  326. set_target_properties("${MODULE_NAME_ENCODING}" PROPERTIES DEBUG_POSTFIX "_d")
  327. endif ()
  328. ##########################################################
  329. # Build Library (event)
  330. ##########################################################
  331. message("${PROJECT_NAME}: Building ${MODULE_NAME_EVENT} library version ${PROJECT_VERSION}...")
  332. if (${LS_STD_BUILD_STATIC})
  333. add_library("${MODULE_NAME_EVENT}" STATIC ${SOURCE_FILES_EVENT})
  334. set_target_properties("${MODULE_NAME_EVENT}" PROPERTIES DEBUG_POSTFIX "_d")
  335. endif ()
  336. if (${LS_STD_BUILD_SHARED})
  337. add_library("${MODULE_NAME_EVENT}" SHARED ${SOURCE_FILES_EVENT})
  338. set_target_properties("${MODULE_NAME_EVENT}" PROPERTIES DEBUG_POSTFIX "_d")
  339. endif ()
  340. if (${LS_STD_BUILD_MODULE})
  341. add_library("${MODULE_NAME_EVENT}" MODULE ${SOURCE_FILES_EVENT})
  342. set_target_properties("${MODULE_NAME_EVENT}" PROPERTIES DEBUG_POSTFIX "_d")
  343. endif ()
  344. ##########################################################
  345. # Build Library (io)
  346. ##########################################################
  347. message("${PROJECT_NAME}: Building ${MODULE_NAME_IO} library version ${PROJECT_VERSION}...")
  348. if (${LS_STD_BUILD_STATIC})
  349. add_library("${MODULE_NAME_IO}" STATIC ${SOURCE_FILES_IO})
  350. set_target_properties("${MODULE_NAME_IO}" PROPERTIES DEBUG_POSTFIX "_d")
  351. endif ()
  352. if (${LS_STD_BUILD_SHARED})
  353. add_library("${MODULE_NAME_IO}" SHARED ${SOURCE_FILES_IO})
  354. set_target_properties("${MODULE_NAME_IO}" PROPERTIES DEBUG_POSTFIX "_d")
  355. endif ()
  356. if (${LS_STD_BUILD_MODULE})
  357. add_library("${MODULE_NAME_IO}" MODULE ${SOURCE_FILES_IO})
  358. set_target_properties("${MODULE_NAME_IO}" PROPERTIES DEBUG_POSTFIX "_d")
  359. endif ()
  360. ##########################################################
  361. # Build Library (logic)
  362. ##########################################################
  363. message("${PROJECT_NAME}: Building ${MODULE_NAME_LOGIC} library version ${PROJECT_VERSION}...")
  364. if (${LS_STD_BUILD_STATIC})
  365. add_library("${MODULE_NAME_LOGIC}" STATIC ${SOURCE_FILES_LOGIC})
  366. set_target_properties("${MODULE_NAME_LOGIC}" PROPERTIES DEBUG_POSTFIX "_d")
  367. endif ()
  368. if (${LS_STD_BUILD_SHARED})
  369. add_library("${MODULE_NAME_LOGIC}" SHARED ${SOURCE_FILES_LOGIC})
  370. set_target_properties("${MODULE_NAME_LOGIC}" PROPERTIES DEBUG_POSTFIX "_d")
  371. endif ()
  372. if (${LS_STD_BUILD_MODULE})
  373. add_library("${MODULE_NAME_LOGIC}" MODULE ${SOURCE_FILES_LOGIC})
  374. set_target_properties("${MODULE_NAME_LOGIC}" PROPERTIES DEBUG_POSTFIX "_d")
  375. endif ()
  376. ##########################################################
  377. # Build Library (time)
  378. ##########################################################
  379. message("${PROJECT_NAME}: Building ${MODULE_NAME_TIME} library version ${PROJECT_VERSION}...")
  380. if (${LS_STD_BUILD_STATIC})
  381. add_library("${MODULE_NAME_TIME}" STATIC ${SOURCE_FILES_TIME})
  382. set_target_properties("${MODULE_NAME_TIME}" PROPERTIES DEBUG_POSTFIX "_d")
  383. endif ()
  384. if (${LS_STD_BUILD_SHARED})
  385. add_library("${MODULE_NAME_TIME}" SHARED ${SOURCE_FILES_TIME})
  386. set_target_properties("${MODULE_NAME_TIME}" PROPERTIES DEBUG_POSTFIX "_d")
  387. endif ()
  388. if (${LS_STD_BUILD_MODULE})
  389. add_library("${MODULE_NAME_TIME}" MODULE ${SOURCE_FILES_TIME})
  390. set_target_properties("${MODULE_NAME_TIME}" PROPERTIES DEBUG_POSTFIX "_d")
  391. endif ()
  392. ####################################################################################################################
  393. ####################################################################################################################
  394. ####################################################################################################################
  395. # Test Suite: Static Linking
  396. ####################################################################################################################
  397. ####################################################################################################################
  398. ####################################################################################################################
  399. ##########################################################
  400. # Static Linking (boxing)
  401. ##########################################################
  402. if (${LS_STD_BUILD_WITH_TESTS} AND ${LS_STD_BUILD_STATIC})
  403. message("${MODULE_NAME_BOXING}: Linking libraries for test application...")
  404. target_link_libraries(${MODULE_NAME_BOXING}_test
  405. gtest
  406. gmock
  407. gtest_main
  408. "${MODULE_NAME_BOXING}"
  409. "${MODULE_NAME_CORE}")
  410. endif ()
  411. ##########################################################
  412. # Static Linking (core)
  413. ##########################################################
  414. if (${LS_STD_BUILD_WITH_TESTS} AND ${LS_STD_BUILD_STATIC})
  415. message("${MODULE_NAME_CORE}: Linking libraries for test application...")
  416. target_link_libraries(${MODULE_NAME_CORE}_test
  417. gtest
  418. gmock
  419. gtest_main
  420. "${MODULE_NAME_CORE}")
  421. endif ()
  422. ##########################################################
  423. # Static Linking (encoding)
  424. ##########################################################
  425. if (${LS_STD_BUILD_WITH_TESTS} AND ${LS_STD_BUILD_STATIC})
  426. message("${MODULE_NAME_ENCODING}: Linking libraries for test application...")
  427. target_link_libraries(${MODULE_NAME_ENCODING}_test
  428. gtest
  429. gmock
  430. gtest_main
  431. "${MODULE_NAME_ENCODING}"
  432. "${MODULE_NAME_CORE}")
  433. endif ()
  434. ##########################################################
  435. # Static Linking (event)
  436. ##########################################################
  437. if (${LS_STD_BUILD_WITH_TESTS} AND ${LS_STD_BUILD_STATIC})
  438. message("${MODULE_NAME_EVENT}: Linking libraries for test application...")
  439. target_link_libraries(${MODULE_NAME_EVENT}_test
  440. gtest
  441. gmock
  442. gtest_main
  443. "${MODULE_NAME_EVENT}"
  444. "${MODULE_NAME_CORE}")
  445. endif ()
  446. ##########################################################
  447. # Static Linking (io)
  448. ##########################################################
  449. if (${LS_STD_BUILD_WITH_TESTS} AND ${LS_STD_BUILD_STATIC})
  450. message("${MODULE_NAME_IO}: Linking libraries for test application...")
  451. target_link_libraries(${MODULE_NAME_IO}_test
  452. gtest
  453. gmock
  454. gtest_main
  455. "${MODULE_NAME_IO}"
  456. "${MODULE_NAME_CORE}")
  457. endif ()
  458. ##########################################################
  459. # Static Linking (logic)
  460. ##########################################################
  461. if (${LS_STD_BUILD_WITH_TESTS} AND ${LS_STD_BUILD_STATIC})
  462. message("${MODULE_NAME_LOGIC}: Linking libraries for test application...")
  463. target_link_libraries(${MODULE_NAME_LOGIC}_test
  464. gtest
  465. gmock
  466. gtest_main
  467. "${MODULE_NAME_LOGIC}"
  468. "${MODULE_NAME_CORE}")
  469. endif ()
  470. ##########################################################
  471. # Static Linking (time)
  472. ##########################################################
  473. if (${LS_STD_BUILD_WITH_TESTS} AND ${LS_STD_BUILD_STATIC})
  474. message("${MODULE_NAME_TIME}: Linking libraries for test application...")
  475. target_link_libraries(${MODULE_NAME_TIME}_test
  476. gtest
  477. gmock
  478. gtest_main
  479. "${MODULE_NAME_TIME}"
  480. "${MODULE_NAME_CORE}")
  481. endif ()
  482. ##########################################################
  483. # Static Linking (all)
  484. ##########################################################
  485. if (${LS_STD_BUILD_WITH_TESTS} AND ${LS_STD_BUILD_STATIC})
  486. message("${PROJECT_NAME}: Linking libraries for test application...")
  487. target_link_libraries(${PROJECT_NAME}_test
  488. gtest
  489. gmock
  490. gtest_main
  491. "${MODULE_NAME_CORE}"
  492. "${MODULE_NAME_BOXING}"
  493. "${MODULE_NAME_ENCODING}"
  494. "${MODULE_NAME_EVENT}"
  495. "${MODULE_NAME_IO}"
  496. "${MODULE_NAME_LOGIC}"
  497. "${MODULE_NAME_TIME}")
  498. endif ()
  499. ####################################################################################################################
  500. ####################################################################################################################
  501. ####################################################################################################################
  502. # Test Suite: Dynamic Linking
  503. ####################################################################################################################
  504. ####################################################################################################################
  505. ####################################################################################################################
  506. ##########################################################
  507. # Dynamic Linking (boxing)
  508. ##########################################################
  509. if (${LS_STD_BUILD_WITH_TESTS} AND ${LS_STD_BUILD_SHARED})
  510. message("${MODULE_NAME_BOXING}: Linking libraries for test application...")
  511. target_link_libraries(${MODULE_NAME_BOXING}_test
  512. gtest
  513. gmock
  514. gtest_main
  515. "${MODULE_NAME_BOXING}"
  516. "${MODULE_NAME_CORE}")
  517. endif ()
  518. ##########################################################
  519. # Dynamic Linking (core)
  520. ##########################################################
  521. if (${LS_STD_BUILD_WITH_TESTS} AND ${LS_STD_BUILD_SHARED})
  522. message("${MODULE_NAME_CORE}: Linking libraries for test application...")
  523. target_link_libraries(${MODULE_NAME_CORE}_test
  524. gtest
  525. gmock
  526. gtest_main
  527. "${MODULE_NAME_CORE}")
  528. endif ()
  529. ##########################################################
  530. # Dynamic Linking (encoding)
  531. ##########################################################
  532. if (${LS_STD_BUILD_WITH_TESTS} AND ${LS_STD_BUILD_SHARED})
  533. message("${MODULE_NAME_ENCODING}: Linking libraries for test application...")
  534. target_link_libraries(${MODULE_NAME_ENCODING}_test
  535. gtest
  536. gmock
  537. gtest_main
  538. "${MODULE_NAME_ENCODING}"
  539. "${MODULE_NAME_CORE}")
  540. endif ()
  541. ##########################################################
  542. # Dynamic Linking (event)
  543. ##########################################################
  544. if (${LS_STD_BUILD_WITH_TESTS} AND ${LS_STD_BUILD_SHARED})
  545. message("${MODULE_NAME_EVENT}: Linking libraries for test application...")
  546. target_link_libraries(${MODULE_NAME_EVENT}_test
  547. gtest
  548. gmock
  549. gtest_main
  550. "${MODULE_NAME_EVENT}"
  551. "${MODULE_NAME_CORE}")
  552. endif ()
  553. ##########################################################
  554. # Dynamic Linking (io)
  555. ##########################################################
  556. if (${LS_STD_BUILD_WITH_TESTS} AND ${LS_STD_BUILD_SHARED})
  557. message("${MODULE_NAME_IO}: Linking libraries for test application...")
  558. target_link_libraries(${MODULE_NAME_IO}_test
  559. gtest
  560. gmock
  561. gtest_main
  562. "${MODULE_NAME_IO}"
  563. "${MODULE_NAME_CORE}")
  564. endif ()
  565. ##########################################################
  566. # Dynamic Linking (logic)
  567. ##########################################################
  568. if (${LS_STD_BUILD_WITH_TESTS} AND ${LS_STD_BUILD_SHARED})
  569. message("${MODULE_NAME_LOGIC}: Linking libraries for test application...")
  570. target_link_libraries(${MODULE_NAME_LOGIC}_test
  571. gtest
  572. gmock
  573. gtest_main
  574. "${MODULE_NAME_LOGIC}"
  575. "${MODULE_NAME_CORE}")
  576. endif ()
  577. ##########################################################
  578. # Dynamic Linking (time)
  579. ##########################################################
  580. if (${LS_STD_BUILD_WITH_TESTS} AND ${LS_STD_BUILD_SHARED})
  581. message("${MODULE_NAME_TIME}: Linking libraries for test application...")
  582. target_link_libraries(${MODULE_NAME_TIME}_test
  583. gtest
  584. gmock
  585. gtest_main
  586. "${MODULE_NAME_TIME}"
  587. "${MODULE_NAME_CORE}")
  588. endif ()
  589. ##########################################################
  590. # Dynamic Linking (all)
  591. ##########################################################
  592. if (${LS_STD_BUILD_WITH_TESTS} AND ${LS_STD_BUILD_SHARED})
  593. message("${PROJECT_NAME}: Linking libraries for test application...")
  594. target_link_libraries(${PROJECT_NAME}_test
  595. gtest
  596. gmock
  597. gtest_main
  598. "${MODULE_NAME_CORE}"
  599. "${MODULE_NAME_BOXING}"
  600. "${MODULE_NAME_ENCODING}"
  601. "${MODULE_NAME_EVENT}"
  602. "${MODULE_NAME_IO}"
  603. "${MODULE_NAME_LOGIC}"
  604. "${MODULE_NAME_TIME}")
  605. endif ()