find_program(OGGENC NAMES oggenc NO_CMAKE_FIND_ROOT_PATH) if(OGGENC) file(GLOB_RECURSE FLAC_FILES RELATIVE ${DATADIR} ${DATADIR}/*.flac) message(STATUS "FlacToOgg engaging... (using ${OGGENC})") foreach(file IN LISTS FLAC_FILES) message(STATUS ${file}) execute_process(COMMAND ${OGGENC} -Q -b 192 --resample 44100 ${file} WORKING_DIRECTORY ${DATADIR} RESULT_VARIABLE OGGENC_RESULT) if(OGGENC_RESULT) message(WARNING "ERROR: ${OGGENC_RESULT}") else() file(REMOVE ${DATADIR}/${file}) endif() endforeach(file) else(OGGENC) message(WARNING "FlacToOgg: can't find oggenc!") endif(OGGENC)