Well I finallly managed to get it thanks to http://qtnode.net/wiki/Qt4_with_cmake
So this is a template of CMakeLists.txt for a classe called "MACLASSE" that would inherit from QObject (which was the problem because you then have to use QT_WRAPP_CPP
cmake_minimum_required(VERSION 2.6)
project(MACLASSE)
set(LIBRARY_OUTPUT_PATH lib)
find_package(Qt4 REQUIRED)
INCLUDE(${QT_USE_FILE})
include_directories(${QT_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR} include)
SET (MACLASSE_SRCS src/MACLASSE.cpp)
SET (MACLASSE_HEADERS include/MACLASSE.h)
MESSAGE( STATUS "sources: " ${MACLASSE_SRCS} )
MESSAGE( STATUS "headers: " ${MACLASSE_HEADERS} )
qt4_wrap_cpp(MACLASSE_HEADERS_MOC ${MACLASSE_HEADERS}) #in there you put the headers and ONLY the headers
add_library(MACLASSE SHARED ${MACLASSE_SRCS} ${MACLASSE_HEADERS_MOC} )
target_link_libraries(MACLASSE ${QT_LIBRARIES})
cmake_minimum_required(VERSION 2.6)
project(MACLASSE)
set(LIBRARY_OUTPUT_PATH lib)
find_package(Qt4 REQUIRED)
INCLUDE(${QT_USE_FILE})
include_directories(${QT_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR} include)
SET (MACLASSE_SRCS src/MACLASSE.cpp)
SET (MACLASSE_HEADERS include/MACLASSE.h)
MESSAGE( STATUS "sources: " ${MACLASSE_SRCS} )
MESSAGE( STATUS "headers: " ${MACLASSE_HEADERS} )
qt4_wrap_cpp(MACLASSE_HEADERS_MOC ${MACLASSE_HEADERS}) #in there you put the headers and ONLY the headers
add_library(MACLASSE SHARED ${MACLASSE_SRCS} ${MACLASSE_HEADERS_MOC} )
target_link_libraries(MACLASSE ${QT_LIBRARIES})
To copy to clipboard, switch view to plain text mode
Bookmarks