Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

CMake cannot detect latest Apache Ant 1.10.2

Hello,

I am trying to install OpenCV 3.4 but CMake is unable to detect Apache Ant installed on my machine.

I have it installed in:

C:\apache-ant-1.10.2

When I initially click 'Configure' the output window displays:

Java:
ant:                         NO
JNI:                         C:/Program Files/Java/jdk1.8.0_161/include C:/Program Files/Java/jdk1.8.0_161/include/win32 C:/Program Files/Java/jdk1.8.0_161/include
Java wrappers:               NO
Java tests:                  NO

I have installed, however, Java 9.0.4. No matter, that can be changed. But then I am given the new option of 'ANT_EXECUTABLE' in which case I set to:

C:/apache-ant-1.10.2/bin/ant.bat

I have seen others set this option similarly, even though looking at the 'OpenCVDetectApacheAnt.cmake' file seems to looking for a 'ant' (extensionless) file if the system is 64 bit:

    if(CMAKE_HOST_WIN32)
    set(ANT_NAME ant.bat)
    else()
    set(ANT_NAME ant)
    endif()

This seems like another case of OpenCV/CMake incorrectly detecting my system as 32bit.

However, if I set ANT_EXECUTABLE to 'C:/apache-ant-1.10.2/bin/ant.bat' and click 'Configure', the output I receive is:

'"java.exe"' is not recognized as an internal or external command, operable program or batch file.

If I set ANT_EXECUTABLE to 'C:/apache-ant-1.10.2/bin/ant' and click 'Configure', the change is seemingly ignored, and I am unable to see the ANT_EXECUTABLE option unless I click 'Configure' again. However, I do get "ANT_ERROR_LEVEL=%1 is not a valid Win32 application" in the CMakeVars.txt file.

Not sure what to do next.

Any help is appreciated.