forked from Rightpoint/opencv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOpenCVDetectApacheAnt.cmake
34 lines (28 loc) · 1.08 KB
/
OpenCVDetectApacheAnt.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
set(OPENCV_JAVA_SOURCE_VERSION "" CACHE STRING "Java source version (javac Ant target)")
set(OPENCV_JAVA_TARGET_VERSION "" CACHE STRING "Java target version (javac Ant target)")
file(TO_CMAKE_PATH "$ENV{ANT_DIR}" ANT_DIR_ENV_PATH)
file(TO_CMAKE_PATH "$ENV{ProgramFiles}" ProgramFiles_ENV_PATH)
if(CMAKE_HOST_WIN32)
set(ANT_NAME ant.bat)
else()
set(ANT_NAME ant)
endif()
find_host_program(ANT_EXECUTABLE NAMES ${ANT_NAME}
PATHS "${ANT_DIR_ENV_PATH}/bin" "${ProgramFiles_ENV_PATH}/apache-ant/bin"
NO_DEFAULT_PATH
)
find_host_program(ANT_EXECUTABLE NAMES ${ANT_NAME})
if(ANT_EXECUTABLE)
execute_process(COMMAND ${ANT_EXECUTABLE} -version
RESULT_VARIABLE ANT_ERROR_LEVEL
OUTPUT_VARIABLE ANT_VERSION_FULL
OUTPUT_STRIP_TRAILING_WHITESPACE)
if (ANT_ERROR_LEVEL)
unset(ANT_EXECUTABLE)
unset(ANT_EXECUTABLE CACHE)
else()
string(REGEX MATCH "[0-9]+.[0-9]+.[0-9]+" ANT_VERSION "${ANT_VERSION_FULL}")
set(ANT_VERSION "${ANT_VERSION}" CACHE INTERNAL "Detected ant version")
message(STATUS "Found apache ant: ${ANT_EXECUTABLE} (${ANT_VERSION})")
endif()
endif()