[CMake] Compiling a project that uses Qt

Pascale B chose29 at hotmail.com
Wed May 27 13:04:00 EDT 2009


Hi,

   I have a project developed in visual Studio 2008, in C++. I was asked to compile it in Linux. I'm completely new to using CMAKE. I have created a CMakeLists.txt file for my project and was able to build successfully one library. However my main program needs Qt applications to run.  Here is the file I have, I get an error of the type : QApplication no such file of directories. QApplication is included in this way: #include <QApplication> in top of a cpp file.

Also I have moc files generated by Qt in my program, I have read about qt4_wrap_cpp, however I use qt3. What are the equivalent commands for qt3?

   Sorry if this question seems redundant for the mailing lists. I have read some posts concerning this but no one that could clearly guide me to the correct way.

Thanks in advance for the much needed help or references,
Pascale

_________________________________________________________________________
cmake_minimum_required(VERSION 2.6)
        
project(MyProg)

SET(CMAKE_BUILD_TYPE debug)
set(EXECUTABLE_OUTPUT_PATH bin/${CMAKE_BUILD_TYPE})

# -- to include openGL, automatic detection by CMAKE
INCLUDE(FindOpenGL)
INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR})


# Here is where I'm having problems...
find_package(Qt3 REQUIRED)
add_definitions(${QT_DEFINITIONS})
include_directories(${QT_INCLUDE_DIR})

INCLUDE_DIRECTORIES(src)
INCLUDE_DIRECTORIES(inc)

# -- Génération de la liste des fichiers sources
file(
    GLOB_RECURSE
    source_files_3D
    src/*
    inc/*
)

# -- Déclaration de l'exécutable
add_executable(
    MyProg_3D
    ${source_files_3D}
)

# On link notre projet avec les libs OpenGL
TARGET_LINK_LIBRARIES( MyProg_3D ${OPENGL_LIBRARIES})


_________________________________________________________________
Windows Live helps you keep up with all your friends, in one place.
http://go.microsoft.com/?linkid=9660826
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090527/5df27c2e/attachment.htm>


More information about the CMake mailing list