invitation: try compiling kdelibs using cmake
Alexander Neundorf
neundorf at kde.org
Wed Jan 25 23:15:01 CET 2006
Hi,
as many of you probably know during the last two weeks I was busy with making
trunk kdelibs build with cmake (http://www.cmake.org).
I think now I have reached a state were I can invite interested people to try
compiling kdelibs with cmake.
I compiled kdelibs successfully on Slackware 9.1 (gcc 3.2.3) and FreeBSD 5.4
(gcc 3.4.2) , Bill Hoffman was able to compile it on Debian (gcc 4.x).
kxmlcore and the directories which depend on it (kjs, khtml, kate) are still
excluded from the build, neither gcc 3.2.3 on my slackware box nor gcc
*3.4.2* on the FreeBSD box were able to compile it
(http://lists.kde.org/?l=kfm-devel&m=113796106221351&w=2).
Right now everything compiles and links and correct install rules are created.
If the option "KDE4_BUILD_TESTS" is enabled, also most of the check_PROGRAMS
are created (not all, I didn't understand all the custom rules yet).
cmake supports Makefiles for basically every UNIX including Mac OS X. It also
support Makefiles for cygwin, mingw and cl, and it support project files for
XCode and MSVC 6,7 and 8.
In order to compile kdelibs using cmake, you need cmake from current cmake
cvs:
$ cvs -d :pserver:anonymous at www.cmake.org:/cvsroot/CMake login
(respond with password cmake)
Follow this command by checking out the source code:
$ cvs -d :pserver:anonymous at www.cmake.org:/cvsroot/CMake co CMake
(as usual: configure, make, make install)
Then build cmake: ./configure; make; make install
Then enter the kdelibs directory, and enter "cmake ."
Then the configure checks will be executed. If something isn't found, execute
"ccmake ." and set the directories manually.
If Qt 4 wasn't found, either set it manually or set the QTDIR environment
variable.
You can find all configure checks in kdelibs/ConfigureChecks.cmake.
The check_XXX() functions come from the CheckXXX.cmake files located in
kdelibs/cmake/modules/ and from the cmake system module directory,
usually /usr/local/share/CMake/Modules/. So if one of these checks go wrong,
look in these files to see what they are doing.
To see what exactly went wrong, have a look at
kdelibs/CMakeFiles/CMakeError.log
In ConfigureChecks.cmake there are also some checks like
find_package(Foo REQUIRED)
These commands look for a file named "FindFoo.cmake", located either in
kdelibs/cmake/modules/ or the system cmake module directory (as above).
If something isn't found and you know it exists on your system, have a look at
the FindFoo.cmake file.
To understand the commands used there, either read the cmake man page or read
the documentation online: http://www.cmake.org/HTML/Documentation.html (*very
recommded*). also the cmake Wiki: http://www.cmake.org/Wiki/CMake .
Ok, assume this step succeeded, simply run make. Chances are not too bad it
will compile.
If not, the reason is usually a missing include directory or a missing link
library.
The build is specified in the files named CMakeLists.txt.
Important variables are CMAKE_SOURCE_DIR, CMAKE_BINARY_DIR,
CMAKE_CURRENT_SOURCE_DIR and CMAKE_CURRENT_BINARY_DIR, for more information
see http://www.cmake.org/Wiki/CMake_Useful_Variables .
Include directories are added using the include_directories() command.
Additional libraries is linked to using the target_link_libraries() command.
If you try to build it on Mac OS X or under Windows, you will immediately get
an error message (see kdelibs/cmake/modules/FindKDE4.cmake . To get it
working, remove the MESSAGE(FATAL_ERROR ...) from this file and see how far
you get. Probably some of the system checks and FindFoo.cmake files have to
be adjusted, compiler flags etc.
if you need to write additional FindFoo.cmake scripts, you can use the
kdelibs/cmake/generate_findpackage_file script, written in Ruby. It generates
simple generic cmake scripts which follow the cmake style.
If you have questions, please ask on the kde-buildsystem at kde.org mailing list,
there are also two of the cmake developers subscribed. They want cmake to
become the buildsystem for KDE 4.
Have fun
Alex
--
Work: alexander.neundorf AT jenoptik.com - http://www.jenoptik-los.de
Home: neundorf AT kde.org - http://www.kde.org
alex AT neundorf.net - http://www.neundorf.net
More information about the Kde-buildsystem
mailing list