mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
CMake: Remove the code for old CMake versions
This commit is contained in:
parent
f6172a2ec4
commit
0cea5b0120
|
@ -132,17 +132,13 @@ endif()
|
|||
set(DBG $<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>)
|
||||
|
||||
if(IPO)
|
||||
if(CMAKE_VERSION VERSION_GREATER 3.9)
|
||||
include(CheckIPOSupported)
|
||||
check_ipo_supported(RESULT ipo_supported OUTPUT ipo_output)
|
||||
if(ipo_supported)
|
||||
message(STATUS "IPO is enabled")
|
||||
set(ENABLE_IPO TRUE)
|
||||
else()
|
||||
message(WARNING "IPO is not supported: ${ipo_output}")
|
||||
endif()
|
||||
include(CheckIPOSupported)
|
||||
check_ipo_supported(RESULT ipo_supported OUTPUT ipo_output)
|
||||
if(ipo_supported)
|
||||
message(STATUS "IPO is enabled")
|
||||
set(ENABLE_IPO TRUE)
|
||||
else()
|
||||
message(WARNING "IPO enablement requires CMake 3.9+")
|
||||
message(WARNING "IPO is not supported: ${ipo_output}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
@ -263,7 +259,7 @@ if(NOT MSVC AND NOT HAIKU)
|
|||
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)
|
||||
endif()
|
||||
|
||||
|
@ -303,12 +299,10 @@ if(NOT MSVC AND NOT HAIKU)
|
|||
endif()
|
||||
|
||||
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
|
||||
$<$<COMPILE_LANGUAGE:C>:-Wdeclaration-after-statement>
|
||||
-Wdeclaration-after-statement
|
||||
)
|
||||
endif()
|
||||
add_cxx_compiler_flag_if_supported(OUR_FLAGS_OWN
|
||||
$<$<COMPILE_LANGUAGE:C>:-Wdeclaration-after-statement>
|
||||
-Wdeclaration-after-statement
|
||||
)
|
||||
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-unused-parameter)
|
||||
|
@ -360,28 +354,25 @@ function(set_glob VAR GLOBBING EXTS DIRECTORY) # ...
|
|||
if(NOT FILES STREQUAL GLOB_RESULT)
|
||||
message(AUTHOR_WARNING "${VAR} does not contain every file from directory ${DIRECTORY}")
|
||||
set(LIST_BUT_NOT_GLOB)
|
||||
if(POLICY CMP0057)
|
||||
cmake_policy(SET CMP0057 NEW)
|
||||
foreach(file ${FILES})
|
||||
if(NOT file IN_LIST GLOB_RESULT)
|
||||
list(APPEND LIST_BUT_NOT_GLOB ${file})
|
||||
endif()
|
||||
endforeach()
|
||||
if(LIST_BUT_NOT_GLOB)
|
||||
message(AUTHOR_WARNING "Entries only present in ${VAR}: ${LIST_BUT_NOT_GLOB}")
|
||||
foreach(file ${FILES})
|
||||
if(NOT file IN_LIST GLOB_RESULT)
|
||||
list(APPEND LIST_BUT_NOT_GLOB ${file})
|
||||
endif()
|
||||
set(GLOB_BUT_NOT_LIST)
|
||||
foreach(file ${GLOB_RESULT})
|
||||
if(NOT file IN_LIST FILES)
|
||||
list(APPEND GLOB_BUT_NOT_LIST ${file})
|
||||
endif()
|
||||
endforeach()
|
||||
if(GLOB_BUT_NOT_LIST)
|
||||
message(AUTHOR_WARNING "Entries only present in ${DIRECTORY}: ${GLOB_BUT_NOT_LIST}")
|
||||
endif()
|
||||
if(NOT LIST_BUT_NOT_GLOB AND NOT GLOB_BUT_NOT_LIST)
|
||||
message(AUTHOR_WARNING "${VAR} is not alphabetically sorted")
|
||||
endforeach()
|
||||
if(LIST_BUT_NOT_GLOB)
|
||||
message(AUTHOR_WARNING "Entries only present in ${VAR}: ${LIST_BUT_NOT_GLOB}")
|
||||
endif()
|
||||
set(GLOB_BUT_NOT_LIST)
|
||||
foreach(file ${GLOB_RESULT})
|
||||
if(NOT file IN_LIST FILES)
|
||||
list(APPEND GLOB_BUT_NOT_LIST ${file})
|
||||
endif()
|
||||
endforeach()
|
||||
if(GLOB_BUT_NOT_LIST)
|
||||
message(AUTHOR_WARNING "Entries only present in ${DIRECTORY}: ${GLOB_BUT_NOT_LIST}")
|
||||
endif()
|
||||
if(NOT LIST_BUT_NOT_GLOB AND NOT GLOB_BUT_NOT_LIST)
|
||||
message(AUTHOR_WARNING "${VAR} is not alphabetically sorted")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
@ -397,19 +388,11 @@ set(CHECKSUM_SRC)
|
|||
|
||||
function(set_own_rpath TARGET)
|
||||
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")
|
||||
endif()
|
||||
set_property(TARGET ${TARGET} PROPERTY BUILD_RPATH "$ORIGIN")
|
||||
set_property(TARGET ${TARGET} PROPERTY INSTALL_RPATH "$ORIGIN/../lib/ddnet")
|
||||
endif()
|
||||
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
|
||||
########################################################################
|
||||
|
@ -807,9 +790,6 @@ if(NOT(GTEST_FOUND) AND DOWNLOAD_GTEST)
|
|||
|
||||
set(GTEST_LIBRARIES gtest gmock)
|
||||
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()
|
||||
|
@ -3064,8 +3044,6 @@ endif()
|
|||
|
||||
if(DEV)
|
||||
# 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()
|
||||
set(EXTRA_ARGS DESTINATION ${CPACK_PACKAGE_FILE_NAME} COMPONENT portable EXCLUDE_FROM_ALL)
|
||||
install(TARGETS ${CPACK_TARGETS} ${EXTRA_ARGS})
|
||||
|
@ -3295,11 +3273,9 @@ foreach(target ${TARGETS_LINK})
|
|||
endforeach()
|
||||
|
||||
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_REQUIRED ON)
|
||||
set_property(TARGET ${target} PROPERTY CXX_EXTENSIONS OFF)
|
||||
endif()
|
||||
set_property(TARGET ${target} PROPERTY CXX_STANDARD 17)
|
||||
set_property(TARGET ${target} PROPERTY CXX_STANDARD_REQUIRED ON)
|
||||
set_property(TARGET ${target} PROPERTY CXX_EXTENSIONS OFF)
|
||||
|
||||
if(MSVC)
|
||||
target_compile_options(${target} PRIVATE /wd4244) # Possible loss of data (float -> int, int -> float, etc.).
|
||||
|
|
Loading…
Reference in a new issue