PrefixInPATH.cmake 596 B

1234567891011121314151617
  1. list(APPEND CMAKE_FIND_LIBRARY_PREFIXES lib)
  2. list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES .a)
  3. set(ENV_PATH "$ENV{PATH}")
  4. set(CMAKE_FIND_DEBUG_MODE 1)
  5. set(ENV{PATH} "${CMAKE_CURRENT_SOURCE_DIR}/does_not_exist")
  6. find_library(PrefixInPATH_LIBRARY NAMES PrefixInPATH)
  7. set(CMAKE_FIND_DEBUG_MODE 0)
  8. foreach(path "/does_not_exist" "" "/bin" "/sbin")
  9. unset(PrefixInPATH_LIBRARY CACHE)
  10. set(ENV{PATH} "${CMAKE_CURRENT_SOURCE_DIR}${path}")
  11. find_library(PrefixInPATH_LIBRARY NAMES PrefixInPATH)
  12. message(STATUS "PrefixInPATH_LIBRARY='${PrefixInPATH_LIBRARY}'")
  13. endforeach()
  14. set(ENV{PATH} "${ENV_PATH}")