Find.cmake 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. # Functions to aid the built-in find_ functions
  2. # Same as find_path, but always search in .deps directory first and then everything else.
  3. function(find_path2)
  4. find_path_nvim(${ARGV})
  5. find_path(${ARGV})
  6. endfunction()
  7. function(find_path_nvim)
  8. set(CMAKE_FIND_FRAMEWORK NEVER)
  9. set(CMAKE_FIND_APPBUNDLE NEVER)
  10. find_path(${ARGV} NO_CMAKE_SYSTEM_PATH NO_CMAKE_ENVIRONMENT_PATH NO_SYSTEM_ENVIRONMENT_PATH)
  11. endfunction()
  12. # Same as find_library, but with the following search order:
  13. # 1. Only search in .deps directory. Only search for static libraries.
  14. # 2. Only search in .deps directory. Search all libraries
  15. # 3. Search everywhere, all libraries
  16. function(find_library2)
  17. find_library_nvim(STATIC ${ARGV})
  18. find_library_nvim(${ARGV})
  19. find_library(${ARGV})
  20. endfunction()
  21. function(find_library_nvim)
  22. cmake_parse_arguments(ARG
  23. "STATIC"
  24. ""
  25. ""
  26. ${ARGN})
  27. list(REMOVE_ITEM ARGN STATIC)
  28. if(ARG_STATIC)
  29. set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_STATIC_LIBRARY_SUFFIX})
  30. endif()
  31. set(CMAKE_FIND_FRAMEWORK NEVER)
  32. set(CMAKE_FIND_APPBUNDLE NEVER)
  33. find_library(${ARGN} NO_CMAKE_SYSTEM_PATH NO_CMAKE_ENVIRONMENT_PATH NO_SYSTEM_ENVIRONMENT_PATH)
  34. endfunction()