FindPackageMessage_SLIC3R.cmake 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. # Modified from the CMake github master.
  2. # required by the bundled FindCURL.cmake
  3. # Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  4. # file Copyright.txt or https://cmake.org/licensing for details.
  5. #.rst:
  6. # FindPackageMessage
  7. # ------------------
  8. #
  9. #
  10. #
  11. # FIND_PACKAGE_MESSAGE(<name> "message for user" "find result details")
  12. #
  13. # This macro is intended to be used in FindXXX.cmake modules files. It
  14. # will print a message once for each unique find result. This is useful
  15. # for telling the user where a package was found. The first argument
  16. # specifies the name (XXX) of the package. The second argument
  17. # specifies the message to display. The third argument lists details
  18. # about the find result so that if they change the message will be
  19. # displayed again. The macro also obeys the QUIET argument to the
  20. # find_package command.
  21. #
  22. # Example:
  23. #
  24. # ::
  25. #
  26. # if(X11_FOUND)
  27. # FIND_PACKAGE_MESSAGE(X11 "Found X11: ${X11_X11_LIB}"
  28. # "[${X11_X11_LIB}][${X11_INCLUDE_DIR}]")
  29. # else()
  30. # ...
  31. # endif()
  32. function(FIND_PACKAGE_MESSAGE_SLIC3R pkg msg details)
  33. # Avoid printing a message repeatedly for the same find result.
  34. if(NOT ${pkg}_FIND_QUIETLY)
  35. string(REPLACE "\n" "" details "${details}")
  36. set(DETAILS_VAR FIND_PACKAGE_MESSAGE_DETAILS_${pkg})
  37. if(NOT "${details}" STREQUAL "${${DETAILS_VAR}}")
  38. # The message has not yet been printed.
  39. message(STATUS "${msg}")
  40. # Save the find details in the cache to avoid printing the same
  41. # message again.
  42. set("${DETAILS_VAR}" "${details}"
  43. CACHE INTERNAL "Details about finding ${pkg}")
  44. endif()
  45. endif()
  46. endfunction()