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/)
|
|
|
|
endif()
|
|
|
|
target_include_directories(cli_objs PRIVATE ${PROJECT_SOURCE_DIR}/externals/simplecpp/)
|
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
|
|
|
|
set_source_files_properties(threadexecutor.cpp PROPERTIES COMPILE_FLAGS -Wno-reserved-identifier)
|
|
|
|
endif()
|
|
|
|
|
2020-11-22 08:57:07 +01:00
|
|
|
list(APPEND cppcheck_SOURCES ${hdrs} ${mainfile} $<TARGET_OBJECTS:cli_objs> $<TARGET_OBJECTS:lib_objs> $<TARGET_OBJECTS:simplecpp_objs>)
|
|
|
|
if(USE_BUNDLED_TINYXML2)
|
|
|
|
list(APPEND cppcheck_SOURCES $<TARGET_OBJECTS:tinyxml2_objs>)
|
|
|
|
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/)
|
|
|
|
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})
|
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)
|
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)
|
|
|
|
|