Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function(get_fizzbuzz in out)
- math(EXPR off3 "${in} % 3")
- math(EXPR off5 "${in} % 5")
- if(NOT off3 AND NOT off5)
- set(${out} FizzBuzz PARENT_SCOPE)
- elseif(NOT off3)
- set(${out} Fizz PARENT_SCOPE)
- elseif(NOT off5)
- set(${out} Buzz PARENT_SCOPE)
- else()
- set(${out} ${in} PARENT_SCOPE)
- endif()
- endfunction()
- function(fizzbuzz)
- foreach(i RANGE 1 100)
- get_fizzbuzz(${i} msg)
- message("${msg}")
- endforeach(i)
- endfunction()
- if(CMAKE_SCRIPT_MODE_FILE STREQUAL CMAKE_CURRENT_LIST_FILE)
- fizzbuzz()
- endif()
Add Comment
Please, Sign In to add comment