libsuperderpy/cmake/FlacToOgg.cmake

17 lines
626 B
CMake
Raw Normal View History

2019-01-11 13:09:55 +01:00
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)