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
|
|
|
|
|
|
|
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()
|
|
|
|
if (USE_Z3)
|
|
|
|
target_link_libraries(cppcheck ${Z3_LIBRARIES})
|
2015-11-26 20:25:09 +01: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-02-06 13:02:52 +01:00
|
|
|
target_link_libraries(cppcheck ${tinyxml2_LIBRARY})
|
2020-11-22 08:57:07 +01:00
|
|
|
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)
|
|
|
|
|
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)
|
|
|
|
|