OpenCVDetectApacheAnt.cmake 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. set(OPENCV_JAVA_SOURCE_VERSION "" CACHE STRING "Java source version (javac Ant target)")
  2. set(OPENCV_JAVA_TARGET_VERSION "" CACHE STRING "Java target version (javac Ant target)")
  3. file(TO_CMAKE_PATH "$ENV{ANT_DIR}" ANT_DIR_ENV_PATH)
  4. file(TO_CMAKE_PATH "$ENV{ProgramFiles}" ProgramFiles_ENV_PATH)
  5. if(CMAKE_HOST_WIN32)
  6. set(ANT_NAME ant.bat)
  7. else()
  8. set(ANT_NAME ant)
  9. endif()
  10. find_host_program(ANT_EXECUTABLE NAMES ${ANT_NAME}
  11. PATHS "${ANT_DIR_ENV_PATH}/bin" "${ProgramFiles_ENV_PATH}/apache-ant/bin"
  12. NO_DEFAULT_PATH
  13. )
  14. find_host_program(ANT_EXECUTABLE NAMES ${ANT_NAME})
  15. if(ANT_EXECUTABLE)
  16. execute_process(COMMAND ${ANT_EXECUTABLE} -version
  17. RESULT_VARIABLE ANT_ERROR_LEVEL
  18. OUTPUT_VARIABLE ANT_VERSION_FULL
  19. OUTPUT_STRIP_TRAILING_WHITESPACE)
  20. if (ANT_ERROR_LEVEL)
  21. unset(ANT_EXECUTABLE)
  22. unset(ANT_EXECUTABLE CACHE)
  23. else()
  24. string(REGEX MATCH "[0-9]+.[0-9]+.[0-9]+" ANT_VERSION "${ANT_VERSION_FULL}")
  25. set(ANT_VERSION "${ANT_VERSION}" CACHE INTERNAL "Detected ant version")
  26. message(STATUS "Found apache ant: ${ANT_EXECUTABLE} (${ANT_VERSION})")
  27. endif()
  28. endif()