Cmake FILE() command prepends other path to provided file path

71 views Asked by At

i have a problem with a cmake Findxxx script.

Im trying this on a msys2 shell inside win10 and my source code lies in /home/adrian/dev/libosmscout Inside it i have a build dir from which i call cmake ..

Inside the problematic FindCairo.cmake file i have (among other things)

IF (CAIRO_INCLUDE_DIRS)
    IF (EXISTS "${CAIRO_INCLUDE_DIRS}/cairo-version.h")
        MESSAGE(STATUS "${CAIRO_INCLUDE_DIRS}/cairo-version.h")
        FILE(READ "${CAIRO_INCLUDE_DIRS}/cairo-version.h" CAIRO_VERSION_CONTENT)        
    ENDIF ()
ENDIF ()

Which results in:

-- D:/Dev/Compiler/msys64/mingw32/include/cairo/cairo-version.h

CMake Error at cmake/FindCairo.cmake:39 (FILE):
  file failed to open for reading (No such file or directory):
/home/adrian/dev/libosmscout/D:/Dev/Compiler/msys64/mingw32/include/cairo/cairo-version.h

As you can see from the MESSAGE command the CAIRO_INCLUDE_DIRS variable gets filled correctly but the call to FILE(READ) somehow prepends my source directory.

What am i doing wrong? Why is he prepending?

Thanks!

0

There are 0 answers