Guest User

Untitled

a guest
Feb 19th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. function(get_fizzbuzz in out)
  2.  
  3. math(EXPR off3 "${in} % 3")
  4. math(EXPR off5 "${in} % 5")
  5. if(NOT off3 AND NOT off5)
  6. set(${out} FizzBuzz PARENT_SCOPE)
  7. elseif(NOT off3)
  8. set(${out} Fizz PARENT_SCOPE)
  9. elseif(NOT off5)
  10. set(${out} Buzz PARENT_SCOPE)
  11. else()
  12. set(${out} ${in} PARENT_SCOPE)
  13. endif()
  14.  
  15. endfunction()
  16.  
  17.  
  18. function(fizzbuzz)
  19. foreach(i RANGE 1 100)
  20. get_fizzbuzz(${i} msg)
  21. message("${msg}")
  22. endforeach(i)
  23. endfunction()
  24.  
  25.  
  26. if(CMAKE_SCRIPT_MODE_FILE STREQUAL CMAKE_CURRENT_LIST_FILE)
  27. fizzbuzz()
  28. endif()
Add Comment
Please, Sign In to add comment