diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,6 +37,7 @@ add_custom_target(check-all) add_custom_target(check) add_custom_target(check-symbols) +add_custom_target(check-security) add_subdirectory(src) add_subdirectory(test) diff --git a/cmake/modules/BinaryTest.cmake b/cmake/modules/BinaryTest.cmake --- a/cmake/modules/BinaryTest.cmake +++ b/cmake/modules/BinaryTest.cmake @@ -17,3 +17,21 @@ add_dependencies(check-symbols "${CUSTOM_TARGET_NAME}") endif() endmacro() + +macro(add_to_security_check BINARY) + set(CUSTOM_TARGET_NAME "check-security-${BINARY}") + add_custom_target("${CUSTOM_TARGET_NAME}" + COMMAND + ${CMAKE_COMMAND} -E echo "Running security-check.py on ${BINARY}..." + COMMAND + "${PYTHON_EXECUTABLE}" + "${CMAKE_SOURCE_DIR}/contrib/devtools/security-check.py" + "${BINARY}" + DEPENDS + "${BINARY}" + ) + + if(TARGET check-security) + add_dependencies(check-security "${CUSTOM_TARGET_NAME}") + endif() +endmacro() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -460,6 +460,7 @@ target_link_libraries(bitcoin-cli common rpcclient Event) add_to_symbols_check(bitcoin-cli) + add_to_security_check(bitcoin-cli) endif() # bitcoin-tx @@ -472,6 +473,7 @@ target_link_libraries(bitcoin-tx bitcoinconsensus) add_to_symbols_check(bitcoin-tx) + add_to_security_check(bitcoin-tx) endif() # bitcoind @@ -481,6 +483,7 @@ target_sources(bitcoind PRIVATE bitcoind-res.rc) endif() add_to_symbols_check(bitcoind) +add_to_security_check(bitcoind) # Bitcoin-qt if(BUILD_BITCOIN_QT) diff --git a/src/qt/CMakeLists.txt b/src/qt/CMakeLists.txt --- a/src/qt/CMakeLists.txt +++ b/src/qt/CMakeLists.txt @@ -281,6 +281,7 @@ include(BinaryTest) add_to_symbols_check(bitcoin-qt) +add_to_security_check(bitcoin-qt) # Test tests add_subdirectory(test) diff --git a/src/seeder/CMakeLists.txt b/src/seeder/CMakeLists.txt --- a/src/seeder/CMakeLists.txt +++ b/src/seeder/CMakeLists.txt @@ -15,3 +15,4 @@ include(BinaryTest) add_to_symbols_check(bitcoin-seeder) +add_to_security_check(bitcoin-seeder)