########################################
# FUNCTION add_prog_target
########################################
function(add_prog_target target)
    set                             (${target}_src "${ARGN}")
    if (WIN32)
        set_source_files_properties (${${target}_src} PROPERTIES LANGUAGE CXX)
    endif()
    add_executable                  (${target} ${${target}_src})
    if (BUILD_SHARED_LIBS)
        target_compile_definitions  (${target} PRIVATE -DLIBLEPT_IMPORTS)
    endif()
    target_link_libraries           (${target} leptonica)
    set_target_properties           (${target} PROPERTIES FOLDER prog)
endfunction(add_prog_target)
########################################

add_prog_target(adaptmap_reg adaptmap_reg.c)
add_prog_target(adaptnorm_reg adaptnorm_reg.c)
add_prog_target(affine_reg affine_reg.c)
add_prog_target(alltests_reg alltests_reg.c)
add_prog_target(alphaops_reg alphaops_reg.c)
add_prog_target(alphaxform_reg alphaxform_reg.c)
add_prog_target(baseline_reg baseline_reg.c)
add_prog_target(bilateral1_reg bilateral1_reg.c)
add_prog_target(bilateral2_reg bilateral2_reg.c)
add_prog_target(bilinear_reg bilinear_reg.c)
add_prog_target(binarize_reg binarize_reg.c)
add_prog_target(binmorph1_reg binmorph1_reg.c)
add_prog_target(binmorph2_reg binmorph2_reg.c)
add_prog_target(binmorph3_reg binmorph3_reg.c)
add_prog_target(binmorph4_reg binmorph4_reg.c)
add_prog_target(binmorph5_reg binmorph5_reg.c)
add_prog_target(blackwhite_reg blackwhite_reg.c)
add_prog_target(blend1_reg blend1_reg.c)
add_prog_target(blend2_reg blend2_reg.c)
add_prog_target(blend3_reg blend3_reg.c)
add_prog_target(blend4_reg blend4_reg.c)
add_prog_target(blend5_reg blend5_reg.c)
add_prog_target(boxa1_reg boxa1_reg.c)
add_prog_target(boxa2_reg boxa2_reg.c)
add_prog_target(boxa3_reg boxa3_reg.c)
add_prog_target(boxa4_reg boxa4_reg.c)
add_prog_target(bytea_reg bytea_reg.c)
add_prog_target(ccthin1_reg ccthin1_reg.c)
add_prog_target(ccthin2_reg ccthin2_reg.c)
add_prog_target(checkerboard_reg checkerboard_reg.c)
add_prog_target(cmapquant_reg cmapquant_reg.c)
add_prog_target(colorcontent_reg colorcontent_reg.c)
add_prog_target(coloring_reg coloring_reg.c)
add_prog_target(colorize_reg colorize_reg.c)
add_prog_target(colormask_reg colormask_reg.c)
add_prog_target(colormorph_reg colormorph_reg.c)
add_prog_target(colorquant_reg colorquant_reg.c)
add_prog_target(colorseg_reg colorseg_reg.c)
add_prog_target(colorspace_reg colorspace_reg.c)
add_prog_target(compare_reg compare_reg.c)
add_prog_target(compfilter_reg compfilter_reg.c)
add_prog_target(conncomp_reg conncomp_reg.c)
add_prog_target(conversion_reg conversion_reg.c)
add_prog_target(convolve_reg convolve_reg.c)
add_prog_target(dewarp_reg dewarp_reg.c)
add_prog_target(distance_reg distance_reg.c)
add_prog_target(dither_reg dither_reg.c)
add_prog_target(dna_reg dna_reg.c)
add_prog_target(dwamorph1_reg dwamorph1_reg.c dwalinear.3.c dwalinearlow.3.c)
add_prog_target(dwamorph2_reg dwamorph2_reg.c dwalinear.3.c dwalinearlow.3.c)
add_prog_target(edge_reg edge_reg.c)
add_prog_target(enhance_reg enhance_reg.c)
add_prog_target(equal_reg equal_reg.c)
add_prog_target(expand_reg expand_reg.c)
add_prog_target(extrema_reg extrema_reg.c)
add_prog_target(falsecolor_reg falsecolor_reg.c)
add_prog_target(fhmtauto_reg fhmtauto_reg.c)
add_prog_target(files_reg files_reg.c)
add_prog_target(findcorners_reg findcorners_reg.c)
add_prog_target(findpattern_reg findpattern_reg.c)
add_prog_target(flipdetect_reg flipdetect_reg.c)
add_prog_target(fmorphauto_reg fmorphauto_reg.c)
add_prog_target(fpix1_reg fpix1_reg.c)
add_prog_target(fpix2_reg fpix2_reg.c)
add_prog_target(genfonts_reg genfonts_reg.c)
add_prog_target(gifio_reg gifio_reg.c)
add_prog_target(grayfill_reg grayfill_reg.c)
add_prog_target(graymorph1_reg graymorph1_reg.c)
add_prog_target(graymorph2_reg graymorph2_reg.c)
add_prog_target(grayquant_reg grayquant_reg.c)
add_prog_target(hardlight_reg hardlight_reg.c)
add_prog_target(heap_reg heap_reg.c)
add_prog_target(insert_reg insert_reg.c)
add_prog_target(ioformats_reg ioformats_reg.c)
add_prog_target(iomisc_reg iomisc_reg.c)
add_prog_target(italic_reg italic_reg.c)
add_prog_target(jbclass_reg jbclass_reg.c)
add_prog_target(jp2kio_reg jp2kio_reg.c)
add_prog_target(jpegio_reg jpegio_reg.c)
add_prog_target(kernel_reg kernel_reg.c)
add_prog_target(label_reg label_reg.c)
add_prog_target(lineremoval_reg lineremoval_reg.c)
add_prog_target(locminmax_reg locminmax_reg.c)
add_prog_target(logicops_reg logicops_reg.c)
add_prog_target(lowaccess_reg lowaccess_reg.c)
add_prog_target(lowsat_reg lowsat_reg.c)
add_prog_target(maze_reg maze_reg.c)
add_prog_target(mtiff_reg mtiff_reg.c)
add_prog_target(multitype_reg multitype_reg.c)
add_prog_target(nearline_reg nearline_reg.c)
add_prog_target(newspaper_reg newspaper_reg.c)
add_prog_target(numa1_reg numa1_reg.c)
add_prog_target(numa2_reg numa2_reg.c)
add_prog_target(overlap_reg overlap_reg.c)
add_prog_target(pageseg_reg pageseg_reg.c)
add_prog_target(paintmask_reg paintmask_reg.c)
add_prog_target(paint_reg paint_reg.c)
add_prog_target(pdfio1_reg pdfio1_reg.c)
add_prog_target(pdfio2_reg pdfio2_reg.c)
add_prog_target(pdfseg_reg pdfseg_reg.c)
add_prog_target(pixa1_reg pixa1_reg.c)
add_prog_target(pixa2_reg pixa2_reg.c)
add_prog_target(pixadisp_reg pixadisp_reg.c)
add_prog_target(pixalloc_reg pixalloc_reg.c)
add_prog_target(pixcomp_reg pixcomp_reg.c)
add_prog_target(pixmem_reg pixmem_reg.c)
add_prog_target(pixserial_reg pixserial_reg.c)
add_prog_target(pixtile_reg pixtile_reg.c)
add_prog_target(pngio_reg pngio_reg.c)
add_prog_target(pnmio_reg pnmio_reg.c)
add_prog_target(projection_reg projection_reg.c)
add_prog_target(projective_reg projective_reg.c)
add_prog_target(psioseg_reg psioseg_reg.c)
add_prog_target(psio_reg psio_reg.c)
add_prog_target(pta_reg pta_reg.c)
add_prog_target(ptra1_reg ptra1_reg.c)
add_prog_target(ptra2_reg ptra2_reg.c)
add_prog_target(quadtree_reg quadtree_reg.c)
add_prog_target(rankbin_reg rankbin_reg.c)
add_prog_target(rankhisto_reg rankhisto_reg.c)
add_prog_target(rank_reg rank_reg.c)
add_prog_target(rasteropip_reg rasteropip_reg.c)
add_prog_target(rasterop_reg rasterop_reg.c)
add_prog_target(rectangle_reg rectangle_reg.c)
add_prog_target(rotate1_reg rotate1_reg.c)
add_prog_target(rotate2_reg rotate2_reg.c)
add_prog_target(scale_reg scale_reg.c)
add_prog_target(selio_reg selio_reg.c)
add_prog_target(shear1_reg shear1_reg.c)
add_prog_target(shear2_reg shear2_reg.c)
add_prog_target(skew_reg skew_reg.c)
add_prog_target(smallpix_reg smallpix_reg.c)
add_prog_target(smoothedge_reg smoothedge_reg.c)
add_prog_target(speckle_reg speckle_reg.c)
add_prog_target(splitcomp_reg splitcomp_reg.c)
add_prog_target(string_reg string_reg.c)
add_prog_target(subpixel_reg subpixel_reg.c)
add_prog_target(texturefill_reg texturefill_reg.c)
add_prog_target(threshnorm_reg threshnorm_reg.c)
add_prog_target(translate_reg translate_reg.c)
add_prog_target(warper_reg warper_reg.c)
add_prog_target(watershed_reg watershed_reg.c)
add_prog_target(webpio_reg webpio_reg.c)
add_prog_target(webpanimio_reg webpanimio_reg.c)
add_prog_target(wordboxes_reg wordboxes_reg.c)
add_prog_target(writetext_reg writetext_reg.c)
add_prog_target(xformbox_reg xformbox_reg.c)
add_prog_target(adaptmap_dark adaptmap_dark.c)
add_prog_target(arabic_lines arabic_lines.c)
add_prog_target(arithtest arithtest.c)
add_prog_target(autogentest1 autogentest1.c)
add_prog_target(autogentest2 autogentest2.c autogen.137.c)
add_prog_target(barcodetest barcodetest.c)
add_prog_target(binarize_set binarize_set.c)
add_prog_target(binarizefiles binarizefiles.c)
add_prog_target(bincompare bincompare.c)
add_prog_target(blendcmaptest blendcmaptest.c)
add_prog_target(buffertest buffertest.c)
add_prog_target(ccbordtest ccbordtest.c)
add_prog_target(cctest1 cctest1.c)
add_prog_target(cleanpdf cleanpdf.c)
add_prog_target(colorsegtest colorsegtest.c)
add_prog_target(comparepages comparepages.c)
add_prog_target(comparepixa comparepixa.c)
add_prog_target(comparetest comparetest.c)
add_prog_target(concatpdf concatpdf.c)
add_prog_target(contrasttest contrasttest.c)
add_prog_target(convertfilestopdf convertfilestopdf.c)
add_prog_target(convertfilestops convertfilestops.c)
add_prog_target(convertformat convertformat.c)
add_prog_target(convertsegfilestopdf convertsegfilestopdf.c)
add_prog_target(convertsegfilestops convertsegfilestops.c)
add_prog_target(converttogray converttogray.c)
add_prog_target(converttopdf converttopdf.c)
add_prog_target(converttops converttops.c)
add_prog_target(cornertest cornertest.c)
add_prog_target(corrupttest corrupttest.c)
add_prog_target(croptest croptest.c)
add_prog_target(croptext croptext.c)
add_prog_target(deskew_it deskew_it.c)
add_prog_target(dewarprules dewarprules.c)
add_prog_target(dewarptest1 dewarptest1.c)
add_prog_target(dewarptest2 dewarptest2.c)
add_prog_target(dewarptest3 dewarptest3.c)
add_prog_target(dewarptest4 dewarptest4.c)
add_prog_target(dewarptest5 dewarptest5.c)
add_prog_target(digitprep1 digitprep1.c)
add_prog_target(displayboxa displayboxa.c)
add_prog_target(displayboxes_on_pixa displayboxes_on_pixa.c)
add_prog_target(displaypix displaypix.c)
add_prog_target(displaypixa displaypixa.c)
add_prog_target(dwalineargen dwalineargen.c)
add_prog_target(fcombautogen fcombautogen.c)
add_prog_target(fhmtautogen fhmtautogen.c)
add_prog_target(fileinfo fileinfo.c)
add_prog_target(findbinding findbinding.c)
add_prog_target(find_colorregions find_colorregions.c)
add_prog_target(findpattern1 findpattern1.c)
add_prog_target(findpattern2 findpattern2.c)
add_prog_target(findpattern3 findpattern3.c)
add_prog_target(flipselgen flipselgen.c)
add_prog_target(fmorphautogen fmorphautogen.c)
add_prog_target(fpixcontours fpixcontours.c)
add_prog_target(gammatest gammatest.c)
add_prog_target(graphicstest graphicstest.c)
add_prog_target(graymorphtest graymorphtest.c)
add_prog_target(hashtest hashtest.c)
add_prog_target(histotest histotest.c)
add_prog_target(histoduptest histoduptest.c)
add_prog_target(htmlviewer htmlviewer.c)
add_prog_target(imagetops imagetops.c)
add_prog_target(jbcorrelation jbcorrelation.c)
add_prog_target(jbrankhaus jbrankhaus.c)
add_prog_target(jbwords jbwords.c)
add_prog_target(listtest listtest.c)
add_prog_target(livre_adapt livre_adapt.c)
add_prog_target(livre_hmt livre_hmt.c)
add_prog_target(livre_makefigs livre_makefigs.c)
add_prog_target(livre_orient livre_orient.c)
add_prog_target(livre_pageseg livre_pageseg.c)
add_prog_target(livre_seedgen livre_seedgen.c)
add_prog_target(livre_tophat livre_tophat.c)
add_prog_target(maketile maketile.c)
add_prog_target(maptest maptest.c)
add_prog_target(messagetest messagetest.c)
add_prog_target(misctest1 misctest1.c)
add_prog_target(modifyhuesat modifyhuesat.c)
add_prog_target(morphseq_reg morphseq_reg.c)
add_prog_target(morphtest1 morphtest1.c)
add_prog_target(numaranktest numaranktest.c)
add_prog_target(otsutest1 otsutest1.c)
add_prog_target(otsutest2 otsutest2.c)
add_prog_target(pagesegtest1 pagesegtest1.c)
add_prog_target(pagesegtest2 pagesegtest2.c)
add_prog_target(partifytest partifytest.c)
add_prog_target(partitiontest partitiontest.c)
add_prog_target(percolatetest percolatetest.c)
add_prog_target(pixaatest pixaatest.c)
add_prog_target(pixafileinfo pixafileinfo.c)
add_prog_target(plottest plottest.c)
add_prog_target(printimage printimage.c)
add_prog_target(printsplitimage printsplitimage.c)
add_prog_target(printtiff printtiff.c)
add_prog_target(rbtreetest rbtreetest.c)
add_prog_target(recog_bootnum1 recog_bootnum1.c)
add_prog_target(recog_bootnum2 recog_bootnum2.c)
add_prog_target(recog_bootnum3 recog_bootnum3.c)
add_prog_target(recogsort recogsort.c)
add_prog_target(recogtest1 recogtest1.c)
add_prog_target(recogtest2 recogtest2.c)
add_prog_target(recogtest3 recogtest3.c)
add_prog_target(recogtest4 recogtest4.c)
add_prog_target(recogtest5 recogtest5.c)
add_prog_target(recogtest6 recogtest6.c)
add_prog_target(recogtest7 recogtest7.c)
add_prog_target(reducetest reducetest.c)
add_prog_target(removecmap removecmap.c)
add_prog_target(renderfonts renderfonts.c)
add_prog_target(replacebytes replacebytes.c)
add_prog_target(rotatefastalt rotatefastalt.c)
add_prog_target(rotate_it rotate_it.c)
add_prog_target(rotateorthtest1 rotateorthtest1.c)
add_prog_target(rotateorth_reg rotateorth_reg.c)
add_prog_target(rotatetest1 rotatetest1.c)
add_prog_target(runlengthtest runlengthtest.c)
add_prog_target(scaleandtile scaleandtile.c)
add_prog_target(scale_it scale_it.c)
add_prog_target(scaletest1 scaletest1.c)
add_prog_target(scaletest2 scaletest2.c)
add_prog_target(seedfilltest seedfilltest.c)
add_prog_target(seedspread_reg seedspread_reg.c)
add_prog_target(settest settest.c)
add_prog_target(sharptest sharptest.c)
add_prog_target(sheartest sheartest.c)
add_prog_target(showedges showedges.c)
add_prog_target(skewtest skewtest.c)
add_prog_target(sorttest sorttest.c)
add_prog_target(splitimage2pdf splitimage2pdf.c)
add_prog_target(sudokutest sudokutest.c)
add_prog_target(textorient textorient.c)
add_prog_target(trctest trctest.c)
add_prog_target(underlinetest underlinetest.c)
add_prog_target(warpertest warpertest.c)
add_prog_target(wordsinorder wordsinorder.c)
add_prog_target(writemtiff writemtiff.c)
add_prog_target(xtractprotos xtractprotos.c)
add_prog_target(yuvtest yuvtest.c)

set (INSTALL_PROGS
    convertfilestopdf convertfilestops
    convertformat convertsegfilestopdf convertsegfilestops
    converttopdf converttops fileinfo xtractprotos
)

foreach(make_install ${INSTALL_PROGS})
    install(TARGETS ${make_install} RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
endforeach()
