mirror of
https://github.com/1dot13/source.git
synced 2026-09-09 14:46:05 +02:00
simplify the language/executable validation function (#79)
* simplify the language/executable validation function removing the 'ALL' corner-case so that the default behavior is to configure all valid languages and applications allows to simplify this function quite a bit * keep the CMakePreset.json options listed for ease of use
This commit is contained in:
+2
-2
@@ -107,10 +107,10 @@ bfVFS
|
|||||||
include(cmake/ValidateOptions.cmake)
|
include(cmake/ValidateOptions.cmake)
|
||||||
|
|
||||||
set(ValidLanguages CHINESE DUTCH ENGLISH FRENCH GERMAN ITALIAN POLISH RUSSIAN)
|
set(ValidLanguages CHINESE DUTCH ENGLISH FRENCH GERMAN ITALIAN POLISH RUSSIAN)
|
||||||
ValidateOptions("${ValidLanguages}" "Languages" "ENGLISH" "${Languages}" "LangTargets")
|
ValidateOptions("${ValidLanguages}" "Languages" "${Languages}" "LangTargets")
|
||||||
|
|
||||||
set(ValidApplications JA2 JA2MAPEDITOR JA2UB JA2UBMAPEDITOR)
|
set(ValidApplications JA2 JA2MAPEDITOR JA2UB JA2UBMAPEDITOR)
|
||||||
ValidateOptions("${ValidApplications}" "Applications" "JA2" "${Applications}" "ApplicationTargets")
|
ValidateOptions("${ValidApplications}" "Applications" "${Applications}" "ApplicationTargets")
|
||||||
|
|
||||||
|
|
||||||
# Due to widespread preprocessor definition abuse in the codebase, practically
|
# Due to widespread preprocessor definition abuse in the codebase, practically
|
||||||
|
|||||||
+11
-16
@@ -1,20 +1,15 @@
|
|||||||
function(ValidateOptions ValidOptions ChoiceName DefaultChoice Choice RetVal)
|
function(ValidateOptions ValidOptions ChoiceName Choice RetVal)
|
||||||
if(Choice)
|
if(Choice)
|
||||||
if(Choice MATCHES "ALL")
|
foreach(x IN LISTS Choice)
|
||||||
set(${RetVal} ${ValidOptions} PARENT_SCOPE)
|
if(NOT x IN_LIST ValidOptions)
|
||||||
message(STATUS "ALL ${ChoiceName} option set, configuring ${ValidOptions}.")
|
message(FATAL_ERROR "${ChoiceName}=\"${x}\" is not supported. Valid options are: ${ValidOptions}.")
|
||||||
else()
|
endif()
|
||||||
foreach(x IN LISTS Choice)
|
endforeach()
|
||||||
if(x IN_LIST ValidOptions)
|
|
||||||
message(STATUS "Configuring for ${x}.")
|
|
||||||
else()
|
|
||||||
message(FATAL_ERROR "${x} not supported. The supported ${ChoiceName} are: ${ValidOptions}.")
|
|
||||||
endif()
|
|
||||||
set(${RetVal} ${Choice} PARENT_SCOPE)
|
|
||||||
endforeach()
|
|
||||||
endif()
|
|
||||||
else()
|
else()
|
||||||
set(${RetVal} ${DefaultChoice} PARENT_SCOPE)
|
set(isDefault "by default.")
|
||||||
message(STATUS "No -D${ChoiceName}= parameter, configuring ${DefaultChoice} by default.")
|
set(Choice ${ValidOptions})
|
||||||
endif()
|
endif()
|
||||||
|
message(STATUS "Configuring ${ChoiceName}=\"${Choice}\" ${isDefault}")
|
||||||
|
|
||||||
|
set(${RetVal} ${Choice} PARENT_SCOPE)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|||||||
Reference in New Issue
Block a user