Skip to content

Commit

Permalink
Handle changes caused by CMake minimum version bump (#10859)
Browse files Browse the repository at this point in the history
fixes #10806
  • Loading branch information
sfan5 committed Jan 29, 2021
1 parent 5c005ad commit 9c91cbf
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
@@ -1,5 +1,7 @@
cmake_minimum_required(VERSION 3.5)

cmake_policy(SET CMP0025 OLD)

# This can be read from ${PROJECT_NAME} after project() is called
project(minetest)
set(PROJECT_NAME_CAPITALIZED "Minetest")
Expand Down
25 changes: 19 additions & 6 deletions src/CMakeLists.txt
Expand Up @@ -532,7 +532,7 @@ set(EXECUTABLE_OUTPUT_PATH "${CMAKE_SOURCE_DIR}/bin")
if(BUILD_CLIENT)
add_executable(${PROJECT_NAME} ${client_SRCS} ${extra_windows_SRCS})
add_dependencies(${PROJECT_NAME} GenerateVersion)
set(client_LIBS
target_link_libraries(
${PROJECT_NAME}
${ZLIB_LIBRARIES}
${IRRLICHT_LIBRARY}
Expand All @@ -548,9 +548,14 @@ if(BUILD_CLIENT)
${PLATFORM_LIBS}
${CLIENT_PLATFORM_LIBS}
)
target_link_libraries(
${client_LIBS}
)
if(NOT USE_LUAJIT)
set_target_properties(${PROJECT_NAME} PROPERTIES
# This is necessary for dynamic Lua modules
# to work when Lua is statically linked (issue #10806)
ENABLE_EXPORTS 1
)
endif()

if(ENABLE_GLES)
target_link_libraries(
${PROJECT_NAME}
Expand Down Expand Up @@ -621,7 +626,15 @@ if(BUILD_SERVER)
${PLATFORM_LIBS}
)
set_target_properties(${PROJECT_NAME}server PROPERTIES
COMPILE_DEFINITIONS "SERVER")
COMPILE_DEFINITIONS "SERVER")
if(NOT USE_LUAJIT)
set_target_properties(${PROJECT_NAME}server PROPERTIES
# This is necessary for dynamic Lua modules
# to work when Lua is statically linked (issue #10806)
ENABLE_EXPORTS 1
)
endif()

if (USE_GETTEXT)
target_link_libraries(${PROJECT_NAME}server ${GETTEXT_LIBRARY})
endif()
Expand Down Expand Up @@ -666,7 +679,7 @@ option(APPLY_LOCALE_BLACKLIST "Use a blacklist to avoid broken locales" TRUE)
if (GETTEXTLIB_FOUND AND APPLY_LOCALE_BLACKLIST)
set(GETTEXT_USED_LOCALES "")
foreach(LOCALE ${GETTEXT_AVAILABLE_LOCALES})
if (NOT ";${GETTEXT_BLACKLISTED_LOCALES};" MATCHES ";${LOCALE};")
if (NOT "${LOCALE}" IN_LIST GETTEXT_BLACKLISTED_LOCALES)
list(APPEND GETTEXT_USED_LOCALES ${LOCALE})
endif()
endforeach()
Expand Down

0 comments on commit 9c91cbf

Please sign in to comment.