mirror of
https://github.com/compiler-explorer/compiler-explorer.git
synced 2025-12-27 14:04:04 -05:00
Fixes #5502 In this PR I make an early attempt to add the CMakeScript as a language in compiler-explorer. I will be fantastic having this since CMake is one of the most used build system. Having an cmake interpreter in the web would probe truly useful for teams and individuals, it will be a fantastic way to share snippets of cmakescript and show how they are executed with different cmake versions. Co-authored-by: Matt Godbolt <matt@godbolt.org>
14 lines
362 B
CMake
14 lines
362 B
CMake
# CMake can execute standalone CMake scripts with the -P parameter
|
|
# in the following manner: `cmake -P script.cmake`
|
|
|
|
set(flags ON OFF ON OFF OFF ON)
|
|
set(num_activated_flags)
|
|
|
|
foreach (value IN LISTS flags)
|
|
if (value)
|
|
math(EXPR num_activated_flags "${num_activated_flags} + 1")
|
|
endif()
|
|
endforeach()
|
|
|
|
message("Activated Options: ${num_activated_flags}")
|