mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-14 12:08:20 +00:00
CMake: Remove the code for old CMake versions
This commit is contained in:
parent
f6172a2ec4
commit
0cea5b0120
|
@ -132,7 +132,6 @@ endif()
|
||||||
set(DBG $<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>)
|
set(DBG $<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>)
|
||||||
|
|
||||||
if(IPO)
|
if(IPO)
|
||||||
if(CMAKE_VERSION VERSION_GREATER 3.9)
|
|
||||||
include(CheckIPOSupported)
|
include(CheckIPOSupported)
|
||||||
check_ipo_supported(RESULT ipo_supported OUTPUT ipo_output)
|
check_ipo_supported(RESULT ipo_supported OUTPUT ipo_output)
|
||||||
if(ipo_supported)
|
if(ipo_supported)
|
||||||
|
@ -141,9 +140,6 @@ if(IPO)
|
||||||
else()
|
else()
|
||||||
message(WARNING "IPO is not supported: ${ipo_output}")
|
message(WARNING "IPO is not supported: ${ipo_output}")
|
||||||
endif()
|
endif()
|
||||||
else()
|
|
||||||
message(WARNING "IPO enablement requires CMake 3.9+")
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if("0${PROJECT_VERSION_PATCH}" GREATER 9)
|
if("0${PROJECT_VERSION_PATCH}" GREATER 9)
|
||||||
|
@ -263,7 +259,7 @@ if(NOT MSVC AND NOT HAIKU)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CMAKE_VERSION VERSION_LESS 3.1 OR TARGET_OS STREQUAL "mac")
|
if(TARGET_OS STREQUAL "mac")
|
||||||
add_cxx_compiler_flag_if_supported(OUR_FLAGS_OWN -std=gnu++17)
|
add_cxx_compiler_flag_if_supported(OUR_FLAGS_OWN -std=gnu++17)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -303,12 +299,10 @@ if(NOT MSVC AND NOT HAIKU)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_cxx_compiler_flag_if_supported(OUR_FLAGS_OWN -Wall)
|
add_cxx_compiler_flag_if_supported(OUR_FLAGS_OWN -Wall)
|
||||||
if(CMAKE_VERSION VERSION_GREATER 3.3 OR CMAKE_VERSION VERSION_EQUAL 3.3)
|
|
||||||
add_cxx_compiler_flag_if_supported(OUR_FLAGS_OWN
|
add_cxx_compiler_flag_if_supported(OUR_FLAGS_OWN
|
||||||
$<$<COMPILE_LANGUAGE:C>:-Wdeclaration-after-statement>
|
$<$<COMPILE_LANGUAGE:C>:-Wdeclaration-after-statement>
|
||||||
-Wdeclaration-after-statement
|
-Wdeclaration-after-statement
|
||||||
)
|
)
|
||||||
endif()
|
|
||||||
add_cxx_compiler_flag_if_supported(OUR_FLAGS_OWN -Wextra)
|
add_cxx_compiler_flag_if_supported(OUR_FLAGS_OWN -Wextra)
|
||||||
add_cxx_compiler_flag_if_supported(OUR_FLAGS_OWN -Wno-psabi) # parameter passing for argument of type ‘__gnu_cxx::__normal_iterator<CCommandProcessorFragment_Vulkan::SMemoryBlock<1>*, std::vector<CCommandProcessorFragment_Vulkan::SMemoryBlock<1>, std::allocator<CCommandProcessorFragment_Vulkan::SMemoryBlock<1> > > >’ changed in GCC 7.1
|
add_cxx_compiler_flag_if_supported(OUR_FLAGS_OWN -Wno-psabi) # parameter passing for argument of type ‘__gnu_cxx::__normal_iterator<CCommandProcessorFragment_Vulkan::SMemoryBlock<1>*, std::vector<CCommandProcessorFragment_Vulkan::SMemoryBlock<1>, std::allocator<CCommandProcessorFragment_Vulkan::SMemoryBlock<1> > > >’ changed in GCC 7.1
|
||||||
add_cxx_compiler_flag_if_supported(OUR_FLAGS_OWN -Wno-unused-parameter)
|
add_cxx_compiler_flag_if_supported(OUR_FLAGS_OWN -Wno-unused-parameter)
|
||||||
|
@ -360,8 +354,6 @@ function(set_glob VAR GLOBBING EXTS DIRECTORY) # ...
|
||||||
if(NOT FILES STREQUAL GLOB_RESULT)
|
if(NOT FILES STREQUAL GLOB_RESULT)
|
||||||
message(AUTHOR_WARNING "${VAR} does not contain every file from directory ${DIRECTORY}")
|
message(AUTHOR_WARNING "${VAR} does not contain every file from directory ${DIRECTORY}")
|
||||||
set(LIST_BUT_NOT_GLOB)
|
set(LIST_BUT_NOT_GLOB)
|
||||||
if(POLICY CMP0057)
|
|
||||||
cmake_policy(SET CMP0057 NEW)
|
|
||||||
foreach(file ${FILES})
|
foreach(file ${FILES})
|
||||||
if(NOT file IN_LIST GLOB_RESULT)
|
if(NOT file IN_LIST GLOB_RESULT)
|
||||||
list(APPEND LIST_BUT_NOT_GLOB ${file})
|
list(APPEND LIST_BUT_NOT_GLOB ${file})
|
||||||
|
@ -383,7 +375,6 @@ function(set_glob VAR GLOBBING EXTS DIRECTORY) # ...
|
||||||
message(AUTHOR_WARNING "${VAR} is not alphabetically sorted")
|
message(AUTHOR_WARNING "${VAR} is not alphabetically sorted")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
|
||||||
|
|
||||||
set(${VAR} ${FILES} PARENT_SCOPE)
|
set(${VAR} ${FILES} PARENT_SCOPE)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
@ -397,19 +388,11 @@ set(CHECKSUM_SRC)
|
||||||
|
|
||||||
function(set_own_rpath TARGET)
|
function(set_own_rpath TARGET)
|
||||||
if(NOT TARGET_OS STREQUAL "windows" AND NOT TARGET_OS STREQUAL "mac")
|
if(NOT TARGET_OS STREQUAL "windows" AND NOT TARGET_OS STREQUAL "mac")
|
||||||
if(CMAKE_VERSION VERSION_GREATER 3.8 OR CMAKE_VERSION VERSION_EQUAL 3.8)
|
|
||||||
set_property(TARGET ${TARGET} PROPERTY BUILD_RPATH "$ORIGIN")
|
set_property(TARGET ${TARGET} PROPERTY BUILD_RPATH "$ORIGIN")
|
||||||
endif()
|
|
||||||
set_property(TARGET ${TARGET} PROPERTY INSTALL_RPATH "$ORIGIN/../lib/ddnet")
|
set_property(TARGET ${TARGET} PROPERTY INSTALL_RPATH "$ORIGIN/../lib/ddnet")
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
if(NOT TARGET_OS STREQUAL "windows" AND NOT TARGET_OS STREQUAL "mac" AND CMAKE_VERSION VERSION_LESS 3.8)
|
|
||||||
if((CLIENT AND (STEAM OR DISCORD_DYNAMIC)) OR ANTIBOT)
|
|
||||||
message(STATUS "Can't set BUILD_RPATH in CMake before 3.8, pass -Wl,-rpath,'$ORIGIN' manually if you wish to emulate this. Or just install a newer version of CMake...")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
# INITIALIZE TARGET LISTS
|
# INITIALIZE TARGET LISTS
|
||||||
########################################################################
|
########################################################################
|
||||||
|
@ -807,9 +790,6 @@ if(NOT(GTEST_FOUND) AND DOWNLOAD_GTEST)
|
||||||
|
|
||||||
set(GTEST_LIBRARIES gtest gmock)
|
set(GTEST_LIBRARIES gtest gmock)
|
||||||
set(GTEST_INCLUDE_DIRS)
|
set(GTEST_INCLUDE_DIRS)
|
||||||
if(CMAKE_VERSION VERSION_LESS 2.8.11)
|
|
||||||
set(GTEST_INCLUDE_DIRS "${gtest_SOURCE_DIR}/include" "${gmock_SOURCE_DIR}/include")
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
@ -3064,8 +3044,6 @@ endif()
|
||||||
|
|
||||||
if(DEV)
|
if(DEV)
|
||||||
# Don't generate CPack targets.
|
# Don't generate CPack targets.
|
||||||
elseif(CMAKE_VERSION VERSION_LESS 3.6 OR CMAKE_VERSION VERSION_EQUAL 3.6)
|
|
||||||
message(WARNING "Cannot create CPack targets, CMake version too old. Use CMake 3.6 or newer.")
|
|
||||||
else()
|
else()
|
||||||
set(EXTRA_ARGS DESTINATION ${CPACK_PACKAGE_FILE_NAME} COMPONENT portable EXCLUDE_FROM_ALL)
|
set(EXTRA_ARGS DESTINATION ${CPACK_PACKAGE_FILE_NAME} COMPONENT portable EXCLUDE_FROM_ALL)
|
||||||
install(TARGETS ${CPACK_TARGETS} ${EXTRA_ARGS})
|
install(TARGETS ${CPACK_TARGETS} ${EXTRA_ARGS})
|
||||||
|
@ -3295,11 +3273,9 @@ foreach(target ${TARGETS_LINK})
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
foreach(target ${TARGETS_OWN})
|
foreach(target ${TARGETS_OWN})
|
||||||
if((CMAKE_VERSION VERSION_GREATER 3.1 OR CMAKE_VERSION VERSION_EQUAL 3.1))
|
|
||||||
set_property(TARGET ${target} PROPERTY CXX_STANDARD 17)
|
set_property(TARGET ${target} PROPERTY CXX_STANDARD 17)
|
||||||
set_property(TARGET ${target} PROPERTY CXX_STANDARD_REQUIRED ON)
|
set_property(TARGET ${target} PROPERTY CXX_STANDARD_REQUIRED ON)
|
||||||
set_property(TARGET ${target} PROPERTY CXX_EXTENSIONS OFF)
|
set_property(TARGET ${target} PROPERTY CXX_EXTENSIONS OFF)
|
||||||
endif()
|
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
target_compile_options(${target} PRIVATE /wd4244) # Possible loss of data (float -> int, int -> float, etc.).
|
target_compile_options(${target} PRIVATE /wd4244) # Possible loss of data (float -> int, int -> float, etc.).
|
||||||
|
|
Loading…
Reference in a new issue