2011-03-25 07:14:53 +01:00
|
|
|
# Minimal CMake build file to build cppcheck command line executable
|
|
|
|
|
2011-04-06 16:30:23 +02:00
|
|
|
include_directories("${CPPCHECK_SOURCE_DIR}/lib")
|
|
|
|
|
2011-04-02 13:25:18 +02:00
|
|
|
if(PCRE_FOUND)
|
|
|
|
add_definitions(-DHAVE_RULES)
|
2011-04-06 16:30:23 +02:00
|
|
|
set(TINYXML_INCLUDE_DIR "${CPPCHECK_SOURCE_DIR}/externals/tinyxml/")
|
|
|
|
include_directories("${PCRE_INCLUDE_DIR}" "${TINYXML_INCLUDE_DIR}")
|
2011-04-02 13:25:18 +02:00
|
|
|
set(CHECK_LIBS ${PCRE_LIBRARIES})
|
|
|
|
endif()
|
|
|
|
|
2011-03-25 07:14:53 +01:00
|
|
|
SET(CHECKCLI_SRCS
|
|
|
|
cmdlineparser.cpp
|
|
|
|
cppcheckexecutor.cpp
|
|
|
|
filelister.cpp
|
|
|
|
main.cpp
|
2011-03-26 02:03:52 +01:00
|
|
|
pathmatch.cpp
|
2011-04-06 16:30:23 +02:00
|
|
|
threadexecutor.cpp)
|
|
|
|
|
|
|
|
if(PCRE_FOUND)
|
|
|
|
set(CHECKCLI_SRCS ${CHECKCLI_SRCS}
|
|
|
|
"${TINYXML_INCLUDE_DIR}tinystr.cpp"
|
|
|
|
"${TINYXML_INCLUDE_DIR}tinyxml.cpp"
|
|
|
|
"${TINYXML_INCLUDE_DIR}tinyxmlerror.cpp"
|
|
|
|
"${TINYXML_INCLUDE_DIR}tinyxmlparser.cpp")
|
|
|
|
endif()
|
2011-03-25 07:14:53 +01:00
|
|
|
|
|
|
|
set(CPPCHECK_LIB_DIR "${CPPCHECK_SOURCE_DIR}/lib/")
|
|
|
|
include("${CPPCHECK_LIB_DIR}library_sources.cmake")
|
|
|
|
|
|
|
|
if(WIN32)
|
|
|
|
# Add Windows resource file
|
2011-03-26 02:03:52 +01:00
|
|
|
set(CHECKCLI_SRCS ${CHECKCLI_SRCS} cppcheck.rc)
|
2011-03-25 07:14:53 +01:00
|
|
|
|
|
|
|
if(NOT CYGWIN)
|
|
|
|
# Windows needs additional shlwapi library.
|
|
|
|
set(CHECK_LIBS ${CHECK_LIBS} shlwapi)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (CMAKE_COMPILER_IS_GNUCXX)
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic -Wshadow -Wno-long-long -Wfloat-equal -Wcast-qual")
|
|
|
|
endif (CMAKE_COMPILER_IS_GNUCXX)
|
|
|
|
|
|
|
|
add_executable(cppcheck ${CHECKCLI_SRCS} ${CPPCHECK_LIB_SOURCES})
|
2011-03-26 19:01:41 +01:00
|
|
|
TARGET_LINK_LIBRARIES(cppcheck ${CHECK_LIBS})
|