CMakeLists.txt 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587
  1. ####################################################################################################################
  2. ####################################################################################################################
  3. ####################################################################################################################
  4. # General
  5. ####################################################################################################################
  6. ####################################################################################################################
  7. ####################################################################################################################
  8. ##########################################################
  9. # Basic
  10. ##########################################################
  11. cmake_minimum_required(VERSION 3.17)
  12. project(ls-std VERSION 2023.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_TIME ls-std-time)
  19. set(GOOGLE_TEST_MODULE googletest-1.11.0)
  20. set(CLI_NAME_BASE64 cli-base64)
  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. set(TARGET_COUNTER 0)
  29. if (${LS_STD_BUILD_STATIC})
  30. math(EXPR TARGET_COUNTER "${TARGET_COUNTER} + 1")
  31. set(GOAL "static library")
  32. endif ()
  33. if (${LS_STD_BUILD_SHARED})
  34. math(EXPR TARGET_COUNTER "${TARGET_COUNTER} + 1")
  35. set(GOAL "shared library")
  36. endif ()
  37. message("${PROJECT_NAME}: [Goal] ${GOAL}")
  38. if (TARGET_COUNTER GREATER 1)
  39. message("${PROJECT_NAME}: [Error] only one goal supported at the same time!")
  40. return()
  41. endif ()
  42. if (TARGET_COUNTER EQUAL 0)
  43. message("${PROJECT_NAME}: [Error] no goal selected!")
  44. return()
  45. endif ()
  46. ##########################################################
  47. # Compiler Settings
  48. ##########################################################
  49. message("${PROJECT_NAME}: Setting compiler flags...")
  50. set(CMAKE_CXX_STANDARD 17)
  51. set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
  52. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
  53. ##########################################################
  54. # Compiler Support
  55. ##########################################################
  56. if(${LS_STD_BUILD_WITH_SUPPORTED_COMPILER})
  57. message("${PROJECT_NAME}: build with compiler support...")
  58. # define supported compilers
  59. if (${CMAKE_CXX_COMPILER_ID} STREQUAL MSVC OR
  60. ${CMAKE_CXX_COMPILER_ID} STREQUAL GNU OR
  61. ${CMAKE_CXX_COMPILER_ID} STREQUAL Clang OR
  62. ${CMAKE_CXX_COMPILER_ID} STREQUAL AppleClang)
  63. message("${PROJECT_NAME}: ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION} is supported...")
  64. else()
  65. message("${PROJECT_NAME}: [Error] ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION} is not supported... terminated!")
  66. return()
  67. endif ()
  68. endif()
  69. ######################################################
  70. # Include Directories
  71. ######################################################
  72. message("${PROJECT_NAME}: Adding include directories...")
  73. if (${LS_STD_BUILD_WITH_TESTS})
  74. include_directories(${CMAKE_CURRENT_SOURCE_DIR}/test)
  75. include_directories(${CMAKE_CURRENT_LIST_DIR}/test/lib/${GOOGLE_TEST_MODULE}/googletest/include)
  76. include_directories(${CMAKE_CURRENT_LIST_DIR}/test/lib/${GOOGLE_TEST_MODULE}/googlemock/include)
  77. endif ()
  78. include_directories(${CMAKE_CURRENT_LIST_DIR}/include)
  79. ######################################################
  80. # Add Other CMake Dependencies
  81. ######################################################
  82. message("${PROJECT_NAME}: Adding additional cmake dependencies...")
  83. if (${LS_STD_BUILD_WITH_TESTS})
  84. add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/test/lib/${GOOGLE_TEST_MODULE})
  85. endif ()
  86. ####################################################################################################################
  87. ####################################################################################################################
  88. ####################################################################################################################
  89. # Source Files Modularization
  90. ####################################################################################################################
  91. ####################################################################################################################
  92. ####################################################################################################################
  93. set(SOURCE_FILES_BOXING
  94. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/boxing/Boolean.cpp
  95. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/boxing/Double.cpp
  96. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/boxing/Float.cpp
  97. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/boxing/Integer.cpp
  98. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/boxing/Long.cpp
  99. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/boxing/String.cpp)
  100. set(SOURCE_FILES_CORE
  101. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/evaluator/EmptyStringArgumentEvaluator.cpp
  102. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/exception/EventNotHandledException.cpp
  103. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/exception/EventNotSubscribedException.cpp
  104. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/exception/ExceptionMessage.cpp
  105. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/exception/FileNotFoundException.cpp
  106. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/exception/FileOperationException.cpp
  107. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/exception/IllegalArgumentException.cpp
  108. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/exception/IllegalArithmeticOperationException.cpp
  109. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/exception/IncompleteJsonException.cpp
  110. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/exception/NullPointerException.cpp
  111. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/interface/IBoxing.cpp
  112. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/interface/IEncoding.cpp
  113. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/interface/IEvaluator.cpp
  114. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/interface/IEventSubscriber.cpp
  115. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/interface/IListener.cpp
  116. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/interface/IReader.cpp
  117. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/interface/ISerializable.cpp
  118. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/interface/IStorable.cpp
  119. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/interface/IWriter.cpp
  120. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/Class.cpp
  121. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/LibraryVersion.cpp
  122. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/Version.cpp)
  123. set(SOURCE_FILES_ENCODING
  124. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/encoding/Base64.cpp)
  125. set(SOURCE_FILES_EVENT
  126. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/event/serialization/SerializableJsonEvent.cpp
  127. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/event/Event.cpp
  128. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/event/EventHandler.cpp
  129. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/event/EventManager.cpp
  130. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/event/Narrator.cpp)
  131. set(SOURCE_FILES_IO
  132. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/kv/KvDocument.cpp
  133. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/kv/KvFileReader.cpp
  134. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/kv/KvPair.cpp
  135. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/kv/KvParseParameter.cpp
  136. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/kv/KvParser.cpp
  137. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/logging/Logger.cpp
  138. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/logging/LogLevel.cpp
  139. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/xml/XmlAttribute.cpp
  140. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/xml/XmlDeclaration.cpp
  141. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/xml/XmlDocument.cpp
  142. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/xml/XmlNode.cpp
  143. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/xml/XmlParseParameter.cpp
  144. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/xml/XmlParser.cpp
  145. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/xml/XmlReader.cpp
  146. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/File.cpp
  147. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/FileOutputStream.cpp
  148. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/FilePathSeparator.cpp
  149. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/FilePathSeparatorMatch.cpp
  150. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/FileReader.cpp
  151. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/FileWriter.cpp
  152. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/NewLine.cpp
  153. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/StandardOutputWriter.cpp
  154. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/StorableFile.cpp)
  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/evaluator/EmptyStringArgumentEvaluatorTest.cpp
  174. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/core/exception/EventNotHandledExceptionTest.cpp
  175. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/core/exception/EventNotSubscribedExceptionTest.cpp
  176. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/core/exception/ExceptionMessageTest.cpp
  177. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/core/exception/FileNotFoundExceptionTest.cpp
  178. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/core/exception/FileOperationExceptionTest.cpp
  179. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/core/exception/IllegalArgumentExceptionTest.cpp
  180. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/core/exception/IllegalArithmeticOperationExceptionTest.cpp
  181. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/core/exception/IncompleteJsonExceptionTest.cpp
  182. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/core/exception/NullPointerExceptionTest.cpp
  183. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/core/ClassTest.cpp
  184. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/core/LibraryVersionTest.cpp
  185. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/core/VersionTest.cpp
  186. ${CMAKE_CURRENT_SOURCE_DIR}/test/classes/core/ClassWrapper.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/KvParseParameterTest.cpp
  208. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/kv/KvParserTest.cpp
  209. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/logging/LoggerTest.cpp
  210. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/logging/LogLevelTest.cpp
  211. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/xml/XmlAttributeTest.cpp
  212. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/xml/XmlDeclarationTest.cpp
  213. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/xml/XmlDocumentTest.cpp
  214. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/xml/XmlNodeTest.cpp
  215. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/xml/XmlParseParameterTest.cpp
  216. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/xml/XmlParserTest.cpp
  217. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/xml/XmlParserTestWrapperTest.cpp
  218. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/xml/XmlReaderTest.cpp
  219. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/FileOutputStreamTest.cpp
  220. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/FileReaderTest.cpp
  221. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/FileTest.cpp
  222. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/FileWriterTest.cpp
  223. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/StandardOutputWriterTest.cpp
  224. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/StorableFileTest.cpp
  225. ${CMAKE_CURRENT_SOURCE_DIR}/test/classes/io/xml/TestDataFactory.cpp
  226. ${CMAKE_CURRENT_SOURCE_DIR}/test/classes/io/xml/XmlParserTestWrapper.cpp)
  227. set(TEST_FILES_SERIALIZATION
  228. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/serialization/JsonTest.cpp)
  229. set(TEST_FILES_TIME
  230. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/time/DateTest.cpp)
  231. endif ()
  232. ####################################################################################################################
  233. ####################################################################################################################
  234. ####################################################################################################################
  235. # Test Suite Builds
  236. ####################################################################################################################
  237. ####################################################################################################################
  238. ####################################################################################################################
  239. ##########################################################
  240. # Build Tests (boxing)
  241. ##########################################################
  242. if (${LS_STD_BUILD_WITH_TESTS})
  243. message("${MODULE_NAME_BOXING}: Building tests...")
  244. add_executable(${MODULE_NAME_BOXING}-test ${TEST_FILES_BOXING})
  245. endif ()
  246. ##########################################################
  247. # Build Tests (core)
  248. ##########################################################
  249. if (${LS_STD_BUILD_WITH_TESTS})
  250. message("${MODULE_NAME_CORE}: Building tests...")
  251. add_executable(${MODULE_NAME_CORE}-test ${TEST_FILES_CORE})
  252. endif ()
  253. ##########################################################
  254. # Build Tests (encoding)
  255. ##########################################################
  256. if (${LS_STD_BUILD_WITH_TESTS})
  257. message("${MODULE_NAME_ENCODING}: Building tests...")
  258. add_executable(${MODULE_NAME_ENCODING}-test ${TEST_FILES_ENCODING})
  259. endif ()
  260. ##########################################################
  261. # Build Tests (event)
  262. ##########################################################
  263. if (${LS_STD_BUILD_WITH_TESTS})
  264. message("${MODULE_NAME_EVENT}: Building tests...")
  265. add_executable(${MODULE_NAME_EVENT}-test ${TEST_FILES_EVENT})
  266. endif ()
  267. ##########################################################
  268. # Build Tests (io)
  269. ##########################################################
  270. if (${LS_STD_BUILD_WITH_TESTS})
  271. message("${MODULE_NAME_IO}: Building tests...")
  272. add_executable(${MODULE_NAME_IO}-test
  273. ${CMAKE_CURRENT_SOURCE_DIR}/test/classes/TestHelper.cpp
  274. ${TEST_FILES_IO})
  275. endif ()
  276. ##########################################################
  277. # Build Tests (time)
  278. ##########################################################
  279. if (${LS_STD_BUILD_WITH_TESTS})
  280. message("${MODULE_NAME_TIME}: Building tests...")
  281. add_executable(${MODULE_NAME_TIME}-test ${TEST_FILES_TIME})
  282. endif ()
  283. ##########################################################
  284. # Build Tests (all)
  285. ##########################################################
  286. if (${LS_STD_BUILD_WITH_TESTS})
  287. message("${PROJECT_NAME}: Building tests...")
  288. add_executable(${PROJECT_NAME}-test
  289. ${CMAKE_CURRENT_SOURCE_DIR}/test/classes/TestHelper.cpp
  290. ${TEST_FILES_BOXING}
  291. ${TEST_FILES_CORE}
  292. ${TEST_FILES_ENCODING}
  293. ${TEST_FILES_EVENT}
  294. ${TEST_FILES_IO}
  295. ${TEST_FILES_SERIALIZATION}
  296. ${TEST_FILES_TIME})
  297. endif ()
  298. ####################################################################################################################
  299. ####################################################################################################################
  300. ####################################################################################################################
  301. # Build Library Binaries
  302. ####################################################################################################################
  303. ####################################################################################################################
  304. ####################################################################################################################
  305. ##########################################################
  306. # Build Library (boxing)
  307. ##########################################################
  308. message("${PROJECT_NAME}: Building ${MODULE_NAME_BOXING} library version ${PROJECT_VERSION}...")
  309. if (${LS_STD_BUILD_STATIC})
  310. add_library("${MODULE_NAME_BOXING}" STATIC ${SOURCE_FILES_BOXING})
  311. set_target_properties("${MODULE_NAME_BOXING}" PROPERTIES DEBUG_POSTFIX "-d")
  312. endif ()
  313. if (${LS_STD_BUILD_SHARED})
  314. add_library("${MODULE_NAME_BOXING}" SHARED ${SOURCE_FILES_BOXING})
  315. target_link_libraries("${MODULE_NAME_BOXING}" ${MODULE_NAME_CORE})
  316. set_target_properties("${MODULE_NAME_BOXING}" PROPERTIES DEBUG_POSTFIX "-d")
  317. endif ()
  318. ##########################################################
  319. # Build Library (core)
  320. ##########################################################
  321. message("${PROJECT_NAME}: Building ${MODULE_NAME_CORE} library version ${PROJECT_VERSION}...")
  322. if (${LS_STD_BUILD_STATIC})
  323. add_library("${MODULE_NAME_CORE}" STATIC ${SOURCE_FILES_CORE})
  324. set_target_properties("${MODULE_NAME_CORE}" PROPERTIES DEBUG_POSTFIX "-d")
  325. endif ()
  326. if (${LS_STD_BUILD_SHARED})
  327. add_library("${MODULE_NAME_CORE}" SHARED ${SOURCE_FILES_CORE})
  328. set_target_properties("${MODULE_NAME_CORE}" PROPERTIES DEBUG_POSTFIX "-d")
  329. endif ()
  330. ##########################################################
  331. # Build Library (encoding)
  332. ##########################################################
  333. message("${PROJECT_NAME}: Building ${MODULE_NAME_ENCODING} library version ${PROJECT_VERSION}...")
  334. if (${LS_STD_BUILD_STATIC})
  335. add_library("${MODULE_NAME_ENCODING}" STATIC ${SOURCE_FILES_ENCODING})
  336. set_target_properties("${MODULE_NAME_ENCODING}" PROPERTIES DEBUG_POSTFIX "-d")
  337. endif ()
  338. if (${LS_STD_BUILD_SHARED})
  339. add_library("${MODULE_NAME_ENCODING}" SHARED ${SOURCE_FILES_ENCODING})
  340. set_target_properties("${MODULE_NAME_ENCODING}" PROPERTIES DEBUG_POSTFIX "-d")
  341. endif ()
  342. # CLI base64
  343. add_executable(${CLI_NAME_BASE64}
  344. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/encoding/cli/cli-base64-main.cpp)
  345. ##########################################################
  346. # Build Library (event)
  347. ##########################################################
  348. message("${PROJECT_NAME}: Building ${MODULE_NAME_EVENT} library version ${PROJECT_VERSION}...")
  349. if (${LS_STD_BUILD_STATIC})
  350. add_library("${MODULE_NAME_EVENT}" STATIC ${SOURCE_FILES_EVENT})
  351. set_target_properties("${MODULE_NAME_EVENT}" PROPERTIES DEBUG_POSTFIX "-d")
  352. endif ()
  353. if (${LS_STD_BUILD_SHARED})
  354. add_library("${MODULE_NAME_EVENT}" SHARED ${SOURCE_FILES_EVENT})
  355. target_link_libraries("${MODULE_NAME_EVENT}" ${MODULE_NAME_CORE})
  356. set_target_properties("${MODULE_NAME_EVENT}" PROPERTIES DEBUG_POSTFIX "-d")
  357. endif ()
  358. ##########################################################
  359. # Build Library (io)
  360. ##########################################################
  361. message("${PROJECT_NAME}: Building ${MODULE_NAME_IO} library version ${PROJECT_VERSION}...")
  362. if (${LS_STD_BUILD_STATIC})
  363. add_library("${MODULE_NAME_IO}" STATIC ${SOURCE_FILES_IO})
  364. set_target_properties("${MODULE_NAME_IO}" PROPERTIES DEBUG_POSTFIX "-d")
  365. endif ()
  366. if (${LS_STD_BUILD_SHARED})
  367. add_library("${MODULE_NAME_IO}" SHARED ${SOURCE_FILES_IO})
  368. target_link_libraries("${MODULE_NAME_IO}" ${MODULE_NAME_CORE})
  369. set_target_properties("${MODULE_NAME_IO}" PROPERTIES DEBUG_POSTFIX "-d")
  370. endif ()
  371. ##########################################################
  372. # Build Library (time)
  373. ##########################################################
  374. message("${PROJECT_NAME}: Building ${MODULE_NAME_TIME} library version ${PROJECT_VERSION}...")
  375. if (${LS_STD_BUILD_STATIC})
  376. add_library("${MODULE_NAME_TIME}" STATIC ${SOURCE_FILES_TIME})
  377. set_target_properties("${MODULE_NAME_TIME}" PROPERTIES DEBUG_POSTFIX "-d")
  378. endif ()
  379. if (${LS_STD_BUILD_SHARED})
  380. add_library("${MODULE_NAME_TIME}" SHARED ${SOURCE_FILES_TIME})
  381. target_link_libraries("${MODULE_NAME_TIME}" ${MODULE_NAME_CORE})
  382. set_target_properties("${MODULE_NAME_TIME}" PROPERTIES DEBUG_POSTFIX "-d")
  383. endif ()
  384. ####################################################################################################################
  385. ####################################################################################################################
  386. ####################################################################################################################
  387. # Test Suite: Linking
  388. ####################################################################################################################
  389. ####################################################################################################################
  390. ####################################################################################################################
  391. ##########################################################
  392. # Linking (boxing)
  393. ##########################################################
  394. if (${LS_STD_BUILD_WITH_TESTS})
  395. message("${MODULE_NAME_BOXING}: Linking libraries for test application...")
  396. target_link_libraries(${MODULE_NAME_BOXING}-test
  397. gtest
  398. gmock
  399. gtest_main
  400. "${MODULE_NAME_BOXING}"
  401. "${MODULE_NAME_CORE}")
  402. endif ()
  403. ##########################################################
  404. # Linking (core)
  405. ##########################################################
  406. if (${LS_STD_BUILD_WITH_TESTS})
  407. message("${MODULE_NAME_CORE}: Linking libraries for test application...")
  408. target_link_libraries(${MODULE_NAME_CORE}-test
  409. gtest
  410. gmock
  411. gtest_main
  412. "${MODULE_NAME_CORE}")
  413. endif ()
  414. ##########################################################
  415. # Linking (encoding)
  416. ##########################################################
  417. if (${LS_STD_BUILD_WITH_TESTS})
  418. message("${MODULE_NAME_ENCODING}: Linking libraries for test application...")
  419. target_link_libraries(${MODULE_NAME_ENCODING}-test
  420. gtest
  421. gmock
  422. gtest_main
  423. "${MODULE_NAME_ENCODING}"
  424. "${MODULE_NAME_CORE}")
  425. endif ()
  426. ##########################################################
  427. # Linking (event)
  428. ##########################################################
  429. if (${LS_STD_BUILD_WITH_TESTS})
  430. message("${MODULE_NAME_EVENT}: Linking libraries for test application...")
  431. target_link_libraries(${MODULE_NAME_EVENT}-test
  432. gtest
  433. gmock
  434. gtest_main
  435. "${MODULE_NAME_EVENT}"
  436. "${MODULE_NAME_CORE}")
  437. endif ()
  438. ##########################################################
  439. # Linking (io)
  440. ##########################################################
  441. if (${LS_STD_BUILD_WITH_TESTS})
  442. message("${MODULE_NAME_IO}: Linking libraries for test application...")
  443. target_link_libraries(${MODULE_NAME_IO}-test
  444. gtest
  445. gmock
  446. gtest_main
  447. "${MODULE_NAME_IO}"
  448. "${MODULE_NAME_CORE}")
  449. endif ()
  450. ##########################################################
  451. # Linking (time)
  452. ##########################################################
  453. if (${LS_STD_BUILD_WITH_TESTS})
  454. message("${MODULE_NAME_TIME}: Linking libraries for test application...")
  455. target_link_libraries(${MODULE_NAME_TIME}-test
  456. gtest
  457. gmock
  458. gtest_main
  459. "${MODULE_NAME_TIME}"
  460. "${MODULE_NAME_CORE}")
  461. endif ()
  462. ##########################################################
  463. # Linking (all)
  464. ##########################################################
  465. if (${LS_STD_BUILD_WITH_TESTS})
  466. message("${PROJECT_NAME}: Linking libraries for test application...")
  467. target_link_libraries(${PROJECT_NAME}-test
  468. gtest
  469. gmock
  470. gtest_main
  471. "${MODULE_NAME_BOXING}"
  472. "${MODULE_NAME_ENCODING}"
  473. "${MODULE_NAME_EVENT}"
  474. "${MODULE_NAME_IO}"
  475. "${MODULE_NAME_TIME}"
  476. "${MODULE_NAME_CORE}")
  477. endif ()
  478. ####################################################################################################################
  479. ####################################################################################################################
  480. ####################################################################################################################
  481. # CLI - Base64: Linking
  482. ####################################################################################################################
  483. ####################################################################################################################
  484. ####################################################################################################################
  485. target_link_libraries(${CLI_NAME_BASE64}
  486. "${MODULE_NAME_ENCODING}"
  487. "${MODULE_NAME_CORE}")