From 116772da7effa118a0d49aa0fa1d1def3c3a08f4 Mon Sep 17 00:00:00 2001 From: Kimmo Varis Date: Sun, 31 Jan 2010 12:36:56 +0200 Subject: [PATCH] Make workaround fix for ticket #1299. Since lib does not work when built as an static library, compile lib code as part of cli/gui code. --- CMakeLists.txt | 7 ++++++- cli/CMakeLists.txt | 10 ++++++---- gui/CMakeLists.txt | 10 ++++++---- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 49d449231..efa4e400e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,7 +14,12 @@ cmake_minimum_required (VERSION 2.6) PROJECT(CPPCHECK) -ADD_SUBDIRECTORY(lib) +# Building lib as static library is disabled due to bug +# #1299 CMake: The CheckClass is not used +# https://sourceforge.net/apps/trac/cppcheck/ticket/1299 +# Instead lib code is included directly into cli and gui targets +# ADD_SUBDIRECTORY(lib) + ADD_SUBDIRECTORY(cli) # Exclude tests from command line targets but include them to VS IDE targets. diff --git a/cli/CMakeLists.txt b/cli/CMakeLists.txt index eb1c4f839..88e1819fe 100644 --- a/cli/CMakeLists.txt +++ b/cli/CMakeLists.txt @@ -25,9 +25,11 @@ if (WIN32) endif (WIN32) # Libraries to link -set(CHECK_LIBS - checklib -) +#set(CHECK_LIBS +# checklib +#) + +aux_source_directory(${CPPCHECK_SOURCE_DIR}/lib LIB_SRCS) # Windows needs additional shlwapi library if (WIN32 AND NOT CYGWIN) @@ -45,6 +47,6 @@ if (CMAKE_COMPILER_IS_GNUCXX) endif (CMAKE_COMPILER_IS_GNUCXX) include_directories (${CPPCHECK_SOURCE_DIR}/lib) -ADD_EXECUTABLE(cppcheck ${CHECKCLI_SRCS} ${CHECKCLI_HDRS}) +ADD_EXECUTABLE(cppcheck ${CHECKCLI_SRCS} ${CHECKCLI_HDRS} ${LIB_SRCS}) TARGET_LINK_LIBRARIES(cppcheck ${CHECK_LIBS}) diff --git a/gui/CMakeLists.txt b/gui/CMakeLists.txt index 6d00466b2..4dc95401e 100644 --- a/gui/CMakeLists.txt +++ b/gui/CMakeLists.txt @@ -89,10 +89,12 @@ SET(CHECK_TRANS SET(CHECK_RCCS gui.qrc) +aux_source_directory(${CPPCHECK_SOURCE_DIR}/lib LIB_SRCS) + # Libraries to link -set(CHECK_LIBS - checklib -) +#set(CHECK_LIBS +# checklib +#) # Windows needs additional shlwapi library if (WIN32 AND NOT CYGWIN) @@ -130,7 +132,7 @@ SOURCE_GROUP("Moc Files" "moc_.*cxx$") include_directories(${CMAKE_CURRENT_BINARY_DIR}) ADD_EXECUTABLE(gui WIN32 ${CHECKGUI_SRCS} ${CHECK_MOC_SRCS} ${CHECK_HEADERS} - ${CHECK_UIS_H} ${CHECK_RCC_SRCS}) + ${CHECK_UIS_H} ${CHECK_RCC_SRCS} ${LIB_SRCS}) TARGET_LINK_LIBRARIES(gui ${CHECK_LIBS} ${QT_LIBRARIES}) ELSE(QT4_FOUND)