Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,10 @@ bfVFS
include(cmake/ValidateOptions.cmake)

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)
ValidateOptions("${ValidApplications}" "Applications" "JA2" "${Applications}" "ApplicationTargets")
ValidateOptions("${ValidApplications}" "Applications" "${Applications}" "ApplicationTargets")


# Due to widespread preprocessor definition abuse in the codebase, practically
Expand Down
27 changes: 11 additions & 16 deletions cmake/ValidateOptions.cmake
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
function(ValidateOptions ValidOptions ChoiceName DefaultChoice Choice RetVal)
function(ValidateOptions ValidOptions ChoiceName Choice RetVal)
if(Choice)
if(Choice MATCHES "ALL")
set(${RetVal} ${ValidOptions} PARENT_SCOPE)
message(STATUS "ALL ${ChoiceName} option set, configuring ${ValidOptions}.")
else()
foreach(x IN LISTS Choice)
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()
foreach(x IN LISTS Choice)
if(NOT x IN_LIST ValidOptions)
message(FATAL_ERROR "${ChoiceName}=\"${x}\" is not supported. Valid options are: ${ValidOptions}.")
endif()
endforeach()
else()
set(${RetVal} ${DefaultChoice} PARENT_SCOPE)
message(STATUS "No -D${ChoiceName}= parameter, configuring ${DefaultChoice} by default.")
set(isDefault "by default.")
set(Choice ${ValidOptions})
endif()
message(STATUS "Configuring ${ChoiceName}=\"${Choice}\" ${isDefault}")

set(${RetVal} ${Choice} PARENT_SCOPE)
endfunction()