From ce348fa37be6e32f6efff1f3b99fd0b392244968 Mon Sep 17 00:00:00 2001
From: Linda Lapinlampi <linda@lindalap.fi>
Date: Thu, 9 Dec 2021 02:12:48 +0000
Subject: [PATCH 1/1] CMakeLists: Replace confusing else(expression)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

CMakeLists have had a combination of else() and else(expression). The
latter is a frustrating example of bad and confusing documentation from
CMake 3.13 and earlier, where the synopsis of "if" said
else(expression), with a note in body text "that the expression in the
else and endif clause is optional".

Starting with CMake 3.14.0, the synopsis in documentation was clarified
to only say else(), with no expression in brackets. Since then,
else(expression) been considered a "legacy" practice, but remains
allowed to date (although it can be very confusing).

This commit's replacement of else(expression) with else() should aid
readability and help avoid revisiting former issues from 2½ years ago
again.

Fixes: #3933
See: https://cmake.org/cmake/help/v3.13/command/if.html
See: https://cmake.org/cmake/help/v3.14/command/if.html
---
 CMakeLists.txt                      | 6 +++---
 src/core/CMakeLists.txt             | 2 +-
 src/wadseeker/CMakeLists.txt        | 4 ++--
 tools/updaterevision/CMakeLists.txt | 2 +-
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 043756f5..b4b26e04 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -99,7 +99,7 @@ endif()
 
 if( ZLIB_FOUND AND NOT FORCE_INTERNAL_ZLIB )
 	message( STATUS "Using system zlib" )
-else( ZLIB_FOUND AND NOT FORCE_INTERNAL_ZLIB )
+else()
 	message( STATUS "Using internal zlib" )
 	set( ZLIB_INTERNAL YES )
 	set(SKIP_INSTALL_ALL ON)
@@ -113,7 +113,7 @@ endif()
 
 if( BZIP2_FOUND AND NOT FORCE_INTERNAL_BZIP2 )
 	message( STATUS "Using system bzip2 library" )
-else( BZIP2_FOUND AND NOT FORCE_INTERNAL_BZIP2 )
+else()
 	message( STATUS "Using internal bzip2 library" )
 	set( BZIP2_INTERNAL YES )
 	add_subdirectory( dependencies/bzip2 )
@@ -125,7 +125,7 @@ endif()
 
 if ( wadseeker_FOUND AND NOT FORCE_INTERNAL_WADSEEKER )
 	message( STATUS "Using system Wadseeker library" )
-else( wadseeker_FOUND AND NOT FORCE_INTERNAL_WADSEEKER )
+else()
 	message( STATUS "Using internal Wadseeker library" )
 	set( WADSEEKER_INTERNAL YES )
 	add_subdirectory( src/wadseeker )
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index 9716dd3d..f352f0df 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -237,7 +237,7 @@ if(WIN32)
 			LINK_FLAGS_RELEASE "/SUBSYSTEM:WINDOWS"
 			LINK_FLAGS_RELWITHDEBINFO "/SUBSYSTEM:WINDOWS"
 			LINK_FLAGS_MINSIZEREL "/SUBSYSTEM:WINDOWS")
-	else(MSVC)
+	else()
 		set_target_properties(doomseeker PROPERTIES
 			LINK_FLAGS_RELEASE "-Wl,-subsystem,windows"
 			LINK_FLAGS_MINSIZEREL "-Wl,-subsystem,windows")
diff --git a/src/wadseeker/CMakeLists.txt b/src/wadseeker/CMakeLists.txt
index a9ca9520..b4064438 100644
--- a/src/wadseeker/CMakeLists.txt
+++ b/src/wadseeker/CMakeLists.txt
@@ -77,7 +77,7 @@ if (CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
 
 	if( ZLIB_FOUND AND NOT FORCE_INTERNAL_ZLIB )
 		message( STATUS "Using system zlib" )
-	else( ZLIB_FOUND AND NOT FORCE_INTERNAL_ZLIB )
+	else()
 		message( STATUS "Using internal zlib" )
 		set( ZLIB_INTERNAL YES )
 		set(SKIP_INSTALL_ALL ON)
@@ -91,7 +91,7 @@ if (CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
 
 	if( BZIP2_FOUND AND NOT FORCE_INTERNAL_BZIP2 )
 		message( STATUS "Using system bzip2 library" )
-	else( BZIP2_FOUND AND NOT FORCE_INTERNAL_BZIP2 )
+	else()
 		message( STATUS "Using internal bzip2 library" )
 		set( BZIP2_INTERNAL YES )
 		add_subdirectory( dependencies/bzip2 )
diff --git a/tools/updaterevision/CMakeLists.txt b/tools/updaterevision/CMakeLists.txt
index 6508f934..e270ab64 100755
--- a/tools/updaterevision/CMakeLists.txt
+++ b/tools/updaterevision/CMakeLists.txt
@@ -3,7 +3,7 @@ if( WIN32 )
 		# VC 8+ adds a manifest automatically to the executable. We need to
 		# merge ours with it.
 		set( MT_MERGE ON )
-	else( MSVC_VERSION GREATER 1399 )
+	else()
 		set( TRUSTINFO trustinfo.rc )
 	endif()
 endif()
-- 
2.34.1

