[CMake] using find_package from within toolchain file

Dave Gomboc dave_gomboc at acm.org
Wed Nov 28 20:39:05 EST 2012


Hello,

I am attempting to use find_package within each toolchain file in
combination with cross-compiling WebKit. The locations in which both
WebKit and BuildRoot are situated on the Debian Linux systems are not
standardized, but up to individual developers. The version of CMake is
2.8.7.

WebKit's build procedure is invoked as so:

Tools/Scripts/build-webkit --customportname --crosscompiletarget=xyz

The first time through, CMAKE_SOURCE_DIR is equal to the root of the
git repository in which a developer has WebKit checked out into (for
example, /webkitroot). The created toolchain files themselves are
located in ${CMAKE_SOURCE_DIR}/Source/cmake, which is where WebKit
keeps its other .cmake files, as is the FindBuildRoot.cmake file for
finding the BuildRoot package. Everything is found, just as one might
expect.

However, immediately afterward, the toolchain file is automatically
invoked again, this time with
CMAKE_SOURCE_DIR=/webkitroot/WebKitBuild/Debug/CMakeFiles/CMakeTmp. An
attempt to establish the CMAKE_MODULE_PATH this time around by tacking
on Source/cmake to the end of this path fails miserably, of course, so
BuildRoot is not found, and the build fails to complete.

I am unsure if the reinvocation usually occurs with CMake, or whether
this is a peculiarity of WebKit's compilation procedure. There are a
few different potential solutions I could attempt, but I thought I
should seek advice re: the approaches that would be considered to be
best practices by the CMake community.

Thanks,
Dave


More information about the CMake mailing list