2015-02-13 19:00:14 +01:00
|
|
|
file(GLOB hdrs "*.h")
|
|
|
|
file(GLOB srcs "*.cpp")
|
|
|
|
file(GLOB mainfile "main.cpp")
|
|
|
|
list(REMOVE_ITEM srcs ${mainfile})
|
|
|
|
|
2020-11-22 08:57:07 +01:00
|
|
|
add_library(cli_objs OBJECT ${hdrs} ${srcs})
|
2021-10-30 09:08:07 +02:00
|
|
|
target_include_directories(cli_objs PRIVATE ${PROJECT_SOURCE_DIR}/lib/)
|
|
|
|
if(USE_BUNDLED_TINYXML2)
|
|
|
|
target_include_directories(cli_objs PRIVATE ${PROJECT_SOURCE_DIR}/externals/tinyxml2/)
|
2022-09-06 18:30:59 +02:00
|
|
|
else()
|
|
|
|
target_include_directories(cli_objs SYSTEM PRIVATE ${tinyxml2_INCLUDE_DIRS})
|
2021-10-30 09:08:07 +02:00
|
|
|
endif()
|
|
|
|
target_include_directories(cli_objs PRIVATE ${PROJECT_SOURCE_DIR}/externals/simplecpp/)
|
2023-01-26 22:13:07 +01:00
|
|
|
if (BUILD_CORE_DLL)
|
|
|
|
target_compile_definitions(cli_objs PRIVATE CPPCHECKLIB_IMPORT TINYXML2_IMPORT)
|
|
|
|
endif()
|
2020-11-22 08:57:07 +01:00
|
|
|
|
2022-03-13 20:07:58 +01:00
|
|
|
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 14)
|
|
|
|
# false positive warning in up to Clang 13 - caused by FD_ZERO macro
|
2022-07-24 10:17:11 +02:00
|
|
|
set_source_files_properties(processexecutor.cpp PROPERTIES COMPILE_FLAGS -Wno-reserved-identifier)
|
2022-03-13 20:07:58 +01:00
|
|
|
endif()
|
|
|
|
|
2023-01-26 22:13:07 +01:00
|
|
|
list(APPEND cppcheck_SOURCES ${hdrs} ${mainfile} $<TARGET_OBJECTS:cli_objs>)
|
|
|
|
if (NOT BUILD_CORE_DLL)
|
|
|
|
list(APPEND cppcheck_SOURCES $<TARGET_OBJECTS:cppcheck-core>)
|
|
|
|
list(APPEND cppcheck_SOURCES $<TARGET_OBJECTS:simplecpp_objs>)
|
|
|
|
if(USE_BUNDLED_TINYXML2)
|
|
|
|
list(APPEND cppcheck_SOURCES $<TARGET_OBJECTS:tinyxml2_objs>)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
if (WIN32)
|
|
|
|
list(APPEND cppcheck_SOURCES version.rc)
|
2020-11-22 08:57:07 +01:00
|
|
|
endif()
|
|
|
|
|
|
|
|
add_executable(cppcheck ${cppcheck_SOURCES})
|
2021-10-30 09:08:07 +02:00
|
|
|
target_include_directories(cppcheck PRIVATE ${PROJECT_SOURCE_DIR}/lib/)
|
|
|
|
if(USE_BUNDLED_TINYXML2)
|
|
|
|
target_include_directories(cppcheck PRIVATE ${PROJECT_SOURCE_DIR}/externals/tinyxml2/)
|
2022-09-06 18:30:59 +02:00
|
|
|
else()
|
|
|
|
target_include_directories(cppcheck SYSTEM PRIVATE ${tinyxml2_INCLUDE_DIRS})
|
2021-10-30 09:08:07 +02:00
|
|
|
endif()
|
|
|
|
target_include_directories(cppcheck PRIVATE ${PROJECT_SOURCE_DIR}/externals/simplecpp/)
|
2015-11-26 20:25:09 +01:00
|
|
|
if (HAVE_RULES)
|
2019-01-18 21:13:35 +01:00
|
|
|
target_link_libraries(cppcheck ${PCRE_LIBRARY})
|
2020-05-27 05:15:46 +02:00
|
|
|
endif()
|
2018-07-15 22:26:02 +02:00
|
|
|
if (WIN32 AND NOT BORLAND)
|
2021-03-29 17:04:42 +02:00
|
|
|
if(NOT MINGW)
|
|
|
|
target_link_libraries(cppcheck Shlwapi.lib)
|
|
|
|
else()
|
|
|
|
target_link_libraries(cppcheck shlwapi)
|
|
|
|
endif()
|
2017-10-18 17:38:15 +02:00
|
|
|
endif()
|
2020-11-22 08:57:07 +01:00
|
|
|
if(tinyxml2_FOUND AND NOT USE_BUNDLED_TINYXML2)
|
2022-03-15 21:17:03 +01:00
|
|
|
target_link_libraries(cppcheck ${tinyxml2_LIBRARIES})
|
2020-11-22 08:57:07 +01:00
|
|
|
endif()
|
2022-07-08 16:42:57 +02:00
|
|
|
target_link_libraries(cppcheck ${CMAKE_THREAD_LIBS_INIT})
|
2023-01-26 22:13:07 +01:00
|
|
|
if (BUILD_CORE_DLL)
|
|
|
|
target_link_libraries(cppcheck cppcheck-core)
|
|
|
|
endif()
|
2015-02-13 19:00:14 +01:00
|
|
|
|
2021-08-12 20:17:51 +02:00
|
|
|
add_dependencies(cppcheck copy_cfg)
|
|
|
|
add_dependencies(cppcheck copy_addons)
|
2023-01-26 22:05:40 +01:00
|
|
|
add_dependencies(cppcheck copy_platforms)
|
2022-02-16 07:06:59 +01:00
|
|
|
add_dependencies(cppcheck run-dmake)
|
2021-08-12 20:17:51 +02:00
|
|
|
|
2015-02-13 19:00:14 +01:00
|
|
|
install(TARGETS cppcheck
|
2015-11-26 20:25:09 +01:00
|
|
|
RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR}
|
2015-02-13 19:00:14 +01:00
|
|
|
COMPONENT applications)
|
|
|
|
|
2019-08-17 10:53:07 +02:00
|
|
|
install(FILES ${addons}
|
|
|
|
DESTINATION ${FILESDIR}/addons
|
|
|
|
COMPONENT headers)
|
|
|
|
|
2015-02-13 19:00:14 +01:00
|
|
|
install(FILES ${cfgs}
|
2019-08-17 10:53:07 +02:00
|
|
|
DESTINATION ${FILESDIR}/cfg
|
2015-02-13 19:00:14 +01:00
|
|
|
COMPONENT headers)
|
2019-08-17 10:53:07 +02:00
|
|
|
|
|
|
|
install(FILES ${platforms}
|
|
|
|
DESTINATION ${FILESDIR}/platforms
|
|
|
|
COMPONENT headers)
|
|
|
|
|