Conditional inclusion of TinyXML source files in the CLI CMake script (bug #2679, #2524)

The source files for the class library "TinyXML" will only be included into
the build of the command line interface if the library "PCRE" was found before.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
This commit is contained in:
Markus Elfring 2011-04-06 16:30:23 +02:00
parent a5540e8548
commit 796761d582
1 changed files with 13 additions and 10 deletions

View File

@ -1,24 +1,29 @@
# Minimal CMake build file to build cppcheck command line executable
include_directories("${CPPCHECK_SOURCE_DIR}/lib")
if(PCRE_FOUND)
add_definitions(-DHAVE_RULES)
include_directories("${PCRE_INCLUDE_DIR}")
set(TINYXML_INCLUDE_DIR "${CPPCHECK_SOURCE_DIR}/externals/tinyxml/")
include_directories("${PCRE_INCLUDE_DIR}" "${TINYXML_INCLUDE_DIR}")
set(CHECK_LIBS ${PCRE_LIBRARIES})
endif()
set(TINYXML_INCLUDE_DIR "${CPPCHECK_SOURCE_DIR}/externals/tinyxml/")
SET(CHECKCLI_SRCS
cmdlineparser.cpp
cppcheckexecutor.cpp
filelister.cpp
main.cpp
threadexecutor.cpp
pathmatch.cpp
"${TINYXML_INCLUDE_DIR}tinystr.cpp"
"${TINYXML_INCLUDE_DIR}tinyxml.cpp"
"${TINYXML_INCLUDE_DIR}tinyxmlerror.cpp"
"${TINYXML_INCLUDE_DIR}tinyxmlparser.cpp")
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()
set(CPPCHECK_LIB_DIR "${CPPCHECK_SOURCE_DIR}/lib/")
include("${CPPCHECK_LIB_DIR}library_sources.cmake")
@ -37,7 +42,5 @@ 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)
include_directories("${CPPCHECK_SOURCE_DIR}/lib"
"${TINYXML_INCLUDE_DIR}")
add_executable(cppcheck ${CHECKCLI_SRCS} ${CPPCHECK_LIB_SOURCES})
TARGET_LINK_LIBRARIES(cppcheck ${CHECK_LIBS})