2009-12-14 17:30:02 +01:00
|
|
|
# Minimal CMake build file to build cppcheck Qt GUI
|
|
|
|
|
|
|
|
# find and setup Qt4 for this project
|
2010-01-23 19:33:37 +01:00
|
|
|
find_package(Qt4)
|
|
|
|
|
|
|
|
IF(QT4_FOUND)
|
2009-12-14 17:30:02 +01:00
|
|
|
|
|
|
|
# Add needed Qt modules
|
|
|
|
set(QT_USE_QTMAIN TRUE)
|
|
|
|
set(QT_USE_QTXML TRUE)
|
|
|
|
include(${QT_USE_FILE})
|
|
|
|
|
2009-12-19 17:15:48 +01:00
|
|
|
include_directories (${CPPCHECK_SOURCE_DIR}/lib)
|
|
|
|
# Generated files (in build directory) need to know gui directory
|
|
|
|
include_directories (${CPPCHECK_SOURCE_DIR}/gui)
|
|
|
|
|
2009-12-14 17:30:02 +01:00
|
|
|
# Header files - listed for mocking
|
|
|
|
SET(CHECK_HEADERS
|
|
|
|
aboutdialog.h
|
|
|
|
applicationdialog.h
|
|
|
|
applicationlist.h
|
|
|
|
checkthread.h
|
|
|
|
common.h
|
|
|
|
csvreport.h
|
|
|
|
fileviewdialog.h
|
|
|
|
mainwindow.h
|
|
|
|
projectfile.h
|
|
|
|
report.h
|
|
|
|
resultstree.h
|
|
|
|
resultsview.h
|
|
|
|
settingsdialog.h
|
|
|
|
threadhandler.h
|
|
|
|
threadresult.h
|
|
|
|
translationhandler.h
|
|
|
|
txtreport.h
|
|
|
|
xmlreport.h
|
|
|
|
)
|
|
|
|
|
|
|
|
# Source files
|
|
|
|
SET(CHECKGUI_SRCS
|
|
|
|
aboutdialog.cpp
|
|
|
|
applicationdialog.cpp
|
|
|
|
applicationlist.cpp
|
|
|
|
checkthread.cpp
|
|
|
|
csvreport.cpp
|
|
|
|
fileviewdialog.cpp
|
|
|
|
main.cpp
|
|
|
|
mainwindow.cpp
|
|
|
|
projectfile.cpp
|
|
|
|
report.cpp
|
|
|
|
resultstree.cpp
|
|
|
|
resultsview.cpp
|
|
|
|
settingsdialog.cpp
|
|
|
|
threadhandler.cpp
|
|
|
|
threadresult.cpp
|
|
|
|
translationhandler.cpp
|
|
|
|
txtreport.cpp
|
|
|
|
xmlreport.cpp
|
|
|
|
)
|
|
|
|
|
2009-12-19 15:54:38 +01:00
|
|
|
# Add Windows resource file
|
|
|
|
if (WIN32)
|
|
|
|
SET(CHECKGUI_SRCS
|
|
|
|
${CHECKGUI_SRCS}
|
|
|
|
cppcheck-gui.rc
|
|
|
|
)
|
|
|
|
endif (WIN32)
|
|
|
|
|
2009-12-14 17:30:02 +01:00
|
|
|
# UI files
|
|
|
|
SET(CHECK_UIS
|
|
|
|
about.ui
|
|
|
|
application.ui
|
|
|
|
file.ui
|
|
|
|
main.ui
|
|
|
|
resultsview.ui
|
|
|
|
settings.ui
|
|
|
|
)
|
|
|
|
|
2009-12-14 21:45:07 +01:00
|
|
|
# Translation files
|
|
|
|
SET(CHECK_TRANS
|
|
|
|
cppcheck_de.ts
|
|
|
|
cppcheck_fi.ts
|
|
|
|
cppcheck_pl.ts
|
|
|
|
cppcheck_se.ts
|
|
|
|
cppcheck_en.ts
|
|
|
|
cppcheck_nl.ts
|
|
|
|
cppcheck_ru.ts
|
|
|
|
)
|
|
|
|
|
2009-12-14 17:43:44 +01:00
|
|
|
SET(CHECK_RCCS gui.qrc)
|
|
|
|
|
2009-12-19 15:21:46 +01:00
|
|
|
# Libraries to link
|
2009-12-17 21:31:13 +01:00
|
|
|
set(CHECK_LIBS
|
|
|
|
checklib
|
|
|
|
)
|
2009-12-19 15:21:46 +01:00
|
|
|
|
|
|
|
# Windows needs additional shlwapi library
|
|
|
|
if (WIN32 AND NOT CYGWIN)
|
2009-12-17 21:31:13 +01:00
|
|
|
set(CHECK_LIBS
|
2009-12-19 15:21:46 +01:00
|
|
|
${CHECK_LIBS}
|
|
|
|
shlwapi
|
2009-12-17 21:31:13 +01:00
|
|
|
)
|
|
|
|
endif (WIN32 AND NOT CYGWIN)
|
|
|
|
|
2009-12-20 09:45:57 +01:00
|
|
|
if (CMAKE_COMPILER_IS_GNUCXX)
|
|
|
|
set(CMAKE_CXX_FLAGS
|
|
|
|
${CMAKE_CXX_FLAGS}
|
|
|
|
"-Wall"
|
|
|
|
)
|
|
|
|
endif (CMAKE_COMPILER_IS_GNUCXX)
|
|
|
|
|
2009-12-14 17:43:44 +01:00
|
|
|
# Generate rules for building source files from the resources
|
|
|
|
QT4_ADD_RESOURCES(CHECK_RCC_SRCS ${CHECK_RCCS})
|
|
|
|
|
2009-12-14 17:30:02 +01:00
|
|
|
# Process UI files
|
|
|
|
QT4_WRAP_UI(CHECK_UIS_H ${CHECK_UIS})
|
|
|
|
|
|
|
|
# Mock header files
|
|
|
|
QT4_WRAP_CPP(CHECK_MOC_SRCS ${CHECK_HEADERS})
|
|
|
|
|
2009-12-14 21:45:07 +01:00
|
|
|
# add translations ...
|
|
|
|
QT4_ADD_TRANSLATION(CHECK_QM ${CHECK_TRANS})
|
|
|
|
|
2010-01-03 20:01:40 +01:00
|
|
|
# Create folders for Visual Studio IDE
|
|
|
|
SOURCE_GROUP("Header Files" FILES ${CHECK_HEADERS})
|
|
|
|
SOURCE_GROUP("Ui Files" ".ui$")
|
|
|
|
SOURCE_GROUP("Moc Files" "moc_.*cxx$")
|
|
|
|
|
2009-12-14 17:30:02 +01:00
|
|
|
# Include binary directory where code from UI files gets created
|
|
|
|
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
|
2010-01-03 20:01:40 +01:00
|
|
|
ADD_EXECUTABLE(gui WIN32 ${CHECKGUI_SRCS} ${CHECK_MOC_SRCS} ${CHECK_HEADERS}
|
|
|
|
${CHECK_UIS_H} ${CHECK_RCC_SRCS})
|
2009-12-17 21:31:13 +01:00
|
|
|
TARGET_LINK_LIBRARIES(gui ${CHECK_LIBS} ${QT_LIBRARIES})
|
2009-12-14 17:30:02 +01:00
|
|
|
|
2010-01-23 19:33:37 +01:00
|
|
|
ENDIF(QT4_FOUND)
|