[CMake] cmake integration

Pavel Volkovitskiy int at mtx.ru
Fri Feb 9 11:31:05 EST 2007


Pavel Volkovitskiy wrote:
> Hello!
>
> I'm trying to implement initial cmake support for conary
> (distributed software management system, 
> http://wiki.rpath.com/wiki/Conary)
> PS: Note, i'm not official developer of it
>
> right now it has good support for configure based applications
>
> let's for example we have "foo" application which uses configure script
> so we will write in foo.recipe:
>
> r.Configure('--extra-arg')
>
> and this will translate into real ./configure call:
> ===================================
> cd /home/int/conary/builds/foo/foo-1.2.3/; \
> CLASSPATH="" CFLAGS="-O2 -g" CXXFLAGS="-O2 -g " CPPFLAGS="" 
> LDFLAGS="-g" CC=gcc CXX=g++  \
> ./configure \
>    --prefix=/usr \
>    --exec-prefix=/usr \
>    --bindir=/usr/bin \
>    --sbindir=/usr/sbin \
>    --sysconfdir=/etc \
>    --datadir=/usr/share \
>    --includedir=/usr/include \
>    --libdir=/usr/lib64 \
>    --libexecdir=/usr/libexec \
>    --localstatedir=/var \
>    --sharedstatedir=/usr/com \
>    --mandir=/usr/share/man \
>    --infodir=/usr/share/info \
>    --extra-arg
> ===================================
>
> after some reading i "translate" this into cmake call:
> ===================================
> cd /home/int/conary/builds/foo/foo-1.2.3/; \
> mkdir -p CMakeObj; cd CMakeObj;  \
> CC=gcc CXX=g++  cmake \
>    -DCMAKE_C_FLAGS:STRING="-O2 -g" \
>    -DCMAKE_CXX_FLAGS:STRING="-O2 -g " \
>    -DCMAKE_EXE_LINKER_FLAGS:STRING="-g" \
>    -DCMAKE_MODULE_LINKER_FLAGS:STRING="-g" \
>    -DCMAKE_SHARED_LINKER_FLAGS:STRING="-g" \
>    -DCMAKE_INSTALL_PREFIX:PATH="/usr" \
>    -DEXTRA_ARG=YES \
>    /home/int/conary/builds/foo/foo-1.2.3/
> ===================================
>
> I assume that all cmake based projects work well with out-of-source 
> build (srcdir!=objdir)
> Also it seems there is no standart way to specify libdir = /usr/lib or 
> /usr/lib64 ?
> Am I right there is no equivalent for LDFLAGS?
>
> We prefer this to be close to configure call for convenience
>
> Any comments?
>
Looks like cmake's developers doesn't plan world domination? :)
Or may be it's not possible to use generic rules to run cmake's based 
make-system?

I have another question too...
conary has ability to autodiscover build reqs for auto* make-system

so i want to implement same feature for cmake's make-system
Now i'm looking for requirements in CMakeCache.txt
(search lines like ASPELL_LIBRARIES:FILEPATH=/usr/lib64/libaspell.so)

but some CMakeLists.txt uses something like this:
"""
IF(ASPELL_FOUND AND NOT USE_KDE3)
...
ELSE(ASPELL_FOUND AND NOT USE_KDE3)
  IF(USE_KDE3)
    MESSAGE(STATUS "Spell plugin is disabled when building with KDE")
"""
ie checks for aspell in any case, so if we cooking package with kde support
we will have autodiscovered build requirement which is not really needed.
Is this may be checked somehow? if any way exist to dump only really 
used variables?
Or maybe this CMakeList just bad written?

-- 
Pavel


More information about the CMake mailing list