diff options
| author | Ahmad Fatoum <[email protected]> | 2018-07-23 20:42:19 +0200 |
|---|---|---|
| committer | Ahmad Fatoum <[email protected]> | 2018-07-23 21:00:48 +0200 |
| commit | 2b8c9f9a17926ce0eace44ada299e6ecb6f12cd1 (patch) | |
| tree | 38cbd592802256819458ce395bd0a1aa959c9cc8 /cmake | |
| parent | 1d0ba96c9e3df1962ece61ebbb50fbe5c3ce3578 (diff) | |
| download | raylib-2b8c9f9a17926ce0eace44ada299e6ecb6f12cd1.tar.gz raylib-2b8c9f9a17926ce0eace44ada299e6ecb6f12cd1.zip | |
CMake: Fail when -D{PLATFORM,OPENGL_VERSION}=INVALID_VALUE
as well as -DUSE_EXTERNAL_GLFW.
Nips issues like #584 in the bud.
Diffstat (limited to 'cmake')
| -rw-r--r-- | cmake/EnumOption.cmake | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/cmake/EnumOption.cmake b/cmake/EnumOption.cmake new file mode 100644 index 00000000..d7d343f4 --- /dev/null +++ b/cmake/EnumOption.cmake @@ -0,0 +1,9 @@ +macro(enum_option var values description) + set(${var}_VALUES ${values}) + list(GET ${var}_VALUES 0 default) + set(${var} "${default}" CACHE STRING "${description}") + set_property(CACHE ${var} PROPERTY STRINGS ${${var}_VALUES}) + if (NOT ";${${var}_VALUES};" MATCHES ";${${var}};") + message(FATAL_ERROR "Unknown value ${${var}}. Only -D${var}=${${var}_VALUES} allowed.") + endif() +endmacro() |
