Question

I have a macro that looks like this

MACRO(FFMPEG_FIND varname shortname headername)
    MESSAGE(STATUS "FFMPEG_${varname}_LIBRARIES: ${FFMPEG_${varname}_LIBRARIES}")
    MESSAGE(STATUS "FFMPEG_${varname}_INCLUDE_DIRS: ${FFMPEG_${varname}_INCLUDE_DIRS}")
ENDMACRO(FFMPEG_FIND)

which is called like this:

FFMPEG_FIND(LIBAVFORMAT avformat avformat.h)
FFMPEG_FIND(LIBAVDEVICE avdevice avdevice.h)
FFMPEG_FIND(LIBAVCODEC  avcodec  avcodec.h)
FFMPEG_FIND(LIBAVUTIL   avutil   avutil.h)
FFMPEG_FIND(LIBSWSCALE  swscale  swscale.h)  # not sure about the header to look for here.

Which will give us the output of

-- FFMPEG_LIBAVFORMAT_LIBRARIES: F:/Dev/Lib/ffmpeg-20140507-git-4cdea92-win32-de
v/lib/avformat.lib
-- FFMPEG_LIBAVFORMAT_INCLUDE_DIRS: F:/Dev/Lib/ffmpeg-2.2.1
-- FFMPEG_LIBAVDEVICE_LIBRARIES: F:/Dev/Lib/ffmpeg-20140507-git-4cdea92-win32-de
v/lib/avdevice.lib
-- FFMPEG_LIBAVDEVICE_INCLUDE_DIRS: F:/Dev/Lib/ffmpeg-2.2.1
-- FFMPEG_LIBAVCODEC_LIBRARIES: F:/Dev/Lib/ffmpeg-20140507-git-4cdea92-win32-dev
/lib/avcodec.lib
-- FFMPEG_LIBAVCODEC_INCLUDE_DIRS: F:/Dev/Lib/ffmpeg-2.2.1
-- FFMPEG_LIBAVUTIL_LIBRARIES: F:/Dev/Lib/ffmpeg-20140507-git-4cdea92-win32-dev/
lib/avutil.lib
-- FFMPEG_LIBAVUTIL_INCLUDE_DIRS: F:/Dev/Lib/ffmpeg-2.2.1
-- FFMPEG_LIBSWSCALE_LIBRARIES: F:/Dev/Lib/ffmpeg-20140507-git-4cdea92-win32-dev
/lib/swscale.lib
-- FFMPEG_LIBSWSCALE_INCLUDE_DIRS: F:/Dev/Lib/ffmpeg-2.2.1
-- Configuring done
-- Generating done

My first question is how is cmake even finding the libraries on my hard drive while the FIND macro is essentially empty. The more important question being, why is INCLUDE_DIRS set to F:/Dev/Lib/ffmpeg-2.2.1 which is a path that doesn't even exist (there is no ffmpeg-2.2.1 folder in F:/Dev/Lib), as it should be pointing to F:/Dev/Lib/ffmpeg-20140507-git-4cdea92-win32-dev/include

Was it helpful?

Solution

Your macro doesn't find anything, it just prints values from CMakeCache.txt, which is a persistent storage betweeen cmake invocations (or configure step in GUI). Your FFMPEG-related values was set by previous cmake call and now cmake prints them.

Cache values can be changed by running cmake -DVAR=VALUE . in your build directory.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top