Skip to content

Commit 8fb4555

Browse files
committed
downgrade cpm to v0.40.0
1 parent 4f403b9 commit 8fb4555

File tree

5 files changed

+25
-96
lines changed

5 files changed

+25
-96
lines changed

CMakeLists.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
cmake_minimum_required(VERSION 3.20 FATAL_ERROR)
22

3-
# Disable the CMP0002 policy error by setting it to OLD
4-
if(POLICY CMP0002)
5-
cmake_policy(SET CMP0002 OLD)
6-
endif()
7-
83
project("SpaceCheckers" VERSION 1.0.10
94
HOMEPAGE_URL "https://github.com/Longwater1234/space-checkers")
105

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ This game can connect to both Private and Public game servers. The Server projec
6060

6161
## Building Instructions
6262

63-
Please see [BUILDING.md](BUILDING.md) for detailed instructions. For macOS-specific guide with XCode, please [see this doc](cmake/README.md)
63+
Please see [BUILDING.md](BUILDING.md) for detailed instructions. For macOS-specific guide with XCode, please [cmake/README.md](cmake/README.md)
6464

6565
### License
6666

dependencies/CPM.cmake

Lines changed: 18 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,7 @@ if(NOT COMMAND cpm_message)
4242
endfunction()
4343
endif()
4444

45-
if(DEFINED EXTRACTED_CPM_VERSION)
46-
set(CURRENT_CPM_VERSION "${EXTRACTED_CPM_VERSION}${CPM_DEVELOPMENT}")
47-
else()
48-
set(CURRENT_CPM_VERSION 0.40.8)
49-
endif()
45+
set(CURRENT_CPM_VERSION 0.40.0)
5046

5147
get_filename_component(CPM_CURRENT_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}" REALPATH)
5248
if(CPM_DIRECTORY)
@@ -166,7 +162,7 @@ set(CPM_SOURCE_CACHE
166162
CACHE PATH "Directory to download CPM dependencies"
167163
)
168164

169-
if(NOT CPM_DONT_UPDATE_MODULE_PATH AND NOT DEFINED CMAKE_FIND_PACKAGE_REDIRECTS_DIR)
165+
if(NOT CPM_DONT_UPDATE_MODULE_PATH)
170166
set(CPM_MODULE_PATH
171167
"${CMAKE_BINARY_DIR}/CPM_modules"
172168
CACHE INTERNAL ""
@@ -273,25 +269,10 @@ endfunction()
273269
# finding the system library
274270
function(cpm_create_module_file Name)
275271
if(NOT CPM_DONT_UPDATE_MODULE_PATH)
276-
if(DEFINED CMAKE_FIND_PACKAGE_REDIRECTS_DIR)
277-
# Redirect find_package calls to the CPM package. This is what FetchContent does when you set
278-
# OVERRIDE_FIND_PACKAGE. The CMAKE_FIND_PACKAGE_REDIRECTS_DIR works for find_package in CONFIG
279-
# mode, unlike the Find${Name}.cmake fallback. CMAKE_FIND_PACKAGE_REDIRECTS_DIR is not defined
280-
# in script mode, or in CMake < 3.24.
281-
# https://cmake.org/cmake/help/latest/module/FetchContent.html#fetchcontent-find-package-integration-examples
282-
string(TOLOWER ${Name} NameLower)
283-
file(WRITE ${CMAKE_FIND_PACKAGE_REDIRECTS_DIR}/${NameLower}-config.cmake
284-
"include(\"\${CMAKE_CURRENT_LIST_DIR}/${NameLower}-extra.cmake\" OPTIONAL)\n"
285-
"include(\"\${CMAKE_CURRENT_LIST_DIR}/${Name}Extra.cmake\" OPTIONAL)\n"
286-
)
287-
file(WRITE ${CMAKE_FIND_PACKAGE_REDIRECTS_DIR}/${NameLower}-config-version.cmake
288-
"set(PACKAGE_VERSION_COMPATIBLE TRUE)\n" "set(PACKAGE_VERSION_EXACT TRUE)\n"
289-
)
290-
else()
291-
file(WRITE ${CPM_MODULE_PATH}/Find${Name}.cmake
292-
"include(\"${CPM_FILE}\")\n${ARGN}\nset(${Name}_FOUND TRUE)"
293-
)
294-
endif()
272+
# erase any previous modules
273+
file(WRITE ${CPM_MODULE_PATH}/Find${Name}.cmake
274+
"include(\"${CPM_FILE}\")\n${ARGN}\nset(${Name}_FOUND TRUE)"
275+
)
295276
endif()
296277
endfunction()
297278

@@ -494,18 +475,15 @@ function(cpm_add_patches)
494475

495476
# Find the patch program.
496477
find_program(PATCH_EXECUTABLE patch)
497-
if(CMAKE_HOST_WIN32 AND NOT PATCH_EXECUTABLE)
478+
if(WIN32 AND NOT PATCH_EXECUTABLE)
498479
# The Windows git executable is distributed with patch.exe. Find the path to the executable, if
499-
# it exists, then search `../usr/bin` and `../../usr/bin` for patch.exe.
480+
# it exists, then search `../../usr/bin` for patch.exe.
500481
find_package(Git QUIET)
501482
if(GIT_EXECUTABLE)
502483
get_filename_component(extra_search_path ${GIT_EXECUTABLE} DIRECTORY)
503-
get_filename_component(extra_search_path_1up ${extra_search_path} DIRECTORY)
504-
get_filename_component(extra_search_path_2up ${extra_search_path_1up} DIRECTORY)
505-
find_program(
506-
PATCH_EXECUTABLE patch HINTS "${extra_search_path_1up}/usr/bin"
507-
"${extra_search_path_2up}/usr/bin"
508-
)
484+
get_filename_component(extra_search_path ${extra_search_path} DIRECTORY)
485+
get_filename_component(extra_search_path ${extra_search_path} DIRECTORY)
486+
find_program(PATCH_EXECUTABLE patch HINTS "${extra_search_path}/usr/bin")
509487
endif()
510488
endif()
511489
if(NOT PATCH_EXECUTABLE)
@@ -867,9 +845,7 @@ function(CPMAddPackage)
867845
endif()
868846
endif()
869847

870-
if(NOT "${DOWNLOAD_ONLY}")
871-
cpm_create_module_file(${CPM_ARGS_NAME} "CPMAddPackage(\"${ARGN}\")")
872-
endif()
848+
cpm_create_module_file(${CPM_ARGS_NAME} "CPMAddPackage(\"${ARGN}\")")
873849

874850
if(CPM_PACKAGE_LOCK_ENABLED)
875851
if((CPM_ARGS_VERSION AND NOT CPM_ARGS_SOURCE_DIR) OR CPM_INCLUDE_ALL_IN_PACKAGE_LOCK)
@@ -886,39 +862,14 @@ function(CPMAddPackage)
886862
)
887863

888864
if(NOT CPM_SKIP_FETCH)
889-
# CMake 3.28 added EXCLUDE, SYSTEM (3.25), and SOURCE_SUBDIR (3.18) to FetchContent_Declare.
890-
# Calling FetchContent_MakeAvailable will then internally forward these options to
891-
# add_subdirectory. Up until these changes, we had to call FetchContent_Populate and
892-
# add_subdirectory separately, which is no longer necessary and has been deprecated as of 3.30.
893-
# A Bug in CMake prevents us to use the non-deprecated functions until 3.30.3.
894-
set(fetchContentDeclareExtraArgs "")
895-
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.30.3")
896-
if(${CPM_ARGS_EXCLUDE_FROM_ALL})
897-
list(APPEND fetchContentDeclareExtraArgs EXCLUDE_FROM_ALL)
898-
endif()
899-
if(${CPM_ARGS_SYSTEM})
900-
list(APPEND fetchContentDeclareExtraArgs SYSTEM)
901-
endif()
902-
if(DEFINED CPM_ARGS_SOURCE_SUBDIR)
903-
list(APPEND fetchContentDeclareExtraArgs SOURCE_SUBDIR ${CPM_ARGS_SOURCE_SUBDIR})
904-
endif()
905-
# For CMake version <3.28 OPTIONS are parsed in cpm_add_subdirectory
906-
if(CPM_ARGS_OPTIONS AND NOT DOWNLOAD_ONLY)
907-
foreach(OPTION ${CPM_ARGS_OPTIONS})
908-
cpm_parse_option("${OPTION}")
909-
set(${OPTION_KEY} "${OPTION_VALUE}")
910-
endforeach()
911-
endif()
912-
endif()
913865
cpm_declare_fetch(
914-
"${CPM_ARGS_NAME}" ${fetchContentDeclareExtraArgs} "${CPM_ARGS_UNPARSED_ARGUMENTS}"
866+
"${CPM_ARGS_NAME}" "${CPM_ARGS_VERSION}" "${PACKAGE_INFO}" "${CPM_ARGS_UNPARSED_ARGUMENTS}"
915867
)
916-
917-
cpm_fetch_package("${CPM_ARGS_NAME}" ${DOWNLOAD_ONLY} populated ${CPM_ARGS_UNPARSED_ARGUMENTS})
868+
cpm_fetch_package("${CPM_ARGS_NAME}" populated)
918869
if(CPM_SOURCE_CACHE AND download_directory)
919870
file(LOCK ${download_directory}/../cmake.lock RELEASE)
920871
endif()
921-
if(${populated} AND ${CMAKE_VERSION} VERSION_LESS "3.30.3")
872+
if(${populated})
922873
cpm_add_subdirectory(
923874
"${CPM_ARGS_NAME}"
924875
"${DOWNLOAD_ONLY}"
@@ -1029,7 +980,7 @@ function(CPMGetPackageVersion PACKAGE OUTPUT)
1029980
endfunction()
1030981

1031982
# declares a package in FetchContent_Declare
1032-
function(cpm_declare_fetch PACKAGE)
983+
function(cpm_declare_fetch PACKAGE VERSION INFO)
1033984
if(${CPM_DRY_RUN})
1034985
cpm_message(STATUS "${CPM_INDENT} Package not declared (dry run)")
1035986
return()
@@ -1105,7 +1056,7 @@ endfunction()
11051056

11061057
# downloads a previously declared package via FetchContent and exports the variables
11071058
# `${PACKAGE}_SOURCE_DIR` and `${PACKAGE}_BINARY_DIR` to the parent scope
1108-
function(cpm_fetch_package PACKAGE DOWNLOAD_ONLY populated)
1059+
function(cpm_fetch_package PACKAGE populated)
11091060
set(${populated}
11101061
FALSE
11111062
PARENT_SCOPE
@@ -1120,24 +1071,7 @@ function(cpm_fetch_package PACKAGE DOWNLOAD_ONLY populated)
11201071
string(TOLOWER "${PACKAGE}" lower_case_name)
11211072

11221073
if(NOT ${lower_case_name}_POPULATED)
1123-
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.30.3")
1124-
if(DOWNLOAD_ONLY)
1125-
# MakeAvailable will call add_subdirectory internally which is not what we want when
1126-
# DOWNLOAD_ONLY is set. Populate will only download the dependency without adding it to the
1127-
# build
1128-
FetchContent_Populate(
1129-
${PACKAGE}
1130-
SOURCE_DIR "${CPM_FETCHCONTENT_BASE_DIR}/${lower_case_name}-src"
1131-
BINARY_DIR "${CPM_FETCHCONTENT_BASE_DIR}/${lower_case_name}-build"
1132-
SUBBUILD_DIR "${CPM_FETCHCONTENT_BASE_DIR}/${lower_case_name}-subbuild"
1133-
${ARGN}
1134-
)
1135-
else()
1136-
FetchContent_MakeAvailable(${PACKAGE})
1137-
endif()
1138-
else()
1139-
FetchContent_Populate(${PACKAGE})
1140-
endif()
1074+
FetchContent_Populate(${PACKAGE})
11411075
set(${populated}
11421076
TRUE
11431077
PARENT_SCOPE

dependencies/ixwebsocket.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ if(ixwebsocket_ADDED)
2525
target_link_libraries(ixwebsocket PUBLIC ${CMAKE_THREAD_LIBS_INIT})
2626
endif()
2727

28-
if(TARGET zlibstatic)
28+
if(TARGET zlib)
2929
message(STATUS "ixwebsocket: zlib support enabled")
3030
target_compile_definitions(ixwebsocket PRIVATE IXWEBSOCKET_USE_ZLIB)
31-
target_link_libraries(ixwebsocket PRIVATE zlibstatic)
31+
target_link_libraries(ixwebsocket PRIVATE zlib)
3232
else()
3333
message(STATUS "ixwebsocket: zlib support disabled (include zlib first)")
3434
endif()

dependencies/zlib.cmake

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ CPMAddPackage(
99
)
1010

1111
if(zlib_ADDED)
12-
add_library(zlibstatic STATIC
12+
add_library(zlib STATIC
1313
${zlib_SOURCE_DIR}/adler32.c
1414
${zlib_SOURCE_DIR}/compress.c
1515
${zlib_SOURCE_DIR}/crc32.c
@@ -30,11 +30,11 @@ if(zlib_ADDED)
3030
include(CheckIncludeFile)
3131
check_include_file(unistd.h Z_HAVE_UNISTD_H)
3232
if(Z_HAVE_UNISTD_H)
33-
target_compile_definitions(zlibstatic PRIVATE Z_HAVE_UNISTD_H)
33+
target_compile_definitions(zlib PRIVATE Z_HAVE_UNISTD_H)
3434
endif()
3535

3636
if(MSVC)
37-
target_compile_definitions(zlibstatic PRIVATE _CRT_SECURE_NO_DEPRECATE _CRT_NONSTDC_NO_DEPRECATE)
37+
target_compile_definitions(zlib PRIVATE _CRT_SECURE_NO_DEPRECATE _CRT_NONSTDC_NO_DEPRECATE)
3838
endif()
39-
target_include_directories(zlibstatic PUBLIC ${zlib_SOURCE_DIR})
39+
target_include_directories(zlib PUBLIC ${zlib_SOURCE_DIR})
4040
endif()

0 commit comments

Comments
 (0)