CMakeLists.txt 31 KB

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