CMakeLists.txt 29 KB

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