CMakeLists.txt 29 KB

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