CMakeLists.txt 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969
  1. project(minetest)
  2. INCLUDE(CheckTypeSize)
  3. INCLUDE(CheckIncludeFiles)
  4. INCLUDE(CheckLibraryExists)
  5. check_type_size(int SIZEOF_INT BUILTIN_TYPES_ONLY LANGUAGE CXX)
  6. if(SIZEOF_INT LESS 4)
  7. message(FATAL_ERROR "Minetest will not work with int less than 32 bits wide.")
  8. endif()
  9. check_type_size(size_t SIZEOF_SIZE_T LANGUAGE CXX)
  10. if(SIZEOF_SIZE_T LESS 4)
  11. message(FATAL_ERROR "Minetest will not work with size_t less than 32 bits wide.")
  12. endif()
  13. # Add custom SemiDebug build mode
  14. set(CMAKE_CXX_FLAGS_SEMIDEBUG "-O1 -g -Wall" CACHE STRING
  15. "Flags used by the C++ compiler during semidebug builds."
  16. FORCE
  17. )
  18. set(CMAKE_C_FLAGS_SEMIDEBUG "-O1 -g -Wall -pedantic" CACHE STRING
  19. "Flags used by the C compiler during semidebug builds."
  20. FORCE
  21. )
  22. mark_as_advanced(
  23. CMAKE_CXX_FLAGS_SEMIDEBUG
  24. CMAKE_C_FLAGS_SEMIDEBUG
  25. )
  26. set(CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING
  27. "Choose the type of build. Options are: None Debug SemiDebug RelWithDebInfo MinSizeRel."
  28. FORCE
  29. )
  30. # Set some random things default to not being visible in the GUI
  31. mark_as_advanced(EXECUTABLE_OUTPUT_PATH LIBRARY_OUTPUT_PATH)
  32. if(NOT (BUILD_CLIENT OR BUILD_SERVER))
  33. message(WARNING "Neither BUILD_CLIENT nor BUILD_SERVER is set! Setting BUILD_SERVER=true")
  34. set(BUILD_SERVER TRUE)
  35. endif()
  36. option(ENABLE_CURL "Enable cURL support for fetching media" TRUE)
  37. set(USE_CURL FALSE)
  38. if(ENABLE_CURL)
  39. find_package(CURL 7.28.0)
  40. if (CURL_FOUND)
  41. message(STATUS "cURL support enabled.")
  42. set(USE_CURL TRUE)
  43. endif()
  44. else()
  45. mark_as_advanced(CLEAR CURL_LIBRARY CURL_INCLUDE_DIR)
  46. endif()
  47. if(NOT USE_CURL)
  48. if(BUILD_CLIENT)
  49. message(WARNING "cURL is required to load the server list")
  50. endif()
  51. if(BUILD_SERVER)
  52. message(WARNING "cURL is required to announce to the server list")
  53. endif()
  54. endif()
  55. option(ENABLE_GETTEXT "Use GetText for internationalization" ${BUILD_CLIENT})
  56. set(USE_GETTEXT FALSE)
  57. if(ENABLE_GETTEXT)
  58. find_package(GettextLib)
  59. if(GETTEXTLIB_FOUND)
  60. if(WIN32)
  61. message(STATUS "GetText library: ${GETTEXT_LIBRARY}")
  62. message(STATUS "GetText DLL(s): ${GETTEXT_DLL}")
  63. endif()
  64. set(USE_GETTEXT TRUE)
  65. message(STATUS "GetText enabled; locales found: ${GETTEXT_AVAILABLE_LOCALES}")
  66. endif(GETTEXTLIB_FOUND)
  67. else()
  68. mark_as_advanced(GETTEXT_INCLUDE_DIR GETTEXT_LIBRARY GETTEXT_MSGFMT)
  69. message(STATUS "GetText disabled.")
  70. endif()
  71. option(ENABLE_SOUND "Enable sound" TRUE)
  72. set(USE_SOUND FALSE)
  73. if(BUILD_CLIENT AND ENABLE_SOUND)
  74. # Sound libraries
  75. find_package(OpenAL)
  76. find_package(Vorbis)
  77. if(NOT OPENAL_FOUND)
  78. message(STATUS "Sound enabled, but OpenAL not found!")
  79. mark_as_advanced(CLEAR OPENAL_LIBRARY OPENAL_INCLUDE_DIR)
  80. endif()
  81. if(NOT VORBIS_FOUND)
  82. message(STATUS "Sound enabled, but Vorbis libraries not found!")
  83. mark_as_advanced(CLEAR OGG_INCLUDE_DIR VORBIS_INCLUDE_DIR OGG_LIBRARY VORBIS_LIBRARY VORBISFILE_LIBRARY)
  84. endif()
  85. if(OPENAL_FOUND AND VORBIS_FOUND)
  86. set(USE_SOUND TRUE)
  87. message(STATUS "Sound enabled.")
  88. else()
  89. message(FATAL_ERROR "Sound enabled, but cannot be used.\n"
  90. "To continue, either fill in the required paths or disable sound. (-DENABLE_SOUND=0)")
  91. endif()
  92. endif()
  93. option(ENABLE_TOUCH "Enable touchscreen by default" FALSE)
  94. if(ENABLE_TOUCH)
  95. message(STATUS "Touchscreen support enabled by default.")
  96. add_definitions(-DENABLE_TOUCH)
  97. endif()
  98. if(BUILD_CLIENT)
  99. find_package(Freetype REQUIRED)
  100. endif()
  101. option(ENABLE_CURSES "Enable ncurses console" TRUE)
  102. set(USE_CURSES FALSE)
  103. if(ENABLE_CURSES)
  104. find_package(Ncursesw)
  105. if(CURSES_FOUND)
  106. set(USE_CURSES TRUE)
  107. message(STATUS "ncurses console enabled.")
  108. include_directories(${CURSES_INCLUDE_DIRS})
  109. else()
  110. message(STATUS "ncurses not found!")
  111. endif()
  112. endif(ENABLE_CURSES)
  113. option(ENABLE_POSTGRESQL "Enable PostgreSQL backend" TRUE)
  114. set(USE_POSTGRESQL FALSE)
  115. if(ENABLE_POSTGRESQL)
  116. if(CMAKE_VERSION VERSION_LESS "3.20")
  117. find_package(PostgreSQL QUIET)
  118. # Before CMake 3.20 FindPostgreSQL.cmake always looked for server includes
  119. # but we don't need them, so continue anyway if only those are missing.
  120. if(PostgreSQL_INCLUDE_DIR AND PostgreSQL_LIBRARY)
  121. set(PostgreSQL_FOUND TRUE)
  122. set(PostgreSQL_INCLUDE_DIRS ${PostgreSQL_INCLUDE_DIR})
  123. set(PostgreSQL_LIBRARIES ${PostgreSQL_LIBRARY})
  124. endif()
  125. else()
  126. find_package(PostgreSQL)
  127. endif()
  128. if(PostgreSQL_FOUND)
  129. set(USE_POSTGRESQL TRUE)
  130. message(STATUS "PostgreSQL backend enabled")
  131. # This variable is case sensitive, don't try to change it to POSTGRESQL_INCLUDE_DIR
  132. message(STATUS "PostgreSQL includes: ${PostgreSQL_INCLUDE_DIRS}")
  133. include_directories(${PostgreSQL_INCLUDE_DIRS})
  134. else()
  135. message(STATUS "PostgreSQL not found!")
  136. endif()
  137. endif(ENABLE_POSTGRESQL)
  138. option(ENABLE_LEVELDB "Enable LevelDB backend" TRUE)
  139. set(USE_LEVELDB FALSE)
  140. if(ENABLE_LEVELDB)
  141. find_library(LEVELDB_LIBRARY NAMES leveldb libleveldb)
  142. find_path(LEVELDB_INCLUDE_DIR db.h PATH_SUFFIXES leveldb)
  143. if(LEVELDB_LIBRARY AND LEVELDB_INCLUDE_DIR)
  144. set(USE_LEVELDB TRUE)
  145. message(STATUS "LevelDB backend enabled.")
  146. include_directories(${LEVELDB_INCLUDE_DIR})
  147. else()
  148. message(STATUS "LevelDB not found!")
  149. endif()
  150. endif(ENABLE_LEVELDB)
  151. OPTION(ENABLE_REDIS "Enable Redis backend" TRUE)
  152. set(USE_REDIS FALSE)
  153. if(ENABLE_REDIS)
  154. find_library(REDIS_LIBRARY hiredis)
  155. find_path(REDIS_INCLUDE_DIR hiredis.h PATH_SUFFIXES hiredis)
  156. if(REDIS_LIBRARY AND REDIS_INCLUDE_DIR)
  157. set(USE_REDIS TRUE)
  158. message(STATUS "Redis backend enabled.")
  159. include_directories(${REDIS_INCLUDE_DIR})
  160. else(REDIS_LIBRARY AND REDIS_INCLUDE_DIR)
  161. message(STATUS "Redis not found!")
  162. endif(REDIS_LIBRARY AND REDIS_INCLUDE_DIR)
  163. endif(ENABLE_REDIS)
  164. find_package(SQLite3 REQUIRED)
  165. OPTION(ENABLE_PROMETHEUS "Enable prometheus client support" FALSE)
  166. set(USE_PROMETHEUS FALSE)
  167. if(ENABLE_PROMETHEUS)
  168. find_path(PROMETHEUS_CPP_INCLUDE_DIR NAMES prometheus/counter.h)
  169. find_library(PROMETHEUS_PULL_LIBRARY NAMES prometheus-cpp-pull)
  170. find_library(PROMETHEUS_CORE_LIBRARY NAMES prometheus-cpp-core)
  171. if(PROMETHEUS_CPP_INCLUDE_DIR AND PROMETHEUS_PULL_LIBRARY AND PROMETHEUS_CORE_LIBRARY)
  172. set(PROMETHEUS_LIBRARIES ${PROMETHEUS_PULL_LIBRARY} ${PROMETHEUS_CORE_LIBRARY})
  173. set(USE_PROMETHEUS TRUE)
  174. include_directories(${PROMETHEUS_CPP_INCLUDE_DIR})
  175. endif(PROMETHEUS_CPP_INCLUDE_DIR AND PROMETHEUS_PULL_LIBRARY AND PROMETHEUS_CORE_LIBRARY)
  176. endif(ENABLE_PROMETHEUS)
  177. if(USE_PROMETHEUS)
  178. message(STATUS "Prometheus client enabled.")
  179. else(USE_PROMETHEUS)
  180. message(STATUS "Prometheus client disabled.")
  181. endif(USE_PROMETHEUS)
  182. OPTION(ENABLE_SPATIAL "Enable SpatialIndex AreaStore backend" TRUE)
  183. set(USE_SPATIAL FALSE)
  184. if(ENABLE_SPATIAL)
  185. find_library(SPATIAL_LIBRARY spatialindex)
  186. find_path(SPATIAL_INCLUDE_DIR spatialindex/SpatialIndex.h)
  187. if(SPATIAL_LIBRARY AND SPATIAL_INCLUDE_DIR)
  188. set(USE_SPATIAL TRUE)
  189. message(STATUS "SpatialIndex AreaStore backend enabled.")
  190. include_directories(${SPATIAL_INCLUDE_DIR})
  191. else(SPATIAL_LIBRARY AND SPATIAL_INCLUDE_DIR)
  192. message(STATUS "SpatialIndex not found!")
  193. endif(SPATIAL_LIBRARY AND SPATIAL_INCLUDE_DIR)
  194. endif(ENABLE_SPATIAL)
  195. find_package(ZLIB REQUIRED)
  196. find_package(Zstd REQUIRED)
  197. if(NOT MSVC)
  198. set(USE_GPROF FALSE CACHE BOOL "Use -pg flag for g++")
  199. endif()
  200. # Haiku endian support
  201. if(HAIKU)
  202. set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_BSD_SOURCE")
  203. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_BSD_SOURCE")
  204. endif()
  205. # Use cmake_config.h
  206. add_definitions(-DUSE_CMAKE_CONFIG_H)
  207. set(THREADS_PREFER_PTHREAD_FLAG ON)
  208. find_package(Threads REQUIRED)
  209. set(PLATFORM_LIBS Threads::Threads)
  210. if(WIN32)
  211. # Windows
  212. if(MSVC) # MSVC Specifics
  213. set(PLATFORM_LIBS dbghelp.lib ${PLATFORM_LIBS})
  214. # Surpress some useless warnings
  215. add_definitions ( /D "_CRT_SECURE_NO_DEPRECATE" /W1 )
  216. # Get M_PI to work
  217. add_definitions(/D "_USE_MATH_DEFINES")
  218. # Don't define min/max macros in minwindef.h
  219. add_definitions(/D "NOMINMAX")
  220. endif()
  221. set(PLATFORM_LIBS ws2_32.lib version.lib shlwapi.lib winmm.lib ${PLATFORM_LIBS})
  222. set(EXTRA_DLL "" CACHE FILEPATH "Optional paths to additional DLLs that should be packaged")
  223. # DLLs are automatically copied to the output directory by vcpkg when VCPKG_APPLOCAL_DEPS=ON
  224. if(NOT VCPKG_APPLOCAL_DEPS)
  225. set(ZLIB_DLL "" CACHE FILEPATH "Path to Zlib DLL for installation (optional)")
  226. set(ZSTD_DLL "" CACHE FILEPATH "Path to Zstd DLL for installation (optional)")
  227. if(BUILD_CLIENT)
  228. set(PNG_DLL "" CACHE FILEPATH "Path to libpng DLL for installation (optional)")
  229. set(JPEG_DLL "" CACHE FILEPATH "Path to libjpeg DLL for installation (optional)")
  230. set(SDL2_DLL "" CACHE FILEPATH "Path to SDL2 DLL for installation (optional)")
  231. endif()
  232. if(BUILD_CLIENT AND ENABLE_SOUND)
  233. set(OPENAL_DLL "" CACHE FILEPATH "Path to OpenAL DLL for installation (optional)")
  234. set(OGG_DLL "" CACHE FILEPATH "Path to Ogg DLL for installation (optional)")
  235. set(VORBIS_DLL "" CACHE FILEPATH "Path to Vorbis DLLs for installation (optional)")
  236. endif()
  237. if(USE_GETTEXT)
  238. set(GETTEXT_DLL "" CACHE FILEPATH "Path to Intl/Iconv DLLs for installation (optional)")
  239. endif()
  240. if(USE_LUAJIT)
  241. set(LUA_DLL "" CACHE FILEPATH "Path to luajit-5.1.dll for installation (optional)")
  242. endif()
  243. endif()
  244. else()
  245. # Unix probably
  246. set(PLATFORM_LIBS ${PLATFORM_LIBS} ${CMAKE_DL_LIBS})
  247. if(APPLE)
  248. set(PLATFORM_LIBS "-framework CoreFoundation" ${PLATFORM_LIBS})
  249. else()
  250. check_library_exists(rt clock_gettime "" HAVE_LIBRT)
  251. if (HAVE_LIBRT)
  252. set(PLATFORM_LIBS -lrt ${PLATFORM_LIBS})
  253. endif(HAVE_LIBRT)
  254. endif(APPLE)
  255. find_library(ICONV_LIBRARY iconv)
  256. mark_as_advanced(ICONV_LIBRARY)
  257. if (ICONV_LIBRARY)
  258. set(PLATFORM_LIBS ${PLATFORM_LIBS} ${ICONV_LIBRARY})
  259. endif()
  260. if (HAIKU)
  261. set(PLATFORM_LIBS ${PLATFORM_LIBS} network)
  262. endif()
  263. if (ANDROID)
  264. set(PLATFORM_LIBS ${PLATFORM_LIBS} android log)
  265. endif()
  266. endif()
  267. # On clang and gcc, some functionalities of std::atomic require -latomic.
  268. # See <https://en.cppreference.com/w/cpp/atomic/atomic#Notes>.
  269. # Note that find_library does not reliably find it so we have to resort to this.
  270. # Also, passing -latomic is not always the same as adding atomic to the library list.
  271. include(CheckCSourceCompiles)
  272. if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
  273. set(CMAKE_REQUIRED_LIBRARIES "-latomic")
  274. check_c_source_compiles("int main(){}" HAVE_LINK_ATOMIC)
  275. set(CMAKE_REQUIRED_LIBRARIES "")
  276. if(HAVE_LINK_ATOMIC)
  277. set(PLATFORM_LIBS ${PLATFORM_LIBS} "-latomic")
  278. endif()
  279. endif()
  280. include(CheckSymbolExists)
  281. check_symbol_exists(strlcpy "string.h" HAVE_STRLCPY)
  282. check_include_files(endian.h HAVE_ENDIAN_H)
  283. configure_file(
  284. "${PROJECT_SOURCE_DIR}/cmake_config.h.in"
  285. "${PROJECT_BINARY_DIR}/cmake_config.h"
  286. )
  287. # Add a target that always rebuilds cmake_config_githash.h
  288. add_custom_target(GenerateVersion
  289. COMMAND ${CMAKE_COMMAND}
  290. -D "GENERATE_VERSION_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}"
  291. -D "GENERATE_VERSION_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}"
  292. -D "VERSION_STRING=${VERSION_STRING}"
  293. -D "DEVELOPMENT_BUILD=${DEVELOPMENT_BUILD}"
  294. -P "${CMAKE_SOURCE_DIR}/cmake/Modules/GenerateVersion.cmake"
  295. WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
  296. add_subdirectory(threading)
  297. add_subdirectory(content)
  298. add_subdirectory(database)
  299. add_subdirectory(gui)
  300. add_subdirectory(mapgen)
  301. add_subdirectory(network)
  302. add_subdirectory(script)
  303. add_subdirectory(unittest)
  304. add_subdirectory(benchmark)
  305. add_subdirectory(util)
  306. add_subdirectory(irrlicht_changes)
  307. add_subdirectory(server)
  308. set(common_SRCS
  309. ${database_SRCS}
  310. ${mapgen_SRCS}
  311. ${server_SRCS}
  312. ${content_SRCS}
  313. chat.cpp
  314. clientdynamicinfo.cpp
  315. collision.cpp
  316. content_mapnode.cpp
  317. content_nodemeta.cpp
  318. convert_json.cpp
  319. craftdef.cpp
  320. debug.cpp
  321. defaultsettings.cpp
  322. emerge.cpp
  323. environment.cpp
  324. face_position_cache.cpp
  325. filesys.cpp
  326. gettext.cpp
  327. httpfetch.cpp
  328. hud.cpp
  329. inventory.cpp
  330. inventorymanager.cpp
  331. itemdef.cpp
  332. itemstackmetadata.cpp
  333. light.cpp
  334. lighting.cpp
  335. log.cpp
  336. main.cpp
  337. map.cpp
  338. map_settings_manager.cpp
  339. mapblock.cpp
  340. mapnode.cpp
  341. mapsector.cpp
  342. metadata.cpp
  343. modchannels.cpp
  344. nameidmapping.cpp
  345. nodedef.cpp
  346. nodemetadata.cpp
  347. nodetimer.cpp
  348. noise.cpp
  349. objdef.cpp
  350. object_properties.cpp
  351. particles.cpp
  352. pathfinder.cpp
  353. player.cpp
  354. porting.cpp
  355. profiler.cpp
  356. raycast.cpp
  357. reflowscan.cpp
  358. remoteplayer.cpp
  359. rollback_interface.cpp
  360. serialization.cpp
  361. server.cpp
  362. serverenvironment.cpp
  363. servermap.cpp
  364. settings.cpp
  365. staticobject.cpp
  366. terminal_chat_console.cpp
  367. texture_override.cpp
  368. tileanimation.cpp
  369. tool.cpp
  370. translation.cpp
  371. version.cpp
  372. voxel.cpp
  373. voxelalgorithms.cpp
  374. hud.cpp
  375. ${common_network_SRCS}
  376. ${JTHREAD_SRCS}
  377. ${common_SCRIPT_SRCS}
  378. ${UTIL_SRCS}
  379. )
  380. if(ANDROID)
  381. set(common_SRCS ${common_SRCS} porting_android.cpp)
  382. endif()
  383. if(BUILD_UNITTESTS)
  384. set(common_SRCS ${common_SRCS} ${UNITTEST_SRCS})
  385. endif()
  386. if(BUILD_BENCHMARKS)
  387. set(common_SRCS ${common_SRCS} ${BENCHMARK_SRCS})
  388. endif()
  389. # This gives us the icon and file version information
  390. if(WIN32)
  391. set(WINRESOURCE_FILE "${CMAKE_CURRENT_SOURCE_DIR}/../misc/winresource.rc")
  392. set(MINETEST_EXE_MANIFEST_FILE "${CMAKE_CURRENT_SOURCE_DIR}/../misc/minetest.exe.manifest")
  393. if(MINGW)
  394. if(NOT CMAKE_RC_COMPILER)
  395. set(CMAKE_RC_COMPILER "windres.exe")
  396. endif()
  397. ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/winresource_rc.o
  398. COMMAND ${CMAKE_RC_COMPILER} -I${CMAKE_CURRENT_SOURCE_DIR} -I${CMAKE_CURRENT_BINARY_DIR}
  399. -i${WINRESOURCE_FILE}
  400. -o ${CMAKE_CURRENT_BINARY_DIR}/winresource_rc.o
  401. WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
  402. DEPENDS ${WINRESOURCE_FILE} ${MINETEST_EXE_MANIFEST_FILE})
  403. SET(extra_windows_SRCS ${CMAKE_CURRENT_BINARY_DIR}/winresource_rc.o)
  404. else(MINGW) # Probably MSVC
  405. set(extra_windows_SRCS ${WINRESOURCE_FILE} ${MINETEST_EXE_MANIFEST_FILE})
  406. endif(MINGW)
  407. endif()
  408. # Client sources
  409. if (BUILD_CLIENT)
  410. add_subdirectory(client)
  411. endif(BUILD_CLIENT)
  412. set(client_SRCS
  413. ${client_SRCS}
  414. ${common_SRCS}
  415. ${gui_SRCS}
  416. ${client_network_SRCS}
  417. ${client_irrlicht_changes_SRCS}
  418. ${client_SCRIPT_SRCS}
  419. )
  420. if(BUILD_UNITTESTS)
  421. set(client_SRCS ${client_SRCS} ${UNITTEST_CLIENT_SRCS})
  422. endif()
  423. if(BUILD_BENCHMARKS)
  424. set(client_SRCS ${client_SRCS} ${BENCHMARK_CLIENT_SRCS})
  425. endif()
  426. list(SORT client_SRCS)
  427. # Server sources
  428. set(server_SRCS
  429. ${common_SRCS}
  430. )
  431. list(SORT server_SRCS)
  432. # Avoid source_group on broken CMake version.
  433. # see issue #7074 #7075
  434. if (CMAKE_VERSION VERSION_GREATER 3.8.1)
  435. source_group(TREE ${PROJECT_SOURCE_DIR} PREFIX "Source Files" FILES ${client_SRCS})
  436. source_group(TREE ${PROJECT_SOURCE_DIR} PREFIX "Source Files" FILES ${server_SRCS})
  437. endif()
  438. include_directories(
  439. ${PROJECT_BINARY_DIR}
  440. ${PROJECT_SOURCE_DIR}
  441. ${PROJECT_SOURCE_DIR}/script
  442. )
  443. include_directories(SYSTEM
  444. ${ZLIB_INCLUDE_DIR}
  445. ${ZSTD_INCLUDE_DIR}
  446. ${SQLITE3_INCLUDE_DIR}
  447. ${LUA_INCLUDE_DIR}
  448. ${GMP_INCLUDE_DIR}
  449. ${JSON_INCLUDE_DIR}
  450. ${LUA_BIT_INCLUDE_DIR}
  451. # on Android, Minetest depends on SDL2 directly
  452. # on other platforms, only IrrlichtMt depends on SDL2
  453. "$<$<PLATFORM_ID:Android>:${SDL2_INCLUDE_DIRS}>"
  454. )
  455. if(USE_GETTEXT)
  456. include_directories(${GETTEXT_INCLUDE_DIR})
  457. endif()
  458. if(BUILD_CLIENT)
  459. include_directories(SYSTEM
  460. ${FREETYPE_INCLUDE_DIRS}
  461. ${SOUND_INCLUDE_DIRS}
  462. )
  463. endif()
  464. if(USE_CURL)
  465. include_directories(${CURL_INCLUDE_DIR})
  466. endif()
  467. # When cross-compiling assume the user doesn't want to run the executable anyway,
  468. # otherwise place it in <source dir>/bin/ since Minetest can only run from there.
  469. if(NOT CMAKE_CROSSCOMPILING)
  470. set(EXECUTABLE_OUTPUT_PATH "${CMAKE_SOURCE_DIR}/bin")
  471. endif()
  472. if(BUILD_CLIENT)
  473. if(ANDROID)
  474. add_library(${PROJECT_NAME} SHARED ${client_SRCS})
  475. else()
  476. add_executable(${PROJECT_NAME} ${client_SRCS} ${extra_windows_SRCS})
  477. endif()
  478. add_dependencies(${PROJECT_NAME} GenerateVersion)
  479. target_link_libraries(
  480. ${PROJECT_NAME}
  481. ${ZLIB_LIBRARIES}
  482. IrrlichtMt::IrrlichtMt
  483. ${ZSTD_LIBRARY}
  484. ${SOUND_LIBRARIES}
  485. ${SQLITE3_LIBRARY}
  486. ${LUA_LIBRARY}
  487. ${GMP_LIBRARY}
  488. ${JSON_LIBRARY}
  489. ${LUA_BIT_LIBRARY}
  490. ${FREETYPE_LIBRARY}
  491. ${PLATFORM_LIBS}
  492. # on Android, Minetest depends on SDL2 directly
  493. # on other platforms, only IrrlichtMt depends on SDL2
  494. "$<$<PLATFORM_ID:Android>:${SDL2_LIBRARIES}>"
  495. )
  496. if(NOT USE_LUAJIT)
  497. set_target_properties(${PROJECT_NAME} PROPERTIES
  498. # This is necessary for dynamic Lua modules
  499. # to work when Lua is statically linked (issue #10806)
  500. ENABLE_EXPORTS 1
  501. )
  502. endif()
  503. if(USE_GETTEXT)
  504. target_link_libraries(
  505. ${PROJECT_NAME}
  506. ${GETTEXT_LIBRARY}
  507. )
  508. endif()
  509. if(USE_CURL)
  510. target_link_libraries(
  511. ${PROJECT_NAME}
  512. ${CURL_LIBRARY}
  513. )
  514. endif()
  515. if(FREETYPE_PKGCONFIG_FOUND)
  516. set_target_properties(${PROJECT_NAME}
  517. PROPERTIES
  518. COMPILE_FLAGS "${FREETYPE_CFLAGS_STR}"
  519. )
  520. endif()
  521. if (USE_CURSES)
  522. target_link_libraries(${PROJECT_NAME} ${CURSES_LIBRARIES})
  523. endif()
  524. if (USE_POSTGRESQL)
  525. target_link_libraries(${PROJECT_NAME} ${PostgreSQL_LIBRARIES})
  526. endif()
  527. if (USE_LEVELDB)
  528. target_link_libraries(${PROJECT_NAME} ${LEVELDB_LIBRARY})
  529. endif()
  530. if (USE_REDIS)
  531. target_link_libraries(${PROJECT_NAME} ${REDIS_LIBRARY})
  532. endif()
  533. if (USE_PROMETHEUS)
  534. target_link_libraries(${PROJECT_NAME} ${PROMETHEUS_LIBRARIES})
  535. endif()
  536. if (USE_SPATIAL)
  537. target_link_libraries(${PROJECT_NAME} ${SPATIAL_LIBRARY})
  538. endif()
  539. if(BUILD_BENCHMARKS)
  540. target_link_libraries(${PROJECT_NAME} catch2)
  541. endif()
  542. endif(BUILD_CLIENT)
  543. if(BUILD_SERVER)
  544. add_executable(${PROJECT_NAME}server ${server_SRCS} ${extra_windows_SRCS})
  545. add_dependencies(${PROJECT_NAME}server GenerateVersion)
  546. get_target_property(
  547. IRRLICHT_INCLUDES IrrlichtMt::IrrlichtMt INTERFACE_INCLUDE_DIRECTORIES)
  548. # Doesn't work without PRIVATE/PUBLIC/INTERFACE mode specified.
  549. target_include_directories(${PROJECT_NAME}server PRIVATE ${IRRLICHT_INCLUDES})
  550. target_link_libraries(
  551. ${PROJECT_NAME}server
  552. ${ZLIB_LIBRARIES}
  553. ${ZSTD_LIBRARY}
  554. ${SQLITE3_LIBRARY}
  555. ${JSON_LIBRARY}
  556. ${LUA_LIBRARY}
  557. ${LUA_BIT_LIBRARY}
  558. ${GMP_LIBRARY}
  559. ${PLATFORM_LIBS}
  560. )
  561. set_target_properties(${PROJECT_NAME}server PROPERTIES
  562. COMPILE_DEFINITIONS "SERVER")
  563. if(NOT USE_LUAJIT)
  564. set_target_properties(${PROJECT_NAME}server PROPERTIES
  565. # This is necessary for dynamic Lua modules
  566. # to work when Lua is statically linked (issue #10806)
  567. ENABLE_EXPORTS 1
  568. )
  569. endif()
  570. if (USE_GETTEXT)
  571. target_link_libraries(${PROJECT_NAME}server ${GETTEXT_LIBRARY})
  572. endif()
  573. if (USE_CURSES)
  574. target_link_libraries(${PROJECT_NAME}server ${CURSES_LIBRARIES})
  575. endif()
  576. if (USE_POSTGRESQL)
  577. target_link_libraries(${PROJECT_NAME}server ${PostgreSQL_LIBRARIES})
  578. endif()
  579. if (USE_LEVELDB)
  580. target_link_libraries(${PROJECT_NAME}server ${LEVELDB_LIBRARY})
  581. endif()
  582. if (USE_REDIS)
  583. target_link_libraries(${PROJECT_NAME}server ${REDIS_LIBRARY})
  584. endif()
  585. if (USE_PROMETHEUS)
  586. target_link_libraries(${PROJECT_NAME}server ${PROMETHEUS_LIBRARIES})
  587. endif()
  588. if (USE_SPATIAL)
  589. target_link_libraries(${PROJECT_NAME}server ${SPATIAL_LIBRARY})
  590. endif()
  591. if(USE_CURL)
  592. target_link_libraries(
  593. ${PROJECT_NAME}server
  594. ${CURL_LIBRARY}
  595. )
  596. endif()
  597. if(BUILD_BENCHMARKS)
  598. target_link_libraries(${PROJECT_NAME}server catch2)
  599. endif()
  600. endif(BUILD_SERVER)
  601. # See issue #4638
  602. FILE(READ "${CMAKE_SOURCE_DIR}/src/unsupported_language_list.txt" GETTEXT_BLACKLISTED_LOCALES)
  603. STRING(REGEX REPLACE "\n" ";" GETTEXT_BLACKLISTED_LOCALES "${GETTEXT_BLACKLISTED_LOCALES}")
  604. option(APPLY_LOCALE_BLACKLIST "Use a blacklist to avoid known broken locales" TRUE)
  605. if (GETTEXTLIB_FOUND AND APPLY_LOCALE_BLACKLIST)
  606. set(GETTEXT_USED_LOCALES "")
  607. foreach(LOCALE ${GETTEXT_AVAILABLE_LOCALES})
  608. if (NOT "${LOCALE}" IN_LIST GETTEXT_BLACKLISTED_LOCALES)
  609. list(APPEND GETTEXT_USED_LOCALES ${LOCALE})
  610. endif()
  611. endforeach()
  612. message(STATUS "Locale blacklist applied; Locales used: ${GETTEXT_USED_LOCALES}")
  613. elseif (GETTEXTLIB_FOUND)
  614. set(GETTEXT_USED_LOCALES ${GETTEXT_AVAILABLE_LOCALES})
  615. endif()
  616. # Set some optimizations and tweaks
  617. include(CheckCSourceCompiles)
  618. set(CMAKE_REQUIRED_INCLUDES ${LUA_INCLUDE_DIR})
  619. if(USE_LUAJIT)
  620. # libm usually required if statically linking
  621. set(CMAKE_REQUIRED_LIBRARIES ${LUA_LIBRARY} m)
  622. # LuaJIT provides exactly zero ways to determine how recent it is (the version
  623. # is unchanged since 2017), however it happens that string buffers were added
  624. # after the changes which we care about so that works as an indicator.
  625. # (https://github.com/LuaJIT/LuaJIT/commit/4c6b669 March 2021)
  626. # Note: This is no longer true as of August 2023, but we're keeping the old check.
  627. unset(HAVE_RECENT_LJ CACHE)
  628. check_symbol_exists(luaopen_string_buffer "lualib.h" HAVE_RECENT_LJ)
  629. if(NOT HAVE_RECENT_LJ)
  630. string(CONCAT explanation_msg
  631. "You are using a relatively old version of LuaJIT. We recommend "
  632. "running a recent version (from git) as older ones are known not "
  633. "to build/work correctly in all cases.\n"
  634. "THIS APPLIES ESPECIALLY ON macOS OR Linux/aarch64!")
  635. message(WARNING ${explanation_msg})
  636. endif()
  637. elseif(NOT MSVC)
  638. set(CMAKE_REQUIRED_LIBRARIES "")
  639. unset(HAVE_ATCCALL CACHE)
  640. # Note: we need to check the function without having the library
  641. # available for linking, so check_symbol_exists won't work.
  642. # Incidentally this doesn't seem to work on MSVC...
  643. check_c_source_compiles("#include <lua.h>\nint main(){return sizeof(lua_atccall);}" HAVE_ATCCALL)
  644. if(NOT HAVE_ATCCALL)
  645. string(CONCAT explanation_msg
  646. "It looks like you're trying to build Minetest using a system-wide "
  647. "Lua installation. This is no longer supported because PUC Lua "
  648. "cannot interoperate with C++ correctly. Read src/unittest/test_lua.cpp "
  649. " for technical details.")
  650. message(FATAL_ERROR ${explanation_msg})
  651. endif()
  652. endif()
  653. if(MSVC)
  654. # Visual Studio
  655. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D _WIN32_WINNT=0x0601 /D WIN32_LEAN_AND_MEAN")
  656. # EHa enables SEH exceptions (used for catching segfaults)
  657. set(CMAKE_CXX_FLAGS_RELEASE "/EHa /Ox /MD /GS- /Zi /fp:fast /D NDEBUG /D _HAS_ITERATOR_DEBUGGING=0")
  658. if(CMAKE_SIZEOF_VOID_P EQUAL 4)
  659. set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /arch:SSE")
  660. endif()
  661. set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/INCREMENTAL:NO /DEBUG /OPT:REF /OPT:ICF /SUBSYSTEM:WINDOWS /ENTRY:mainCRTStartup")
  662. set(CMAKE_CXX_FLAGS_SEMIDEBUG "/MDd /Zi /Ob0 /O1 /RTC1")
  663. # Debug build doesn't catch exceptions by itself
  664. # Add some optimizations because otherwise it's VERY slow
  665. set(CMAKE_CXX_FLAGS_DEBUG "/MDd /Zi /Ob0 /Od /RTC1")
  666. # Flags for C files (sqlite)
  667. # /MD = dynamically link to MSVCRxxx.dll
  668. set(CMAKE_C_FLAGS_RELEASE "/O2 /Ob2 /MD")
  669. # Flags that cannot be shared between cl and clang-cl
  670. # https://clang.llvm.org/docs/UsersManual.html#clang-cl
  671. if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
  672. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fuse-ld=lld")
  673. # Disable pragma-pack warning
  674. set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wno-pragma-pack")
  675. else()
  676. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
  677. set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /TP /FD /GL")
  678. set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG")
  679. endif()
  680. else()
  681. # GCC or compatible compilers such as Clang
  682. set(WARNING_FLAGS "-Wall -Wextra")
  683. set(WARNING_FLAGS "${WARNING_FLAGS} -Wno-unused-parameter")
  684. if(WARN_ALL)
  685. set(RELEASE_WARNING_FLAGS "${WARNING_FLAGS}")
  686. else()
  687. set(RELEASE_WARNING_FLAGS "")
  688. endif()
  689. if(MINGW)
  690. if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
  691. set(OTHER_FLAGS "${OTHER_FLAGS} -mthreads")
  692. endif()
  693. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_WIN32_WINNT=0x0601 -DWIN32_LEAN_AND_MEAN")
  694. endif()
  695. # Use a safe subset of flags to speed up math calculations:
  696. # - we don't need errno or math exceptions
  697. # - we don't deal with signed zero
  698. set(MATH_FLAGS "-fno-math-errno -fno-trapping-math -fno-signed-zeros")
  699. # Enable SSE for floating point math on 32-bit x86 by default
  700. # reasoning see minetest issue #11810 and https://gcc.gnu.org/wiki/FloatingPointMath
  701. if(CMAKE_SIZEOF_VOID_P EQUAL 4)
  702. check_c_source_compiles("#ifndef __i686__\n#error\n#endif\nint main(){}" IS_I686)
  703. if(IS_I686)
  704. message(STATUS "Detected Intel x86: using SSE instead of x87 FPU")
  705. set(OTHER_FLAGS "${OTHER_FLAGS} -mfpmath=sse -msse")
  706. endif()
  707. endif()
  708. set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG ${RELEASE_WARNING_FLAGS} ${OTHER_FLAGS} -pipe -funroll-loops -O3 -fomit-frame-pointer")
  709. if(CMAKE_SYSTEM_NAME STREQUAL "Linux"
  710. AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang"
  711. AND CMAKE_CXX_COMPILER_VERSION MATCHES "^9\\.")
  712. # Clang 9 has broken -ffast-math on glibc
  713. else()
  714. set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${MATH_FLAGS}")
  715. endif()
  716. set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELEASE} -g")
  717. set(CMAKE_CXX_FLAGS_SEMIDEBUG "-g -O1 ${WARNING_FLAGS} ${OTHER_FLAGS}")
  718. set(CMAKE_CXX_FLAGS_DEBUG "-g -O0 ${WARNING_FLAGS} ${OTHER_FLAGS}")
  719. if(UNIX)
  720. # enable assertions for libstdc++ or libc++
  721. set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wp,-D_GLIBCXX_ASSERTIONS -Wp,-D_LIBCPP_ENABLE_ASSERTIONS=1")
  722. endif()
  723. if(USE_GPROF)
  724. set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -pg")
  725. endif()
  726. if(MINGW)
  727. set(CMAKE_EXE_LINKER_FLAGS_RELEASE "-mwindows")
  728. endif()
  729. endif()
  730. # Installation
  731. if(WIN32)
  732. if(EXTRA_DLL)
  733. install(FILES ${EXTRA_DLL} DESTINATION ${BINDIR})
  734. endif()
  735. if(VCPKG_APPLOCAL_DEPS)
  736. # Collect the dll's from the output path
  737. install(DIRECTORY ${EXECUTABLE_OUTPUT_PATH}/Release/
  738. DESTINATION ${BINDIR}
  739. CONFIGURATIONS Release
  740. FILES_MATCHING PATTERN "*.dll")
  741. install(DIRECTORY ${EXECUTABLE_OUTPUT_PATH}/Debug/
  742. DESTINATION ${BINDIR}
  743. CONFIGURATIONS Debug
  744. FILES_MATCHING PATTERN "*.dll")
  745. install(DIRECTORY ${EXECUTABLE_OUTPUT_PATH}/RelWithDebInfo/
  746. DESTINATION ${BINDIR}
  747. CONFIGURATIONS RelWithDebInfo
  748. FILES_MATCHING PATTERN "*.dll")
  749. install(DIRECTORY ${EXECUTABLE_OUTPUT_PATH}/MinSizeRel/
  750. DESTINATION ${BINDIR}
  751. CONFIGURATIONS MinSizeRel
  752. FILES_MATCHING PATTERN "*.dll")
  753. else()
  754. # Use the old-style way to install dll's
  755. if(BUILD_CLIENT AND USE_SOUND)
  756. if(OPENAL_DLL)
  757. install(FILES ${OPENAL_DLL} DESTINATION ${BINDIR})
  758. endif()
  759. if(OGG_DLL)
  760. install(FILES ${OGG_DLL} DESTINATION ${BINDIR})
  761. endif()
  762. if(VORBIS_DLL)
  763. install(FILES ${VORBIS_DLL} DESTINATION ${BINDIR})
  764. endif()
  765. endif()
  766. if(BUILD_CLIENT)
  767. if(PNG_DLL)
  768. install(FILES ${PNG_DLL} DESTINATION ${BINDIR})
  769. endif()
  770. if(JPEG_DLL)
  771. install(FILES ${JPEG_DLL} DESTINATION ${BINDIR})
  772. endif()
  773. if(SDL2_DLL)
  774. install(FILES ${SDL2_DLL} DESTINATION ${BINDIR})
  775. endif()
  776. if(FREETYPE_DLL)
  777. install(FILES ${FREETYPE_DLL} DESTINATION ${BINDIR})
  778. endif()
  779. endif()
  780. if(CURL_DLL)
  781. install(FILES ${CURL_DLL} DESTINATION ${BINDIR})
  782. endif()
  783. if(ZLIB_DLL)
  784. install(FILES ${ZLIB_DLL} DESTINATION ${BINDIR})
  785. endif()
  786. if(ZSTD_DLL)
  787. install(FILES ${ZSTD_DLL} DESTINATION ${BINDIR})
  788. endif()
  789. if(SQLITE3_DLL)
  790. install(FILES ${SQLITE3_DLL} DESTINATION ${BINDIR})
  791. endif()
  792. if(LEVELDB_DLL)
  793. install(FILES ${LEVELDB_DLL} DESTINATION ${BINDIR})
  794. endif()
  795. if(LUA_DLL)
  796. install(FILES ${LUA_DLL} DESTINATION ${BINDIR})
  797. endif()
  798. if(BUILD_CLIENT AND USE_GETTEXT AND GETTEXT_DLL)
  799. install(FILES ${GETTEXT_DLL} DESTINATION ${BINDIR})
  800. endif()
  801. endif()
  802. endif()
  803. if(BUILD_CLIENT AND NOT ANDROID)
  804. install(TARGETS ${PROJECT_NAME}
  805. RUNTIME DESTINATION ${BINDIR}
  806. LIBRARY DESTINATION ${BINDIR}
  807. ARCHIVE DESTINATION ${BINDIR}
  808. BUNDLE DESTINATION .
  809. )
  810. if(APPLE)
  811. install(CODE "
  812. set(BU_CHMOD_BUNDLE_ITEMS ON)
  813. include(BundleUtilities)
  814. fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/${BUNDLE_PATH}\" \"\" \"\${CMAKE_INSTALL_PREFIX}/${BINDIR}\")
  815. " COMPONENT Runtime)
  816. endif()
  817. if(USE_GETTEXT)
  818. foreach(LOCALE ${GETTEXT_USED_LOCALES})
  819. set_mo_paths(MO_BUILD_PATH MO_DEST_PATH ${LOCALE})
  820. set(MO_BUILD_PATH "${MO_BUILD_PATH}/${PROJECT_NAME}.mo")
  821. install(FILES ${MO_BUILD_PATH} DESTINATION ${MO_DEST_PATH})
  822. endforeach()
  823. endif()
  824. install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../fonts" DESTINATION "${SHAREDIR}"
  825. FILES_MATCHING PATTERN "*.ttf" PATTERN "*.txt")
  826. endif()
  827. if(BUILD_SERVER)
  828. install(TARGETS ${PROJECT_NAME}server DESTINATION ${BINDIR})
  829. endif()
  830. if (ANDROID)
  831. # Android does this manually in app/build.gradle -> prepareAssets
  832. # for now!
  833. elseif (USE_GETTEXT)
  834. set(MO_FILES)
  835. foreach(LOCALE ${GETTEXT_USED_LOCALES})
  836. set(PO_FILE_PATH "${GETTEXT_PO_PATH}/${LOCALE}/${PROJECT_NAME}.po")
  837. set_mo_paths(MO_BUILD_PATH MO_DEST_PATH ${LOCALE})
  838. set(MO_FILE_PATH "${MO_BUILD_PATH}/${PROJECT_NAME}.mo")
  839. add_custom_command(OUTPUT ${MO_BUILD_PATH}
  840. COMMAND ${CMAKE_COMMAND} -E make_directory ${MO_BUILD_PATH}
  841. COMMENT "mo-update [${LOCALE}]: Creating locale directory.")
  842. add_custom_command(
  843. OUTPUT ${MO_FILE_PATH}
  844. COMMAND ${GETTEXT_MSGFMT} -o ${MO_FILE_PATH} ${PO_FILE_PATH}
  845. DEPENDS ${MO_BUILD_PATH} ${PO_FILE_PATH}
  846. WORKING_DIRECTORY "${GETTEXT_PO_PATH}/${LOCALE}"
  847. COMMENT "mo-update [${LOCALE}]: Creating mo file."
  848. )
  849. set(MO_FILES ${MO_FILES} ${MO_FILE_PATH})
  850. endforeach()
  851. add_custom_target(translations ALL COMMENT "mo update" DEPENDS ${MO_FILES})
  852. endif()