PROJECT(lmledit) INCLUDE(CheckIncludeFile) INCLUDE(CheckLibraryExists) #INCLUDE(./MacroCreateProFile.cmake) # apt-get install libpcre3-dev CHECK_INCLUDE_FILE("pcre.h" HAVE_PCRE_H) # XXX we should search in more directories CHECK_LIBRARY_EXISTS("pcre" "pcre_compile" "/usr/lib" HAVE_PCRE_LIB) IF (NOT HAVE_PCRE_H OR NOT HAVE_PCRE_LIB) MESSAGE(FATAL_ERROR "PCRE development files not found. Please install libpcre3-dev") ENDIF (NOT HAVE_PCRE_H OR NOT HAVE_PCRE_LIB) # apt-get install libqt4-dev INCLUDE(FindQt4) IF (NOT QT4_FOUND) MESSAGE(FATAL_ERROR "Qt4 development files not found. Please install libqt4-dev") ENDIF (NOT QT4_FOUND) INCLUDE(${QT_USE_FILE}) ADD_DEFINITIONS(${QT_DEFINITIONS}) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} ${QT_INCLUDE_DIR} ${QT_QTGUI_INCLUDE_DIR}) LINK_DIRECTORIES(${QT_LIBRARY_DIR}) SET(GUI_SRCS configdialog.cpp helpwindow.cpp highlighter.cpp mainwindow.cpp regex-pcre.cpp rule-editor.cpp ruleset-parser/parser.cpp ruleset-parser/rule.cpp ruleset-parser/ruleset.cpp ) SET(GUI_HDRS configdialog.h helpwindow.h highlighter.h mainwindow.h regex-pcre.h rule-editor.h ruleset-parser/parser.h ruleset-parser/rule.h ruleset-parser/ruleset.h ) # there's a typo in cmake documentation: QT4_ADD_RESOURCES (with an S) QT4_ADD_RESOURCES(GUI_SRCS application.qrc) # for this to work, $name.cpp file must include $name.moc QT4_AUTOMOC( ${GUI_SRCS} ) SET(lmledit_UIS ui/dialogConfig.ui ui/helpwindow.ui ui/mainwindow.ui ui/rule-editor.ui ) QT4_WRAP_UI(lmledit_UIS_H ${lmledit_UIS}) ADD_EXECUTABLE("lmledit" main.cpp ${GUI_SRCS} ${GUI_HDRS} ${lmledit_UIS_H} ) #QT4_GENERATE_MOC(${CMAKE_CURRENT_SOURCE_DIR}/mainwindow.h ${CMAKE_CURRENT_BINARY_DIR}/moc_mainwindow.cpp) ##QT4_AUTOMOC(${GUI_HDRS) TARGET_LINK_LIBRARIES(lmledit ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} "pcre") # For Qt-4 translations SET(ts_files "lmledit_fr.ts") add_custom_target(lupdate COMMAND "lupdate" "*.cpp" "*.h" "ruleset-parser/*.cpp" "ruleset-parser/*.h" "ui/*.ui" -ts "${ts_files}" WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMENT "Runs lupdate command" ) add_custom_target(lrelease COMMAND "lrelease" "${ts_files}" WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMENT "Runs lrelease command" )