[cmake-developers] Building with Qt for the Raspberry Pi with CMake

Alexander Neundorf neundorf at kde.org
Fri Apr 12 15:21:43 EDT 2013


On Friday 12 April 2013, Stephen Kelly wrote:
> Stephen Kelly wrote:
> > I guess it works because libz.so and libz.so.1 are both in system paths?
> > But then why doesn't the same work on the Raspberry Pi cross compile? The
> > CMAKE_LIBRARY_ARCHITECTURE is already determined to be
> > arm-linux-gnueabihf there.
> 
> I found out what the problem is. CMake doesn't add the sysroot to the link
> line, so that's why the linker is not finding the library. It was searching
> in my native root and not finding them.
> 
>  set(CMAKE_CXX_LINK_FLAGS
>    "${CMAKE_CXX_LINK_FLAGS} --sysroot=${CMAKE_FIND_ROOT_PATH}")
> 
> Is there a reason CMake does not do something like the above already? 

I don't think there's a reason that this is not done, except that nobody has 
done it yet ;-)
So this should be somewhere inside a if(CMAKE_CROSSCOMPILING) in Linux-
GNU.cmake maybe ?

Alex



More information about the cmake-developers mailing list