[CMake] merging autotool project and qt project

Marie-Christine Vallet mmvallet at ucdavis.edu
Tue Jul 31 15:20:54 EDT 2007


Qt: 3.3.8
KDE: 3.5.7-0.1.fc6 Fedora
KDevelop: 3.4.1

Hi,
I have an application for which I  am developing a qt UI. I looked on
the web for solution in integrating these two and someone suggested
(from the qt list) to use cmake.
I looked into documentation and did not find a tutorial/documentation
that dealt with the same problem.
Could someone help me out?
My native application (without qt) uses autotools. My configure.ac file
basically changes the flags according to the platform and the compiler
used as show below.
The qt part of my application uses .pro file. When I compile this part,
I generate moc_ files automatically.
How to proceed?

Thanks,

Marie

--configure.ac

AC_PREREQ(2.59)
AC_INIT(smech, 1.0, BUG-REPORT-ADDRESS)
AM_INIT_AUTOMAKE([foreign])
AC_CONFIG_SRCDIR([src/alf_gmp.c])
AM_CONFIG_HEADER([config.h])


# Checks for programs.
AC_PROG_INSTALL


# Checks for libraries.
AC_PATH_PROG(CC_PATH, $CC, NO_PATH)
if test "$CC_PATH" = NO_PATH; then
CC="icc"
fi

AC_PATH_PROG(FC_PATH, $F77, NO_PATH)
if test "$FC_PATH" = NO_PATH; then
F77="ifort"
fi

AC_PROG_F77([$F77])
AC_PROG_CC([$CC])
AC_PROG_CXX([$CC])



# Check system type
case "$OSTYPE" in
#mac configuration
*darwin* | *rhapsody* | *macosx*)
   case  "${F77}" in
     ## Intel compiler
     *ifort*)
         FFLAGS="-c -u -O3 -mp1 -w90 -w95 -cpp $FFLAGS"
        LIBRARIES="-L"`echo $DYLD_LIBRARY_PATH| awk '{ gsub(/:/, " -L");
print }'`
         LDFLAGS="-O3 -Kc++ -mp1 -bind_at_load $LDFLAGS $LIBRARIES"
         ;;
     esac
   case  "${CC}" in
     ## Intel compiler
     *icc*)
         CPPFLAGS="-c -O3 -mp1 -Kc++ -Dintel $CFLAGS"
         ;;
     esac
    AC_CHECK_LIB(imf,main,,AC_MSG_ERROR(Cannot find lib imf ))
    AC_CHECK_LIB(irc,main,,AC_MSG_ERROR(Cannot find lib irc ))
    AC_CHECK_LIB(ifcore,main,,AC_MSG_ERROR(Cannot find lib ifcore $LIBS))
    AC_MSG_RESULT(8. icc loop F77:$F77 CC:$CC FFLAGS:$FFLAGS)
;;
#linux configuration
linux*)

   case  "${F77}" in
     ## Intel compiler
     *ifort*)
         LIBRARIES="-L"`echo $DYLD_LIBRARY_PATH| awk '{ gsub(/:/, "
-L"); print }'`
         LDFLAGS="-C -Kc++ -mp1 $LDFLAGS $LIBRARIES"
         FFLAGS="-c -u -C -mp1 -w90 -w95 -cpp $FFLAGS"
         AC_CHECK_LIB(ifcore,main,,AC_MSG_ERROR(Cannot find lib ifcore
$LIBS))
         ;;
     *g77*)#if lib not found then stop the configuration
         LIBRARIES="-L"`locate libg2c.a | sed -e "s/libg2c.a//"`
         LDFLAGS="-O $LDFLAGS $LIBRARIES"
         FFLAGS="-c -u -O -x f77-cpp-input $FFLAGS"
         AC_CHECK_LIB([g2c], [main],,AC_MSG_ERROR(Cannot find lib g2c
in $LIBRARIES))
         AC_CHECK_LIB(stdc++,main,,AC_MSG_ERROR(Cannot find lib stdc++))
         AC_CHECK_LIB(gcc,main,,AC_MSG_ERROR(Cannot find lib gcc))
         AC_CHECK_LIB(c,main,,AC_MSG_ERROR(Cannot find lib c))
         ;;
     esac
   case  "${CC}" in
     ## Intel compiler
     *icc*)
         AC_MSG_RESULT(6. icc loop F77:$F77 CC:$CC)
         CPPFLAGS="-c -C -mp1 -Kc++ -Dintel $CPPFLAGS"
         ;;
     *g++*)
         AC_MSG_RESULT(7. g++ loop F77:$F77 CC:$CC)
         CPPFLAGS="-c -Wall -O $CPPFLAGS"
         ;;
     esac
;;
*)

    AC_DEFINE_UNQUOTED(OTHEROS,1,[Some strange OS])
;;
esac

#common libraries
AC_CHECK_LIB(gmp,main,,AC_MSG_ERROR(Cannot find lib gmp ))
AC_CHECK_LIB(m, main,,AC_MSG_ERROR(Cannot find lib m ))
AC_CHECK_LIB(GL,main,,AC_MSG_ERROR(Cannot find lib gl ))
AC_CHECK_LIB(GLU,main,,AC_MSG_ERROR(Cannot find lib glu ))

# substitutions
#  AC_SUBST(ifcore_libraries)
AC_SUBST(LDFLAGS)
AC_SUBST(CPPFLAGS)
AC_SUBST(FFLAGS)


# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([float.h stddef.h stdlib.h string.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_CONST
AC_C_INLINE
AC_FUNC_OBSTACK
AC_TYPE_SIZE_T

AC_CONFIG_FILES([ Makefile
src/Makefile
])
#
# # Checks for library functions.
AC_FUNC_ERROR_AT_LINE
AC_FUNC_MALLOC
AC_CHECK_FUNCS([floor modf sqrt])


# Checks for header files.
# Checks for typedefs, structures, and compiler characteristics.
# Checks for library functions.
AC_OUTPUT
--------------------------------------------------------------------------------------------------




--- src/qtapplication.pro file

SOURCES += main.cpp \
interface.cpp \
csbdmainwindow.cpp \
csbdmdiwindow.cpp \
signalmultiplexer.cpp \
csbdfileopenoptionsdg.cpp
HEADERS += interface.h \
csbdmainwindow.h \
csbdmdiwindow.h \
signalmultiplexer.h \
csbdfileopenoptionsdg.h

TEMPLATE = app

CONFIG += release \
          warn_on \
          thread \
          qt \
          opengl

TARGET = ../bin/qtskinmesh


FORMS += MDIWindow.Qt3.ui \
fileopenoptionsdg.Qt3.ui \
mainwindow.Qt3.ui

DESTDIR = .


LIBS += -lQGLViewer

TRANSLATIONS += translations/skinmesh_fr.ts

DISTFILES += images/colors.png \
images/editcopy.png \
images/editcut.png \
images/editfind.png \
images/editpaste.png \
images/editredo.png \
images/editundo.png \
images/exec.png \
images/exit.png \
images/fileopen.png \
images/fileprint.png \
images/filesaveas.png \
images/filesave.png \
images/skindraw.png \
images/skinmesh.png \
images/viewBondedSpheres.png \
images/viewDelonay.png \
images/viewMixedCells2.png \
images/viewNonBondedSpheres.png \
images/viewVoronoi.png \
images/wizard.png \
images/xload.png \
filesnapshot.png \
----------------------------------------------------------



More information about the CMake mailing list