|
2 | 2 | # CMake file for Java tutorials compilation.
|
3 | 3 | #
|
4 | 4 | # ----------------------------------------------------------------------------
|
5 |
| -if(NOT ANT_EXECUTABLE) |
| 5 | +if(NOT ANT_EXECUTABLE OR NOT TARGET opencv_java) |
6 | 6 | return()
|
7 | 7 | endif()
|
8 | 8 |
|
9 | 9 | project(compile_java_tutorials)
|
10 | 10 |
|
11 | 11 | set(curdir "${CMAKE_CURRENT_SOURCE_DIR}")
|
12 | 12 | set(opencv_tutorial_java_bin_dir "${CMAKE_CURRENT_BINARY_DIR}/.compiled")
|
13 |
| -set(target_name "compile_java_tutorials") |
14 | 13 | set(TUTORIALS_DIRS "")
|
15 | 14 |
|
16 |
| -FILE(GLOB children RELATIVE ${curdir} ${curdir}/*/*) |
17 |
| -FOREACH(child ${children}) |
| 15 | +file(GLOB children RELATIVE ${curdir} ${curdir}/*/*) |
| 16 | +foreach(child ${children}) |
18 | 17 | if(IS_DIRECTORY ${curdir}/${child})
|
19 |
| - FILE(GLOB contains_java_files "${child}/*.java") |
| 18 | + file(GLOB contains_java_files "${child}/*.java") |
20 | 19 | if(contains_java_files)
|
21 |
| - LIST(APPEND TUTORIALS_DIRS ${child}) |
| 20 | + list(APPEND TUTORIALS_DIRS ${child}) |
22 | 21 | endif()
|
23 | 22 | endif()
|
24 |
| -ENDFOREACH() |
| 23 | +endforeach() |
25 | 24 |
|
26 |
| -add_custom_target("${target_name}" ALL |
| 25 | +add_custom_target("${PROJECT_NAME}" |
27 | 26 | DEPENDS opencv_java
|
28 | 27 | )
|
29 | 28 |
|
30 |
| -FOREACH(tutorial_dir ${TUTORIALS_DIRS}) |
31 |
| - get_filename_component(tutorial_name ${tutorial_dir} NAME_WE) |
32 |
| - add_custom_command(TARGET "${target_name}" |
| 29 | +foreach(TUTORIAL_DIR ${TUTORIALS_DIRS}) |
| 30 | + get_filename_component(TUTORIAL_NAME ${TUTORIAL_DIR} NAME_WE) |
| 31 | + add_custom_command(TARGET "${PROJECT_NAME}" |
33 | 32 | COMMAND ${ANT_EXECUTABLE} -q
|
34 | 33 | -DocvJarDir="${OpenCV_BINARY_DIR}/bin"
|
35 |
| - -DsrcDir="${tutorial_dir}" |
36 |
| - -DdstDir="${opencv_tutorial_java_bin_dir}/${tutorial_name}" |
| 34 | + -DsrcDir="${TUTORIAL_DIR}" |
| 35 | + -DdstDir="${opencv_tutorial_java_bin_dir}/${TUTORIAL_NAME}" |
37 | 36 | WORKING_DIRECTORY "${curdir}"
|
38 |
| - COMMENT "Compile the tutorial: ${tutorial_name}" |
| 37 | + COMMENT "Compile the tutorial: ${TUTORIAL_NAME}" |
39 | 38 | )
|
40 |
| -ENDFOREACH() |
| 39 | +endforeach() |
0 commit comments