UsePackage.cmake 692 B

12345678910111213141516171819202122232425
  1. # This file is designed to be included in a top level CMakeLists.txt like so:
  2. #
  3. # include(path/to/here/UsePackage.cmake)
  4. #
  5. # It will add to the module path all subdirectories with a FindXXX.cmake file
  6. # Do everything inside a function so as not to clash with any existing variables
  7. function(AddDirsToModulePath)
  8. get_filename_component(CURRENT_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
  9. set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
  10. ${CURRENT_DIR}
  11. PARENT_SCOPE
  12. )
  13. endfunction()
  14. if(DEBUG_MODULES)
  15. message("CMAKE_MODULE_PATH before: ${CMAKE_MODULE_PATH}")
  16. endif()
  17. AddDirsToModulePath()
  18. if(DEBUG_MODULES)
  19. message("CMAKE_MODULE_PATH after: ${CMAKE_MODULE_PATH}")
  20. endif()