CMakeLists.txt 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582
  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/exception/EventNotHandledException.cpp
  102. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/exception/EventNotSubscribedException.cpp
  103. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/exception/FileNotFoundException.cpp
  104. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/exception/FileOperationException.cpp
  105. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/exception/IllegalArgumentException.cpp
  106. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/exception/IllegalArithmeticOperationException.cpp
  107. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/exception/IncompleteJsonException.cpp
  108. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/exception/NullPointerException.cpp
  109. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/interface/IBoxing.cpp
  110. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/interface/IEncoding.cpp
  111. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/interface/IEventSubscriber.cpp
  112. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/interface/IListener.cpp
  113. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/interface/IReader.cpp
  114. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/interface/ISerializable.cpp
  115. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/interface/IStorable.cpp
  116. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/interface/IWriter.cpp
  117. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/Class.cpp
  118. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/LibraryVersion.cpp
  119. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/Version.cpp)
  120. set(SOURCE_FILES_ENCODING
  121. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/encoding/Base64.cpp)
  122. set(SOURCE_FILES_EVENT
  123. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/event/serialization/SerializableJsonEvent.cpp
  124. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/event/Event.cpp
  125. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/event/EventHandler.cpp
  126. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/event/EventManager.cpp
  127. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/event/Narrator.cpp)
  128. set(SOURCE_FILES_IO
  129. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/kv/KvDocument.cpp
  130. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/kv/KvFileReader.cpp
  131. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/kv/KvPair.cpp
  132. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/kv/KvParseParameter.cpp
  133. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/kv/KvParser.cpp
  134. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/logging/Logger.cpp
  135. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/logging/LogLevel.cpp
  136. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/xml/XmlAttribute.cpp
  137. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/xml/XmlDeclaration.cpp
  138. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/xml/XmlDocument.cpp
  139. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/xml/XmlNode.cpp
  140. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/xml/XmlParseParameter.cpp
  141. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/xml/XmlParser.cpp
  142. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/xml/XmlReader.cpp
  143. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/File.cpp
  144. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/FileOutputStream.cpp
  145. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/FilePathSeparator.cpp
  146. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/FilePathSeparatorMatch.cpp
  147. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/FileReader.cpp
  148. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/FileWriter.cpp
  149. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/NewLine.cpp
  150. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/StandardOutputWriter.cpp
  151. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/StorableFile.cpp)
  152. set(SOURCE_FILES_TIME
  153. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/time/Date.cpp)
  154. ####################################################################################################################
  155. ####################################################################################################################
  156. ####################################################################################################################
  157. # Test Files Modularization
  158. ####################################################################################################################
  159. ####################################################################################################################
  160. ####################################################################################################################
  161. if (${LS_STD_BUILD_WITH_TESTS})
  162. set(TEST_FILES_BOXING
  163. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/boxing/BooleanTest.cpp
  164. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/boxing/DoubleTest.cpp
  165. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/boxing/FloatTest.cpp
  166. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/boxing/IntegerTest.cpp
  167. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/boxing/LongTest.cpp
  168. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/boxing/StringTest.cpp)
  169. set(TEST_FILES_CORE
  170. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/core/exception/EventNotHandledExceptionTest.cpp
  171. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/core/exception/EventNotSubscribedExceptionTest.cpp
  172. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/core/exception/FileNotFoundExceptionTest.cpp
  173. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/core/exception/FileOperationExceptionTest.cpp
  174. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/core/exception/IllegalArgumentExceptionTest.cpp
  175. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/core/exception/IllegalArithmeticOperationExceptionTest.cpp
  176. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/core/exception/IncompleteJsonExceptionTest.cpp
  177. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/core/exception/NullPointerExceptionTest.cpp
  178. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/core/ClassTest.cpp
  179. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/core/LibraryVersionTest.cpp
  180. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/core/VersionTest.cpp
  181. ${CMAKE_CURRENT_SOURCE_DIR}/test/classes/core/ClassWrapper.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/KvParseParameterTest.cpp
  203. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/kv/KvParserTest.cpp
  204. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/logging/LoggerTest.cpp
  205. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/logging/LogLevelTest.cpp
  206. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/xml/XmlAttributeTest.cpp
  207. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/xml/XmlDeclarationTest.cpp
  208. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/xml/XmlDocumentTest.cpp
  209. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/xml/XmlNodeTest.cpp
  210. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/xml/XmlParseParameterTest.cpp
  211. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/xml/XmlParserTest.cpp
  212. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/xml/XmlParserTestWrapperTest.cpp
  213. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/xml/XmlReaderTest.cpp
  214. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/FileOutputStreamTest.cpp
  215. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/FileReaderTest.cpp
  216. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/FileTest.cpp
  217. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/FileWriterTest.cpp
  218. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/StandardOutputWriterTest.cpp
  219. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/StorableFileTest.cpp
  220. ${CMAKE_CURRENT_SOURCE_DIR}/test/classes/io/xml/TestDataFactory.cpp
  221. ${CMAKE_CURRENT_SOURCE_DIR}/test/classes/io/xml/XmlParserTestWrapper.cpp)
  222. set(TEST_FILES_SERIALIZATION
  223. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/serialization/JsonTest.cpp)
  224. set(TEST_FILES_TIME
  225. ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/time/DateTest.cpp)
  226. endif ()
  227. ####################################################################################################################
  228. ####################################################################################################################
  229. ####################################################################################################################
  230. # Test Suite Builds
  231. ####################################################################################################################
  232. ####################################################################################################################
  233. ####################################################################################################################
  234. ##########################################################
  235. # Build Tests (boxing)
  236. ##########################################################
  237. if (${LS_STD_BUILD_WITH_TESTS})
  238. message("${MODULE_NAME_BOXING}: Building tests...")
  239. add_executable(${MODULE_NAME_BOXING}-test ${TEST_FILES_BOXING})
  240. endif ()
  241. ##########################################################
  242. # Build Tests (core)
  243. ##########################################################
  244. if (${LS_STD_BUILD_WITH_TESTS})
  245. message("${MODULE_NAME_CORE}: Building tests...")
  246. add_executable(${MODULE_NAME_CORE}-test ${TEST_FILES_CORE})
  247. endif ()
  248. ##########################################################
  249. # Build Tests (encoding)
  250. ##########################################################
  251. if (${LS_STD_BUILD_WITH_TESTS})
  252. message("${MODULE_NAME_ENCODING}: Building tests...")
  253. add_executable(${MODULE_NAME_ENCODING}-test ${TEST_FILES_ENCODING})
  254. endif ()
  255. ##########################################################
  256. # Build Tests (event)
  257. ##########################################################
  258. if (${LS_STD_BUILD_WITH_TESTS})
  259. message("${MODULE_NAME_EVENT}: Building tests...")
  260. add_executable(${MODULE_NAME_EVENT}-test ${TEST_FILES_EVENT})
  261. endif ()
  262. ##########################################################
  263. # Build Tests (io)
  264. ##########################################################
  265. if (${LS_STD_BUILD_WITH_TESTS})
  266. message("${MODULE_NAME_IO}: Building tests...")
  267. add_executable(${MODULE_NAME_IO}-test
  268. ${CMAKE_CURRENT_SOURCE_DIR}/test/classes/TestHelper.cpp
  269. ${TEST_FILES_IO})
  270. endif ()
  271. ##########################################################
  272. # Build Tests (time)
  273. ##########################################################
  274. if (${LS_STD_BUILD_WITH_TESTS})
  275. message("${MODULE_NAME_TIME}: Building tests...")
  276. add_executable(${MODULE_NAME_TIME}-test ${TEST_FILES_TIME})
  277. endif ()
  278. ##########################################################
  279. # Build Tests (all)
  280. ##########################################################
  281. if (${LS_STD_BUILD_WITH_TESTS})
  282. message("${PROJECT_NAME}: Building tests...")
  283. add_executable(${PROJECT_NAME}-test
  284. ${CMAKE_CURRENT_SOURCE_DIR}/test/classes/TestHelper.cpp
  285. ${TEST_FILES_BOXING}
  286. ${TEST_FILES_CORE}
  287. ${TEST_FILES_ENCODING}
  288. ${TEST_FILES_EVENT}
  289. ${TEST_FILES_IO}
  290. ${TEST_FILES_SERIALIZATION}
  291. ${TEST_FILES_TIME})
  292. endif ()
  293. ####################################################################################################################
  294. ####################################################################################################################
  295. ####################################################################################################################
  296. # Build Library Binaries
  297. ####################################################################################################################
  298. ####################################################################################################################
  299. ####################################################################################################################
  300. ##########################################################
  301. # Build Library (boxing)
  302. ##########################################################
  303. message("${PROJECT_NAME}: Building ${MODULE_NAME_BOXING} library version ${PROJECT_VERSION}...")
  304. if (${LS_STD_BUILD_STATIC})
  305. add_library("${MODULE_NAME_BOXING}" STATIC ${SOURCE_FILES_BOXING})
  306. set_target_properties("${MODULE_NAME_BOXING}" PROPERTIES DEBUG_POSTFIX "-d")
  307. endif ()
  308. if (${LS_STD_BUILD_SHARED})
  309. add_library("${MODULE_NAME_BOXING}" SHARED ${SOURCE_FILES_BOXING})
  310. target_link_libraries("${MODULE_NAME_BOXING}" ${MODULE_NAME_CORE})
  311. set_target_properties("${MODULE_NAME_BOXING}" PROPERTIES DEBUG_POSTFIX "-d")
  312. endif ()
  313. ##########################################################
  314. # Build Library (core)
  315. ##########################################################
  316. message("${PROJECT_NAME}: Building ${MODULE_NAME_CORE} library version ${PROJECT_VERSION}...")
  317. if (${LS_STD_BUILD_STATIC})
  318. add_library("${MODULE_NAME_CORE}" STATIC ${SOURCE_FILES_CORE})
  319. set_target_properties("${MODULE_NAME_CORE}" PROPERTIES DEBUG_POSTFIX "-d")
  320. endif ()
  321. if (${LS_STD_BUILD_SHARED})
  322. add_library("${MODULE_NAME_CORE}" SHARED ${SOURCE_FILES_CORE})
  323. set_target_properties("${MODULE_NAME_CORE}" PROPERTIES DEBUG_POSTFIX "-d")
  324. endif ()
  325. ##########################################################
  326. # Build Library (encoding)
  327. ##########################################################
  328. message("${PROJECT_NAME}: Building ${MODULE_NAME_ENCODING} library version ${PROJECT_VERSION}...")
  329. if (${LS_STD_BUILD_STATIC})
  330. add_library("${MODULE_NAME_ENCODING}" STATIC ${SOURCE_FILES_ENCODING})
  331. set_target_properties("${MODULE_NAME_ENCODING}" PROPERTIES DEBUG_POSTFIX "-d")
  332. endif ()
  333. if (${LS_STD_BUILD_SHARED})
  334. add_library("${MODULE_NAME_ENCODING}" SHARED ${SOURCE_FILES_ENCODING})
  335. set_target_properties("${MODULE_NAME_ENCODING}" PROPERTIES DEBUG_POSTFIX "-d")
  336. endif ()
  337. # CLI base64
  338. add_executable(${CLI_NAME_BASE64}
  339. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/encoding/cli/cli-base64-main.cpp)
  340. ##########################################################
  341. # Build Library (event)
  342. ##########################################################
  343. message("${PROJECT_NAME}: Building ${MODULE_NAME_EVENT} library version ${PROJECT_VERSION}...")
  344. if (${LS_STD_BUILD_STATIC})
  345. add_library("${MODULE_NAME_EVENT}" STATIC ${SOURCE_FILES_EVENT})
  346. set_target_properties("${MODULE_NAME_EVENT}" PROPERTIES DEBUG_POSTFIX "-d")
  347. endif ()
  348. if (${LS_STD_BUILD_SHARED})
  349. add_library("${MODULE_NAME_EVENT}" SHARED ${SOURCE_FILES_EVENT})
  350. target_link_libraries("${MODULE_NAME_EVENT}" ${MODULE_NAME_CORE})
  351. set_target_properties("${MODULE_NAME_EVENT}" PROPERTIES DEBUG_POSTFIX "-d")
  352. endif ()
  353. ##########################################################
  354. # Build Library (io)
  355. ##########################################################
  356. message("${PROJECT_NAME}: Building ${MODULE_NAME_IO} library version ${PROJECT_VERSION}...")
  357. if (${LS_STD_BUILD_STATIC})
  358. add_library("${MODULE_NAME_IO}" STATIC ${SOURCE_FILES_IO})
  359. set_target_properties("${MODULE_NAME_IO}" PROPERTIES DEBUG_POSTFIX "-d")
  360. endif ()
  361. if (${LS_STD_BUILD_SHARED})
  362. add_library("${MODULE_NAME_IO}" SHARED ${SOURCE_FILES_IO})
  363. target_link_libraries("${MODULE_NAME_IO}" ${MODULE_NAME_CORE})
  364. set_target_properties("${MODULE_NAME_IO}" PROPERTIES DEBUG_POSTFIX "-d")
  365. endif ()
  366. ##########################################################
  367. # Build Library (time)
  368. ##########################################################
  369. message("${PROJECT_NAME}: Building ${MODULE_NAME_TIME} library version ${PROJECT_VERSION}...")
  370. if (${LS_STD_BUILD_STATIC})
  371. add_library("${MODULE_NAME_TIME}" STATIC ${SOURCE_FILES_TIME})
  372. set_target_properties("${MODULE_NAME_TIME}" PROPERTIES DEBUG_POSTFIX "-d")
  373. endif ()
  374. if (${LS_STD_BUILD_SHARED})
  375. add_library("${MODULE_NAME_TIME}" SHARED ${SOURCE_FILES_TIME})
  376. target_link_libraries("${MODULE_NAME_TIME}" ${MODULE_NAME_CORE})
  377. set_target_properties("${MODULE_NAME_TIME}" PROPERTIES DEBUG_POSTFIX "-d")
  378. endif ()
  379. ####################################################################################################################
  380. ####################################################################################################################
  381. ####################################################################################################################
  382. # Test Suite: Linking
  383. ####################################################################################################################
  384. ####################################################################################################################
  385. ####################################################################################################################
  386. ##########################################################
  387. # Linking (boxing)
  388. ##########################################################
  389. if (${LS_STD_BUILD_WITH_TESTS})
  390. message("${MODULE_NAME_BOXING}: Linking libraries for test application...")
  391. target_link_libraries(${MODULE_NAME_BOXING}-test
  392. gtest
  393. gmock
  394. gtest_main
  395. "${MODULE_NAME_BOXING}"
  396. "${MODULE_NAME_CORE}")
  397. endif ()
  398. ##########################################################
  399. # Linking (core)
  400. ##########################################################
  401. if (${LS_STD_BUILD_WITH_TESTS})
  402. message("${MODULE_NAME_CORE}: Linking libraries for test application...")
  403. target_link_libraries(${MODULE_NAME_CORE}-test
  404. gtest
  405. gmock
  406. gtest_main
  407. "${MODULE_NAME_CORE}")
  408. endif ()
  409. ##########################################################
  410. # Linking (encoding)
  411. ##########################################################
  412. if (${LS_STD_BUILD_WITH_TESTS})
  413. message("${MODULE_NAME_ENCODING}: Linking libraries for test application...")
  414. target_link_libraries(${MODULE_NAME_ENCODING}-test
  415. gtest
  416. gmock
  417. gtest_main
  418. "${MODULE_NAME_ENCODING}"
  419. "${MODULE_NAME_CORE}")
  420. endif ()
  421. ##########################################################
  422. # Linking (event)
  423. ##########################################################
  424. if (${LS_STD_BUILD_WITH_TESTS})
  425. message("${MODULE_NAME_EVENT}: Linking libraries for test application...")
  426. target_link_libraries(${MODULE_NAME_EVENT}-test
  427. gtest
  428. gmock
  429. gtest_main
  430. "${MODULE_NAME_EVENT}"
  431. "${MODULE_NAME_CORE}")
  432. endif ()
  433. ##########################################################
  434. # Linking (io)
  435. ##########################################################
  436. if (${LS_STD_BUILD_WITH_TESTS})
  437. message("${MODULE_NAME_IO}: Linking libraries for test application...")
  438. target_link_libraries(${MODULE_NAME_IO}-test
  439. gtest
  440. gmock
  441. gtest_main
  442. "${MODULE_NAME_IO}"
  443. "${MODULE_NAME_CORE}")
  444. endif ()
  445. ##########################################################
  446. # Linking (time)
  447. ##########################################################
  448. if (${LS_STD_BUILD_WITH_TESTS})
  449. message("${MODULE_NAME_TIME}: Linking libraries for test application...")
  450. target_link_libraries(${MODULE_NAME_TIME}-test
  451. gtest
  452. gmock
  453. gtest_main
  454. "${MODULE_NAME_TIME}"
  455. "${MODULE_NAME_CORE}")
  456. endif ()
  457. ##########################################################
  458. # Linking (all)
  459. ##########################################################
  460. if (${LS_STD_BUILD_WITH_TESTS})
  461. message("${PROJECT_NAME}: Linking libraries for test application...")
  462. target_link_libraries(${PROJECT_NAME}-test
  463. gtest
  464. gmock
  465. gtest_main
  466. "${MODULE_NAME_BOXING}"
  467. "${MODULE_NAME_ENCODING}"
  468. "${MODULE_NAME_EVENT}"
  469. "${MODULE_NAME_IO}"
  470. "${MODULE_NAME_TIME}"
  471. "${MODULE_NAME_CORE}")
  472. endif ()
  473. ####################################################################################################################
  474. ####################################################################################################################
  475. ####################################################################################################################
  476. # CLI - Base64: Linking
  477. ####################################################################################################################
  478. ####################################################################################################################
  479. ####################################################################################################################
  480. target_link_libraries(${CLI_NAME_BASE64}
  481. "${MODULE_NAME_ENCODING}"
  482. "${MODULE_NAME_CORE}")