CornerCases.cmake 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. include(${CMAKE_CURRENT_LIST_DIR}/test_utils.cmake)
  2. # example from the documentation
  3. # OPTIONAL is a keyword and therefore terminates the definition of
  4. # the multi-value DEFINITION before even a single value has been added
  5. set(options OPTIONAL FAST)
  6. set(oneValueArgs DESTINATION RENAME)
  7. set(multiValueArgs TARGETS CONFIGURATIONS)
  8. cmake_parse_arguments(MY_INSTALL "${options}" "${oneValueArgs}"
  9. "${multiValueArgs}"
  10. TARGETS foo DESTINATION OPTIONAL)
  11. TEST(MY_INSTALL_DESTINATION UNDEFINED)
  12. TEST(MY_INSTALL_OPTIONAL TRUE)
  13. macro(foo)
  14. set(_options )
  15. set(_oneValueArgs FOO)
  16. set(_multiValueArgs )
  17. cmake_parse_arguments(_FOO2 "${_options}"
  18. "${_oneValueArgs}"
  19. "${_multiValueArgs}"
  20. "${ARGN}")
  21. cmake_parse_arguments(_FOO1 "${_options}"
  22. "${_oneValueArgs}"
  23. "${_multiValueArgs}"
  24. ${ARGN})
  25. endmacro()
  26. foo(FOO foo)
  27. TEST(_FOO1_FOO foo)
  28. TEST(_FOO2_FOO foo)