From 1f054eca4e779cfa5f9f6e9278071adf65e5eafe Mon Sep 17 00:00:00 2001 From: fanquake Date: Thu, 5 Sep 2024 15:47:13 +0100 Subject: [PATCH] cmake: add USE_SOURCE_PERMISSIONS to all configure_file usage `USE_SOURCE_PERMISSIONS` is the default, so this should not change behaviour. However, being explicit makes it clear what we are doing. Related to #30815. See https://cmake.org/cmake/help/latest/command/configure_file.html#options. --- CMakeLists.txt | 8 ++++---- cmake/module/GenerateSetupNsi.cmake | 2 +- cmake/module/Maintenance.cmake | 4 ++-- doc/CMakeLists.txt | 2 +- src/CMakeLists.txt | 2 +- src/qt/CMakeLists.txt | 2 +- test/CMakeLists.txt | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5ef80ffc6f9..ab205795c1c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -458,10 +458,10 @@ else() ) endif() -configure_file(cmake/script/Coverage.cmake Coverage.cmake COPYONLY) -configure_file(cmake/script/CoverageFuzz.cmake CoverageFuzz.cmake COPYONLY) -configure_file(cmake/script/CoverageInclude.cmake.in CoverageInclude.cmake @ONLY) -configure_file(contrib/filter-lcov.py filter-lcov.py COPYONLY) +configure_file(cmake/script/Coverage.cmake Coverage.cmake USE_SOURCE_PERMISSIONS COPYONLY) +configure_file(cmake/script/CoverageFuzz.cmake CoverageFuzz.cmake USE_SOURCE_PERMISSIONS COPYONLY) +configure_file(cmake/script/CoverageInclude.cmake.in CoverageInclude.cmake USE_SOURCE_PERMISSIONS @ONLY) +configure_file(contrib/filter-lcov.py filter-lcov.py USE_SOURCE_PERMISSIONS COPYONLY) # Don't allow extended (non-ASCII) symbols in identifiers. This is easier for code review. try_append_cxx_flags("-fno-extended-identifiers" TARGET core_interface SKIP_LINK) diff --git a/cmake/module/GenerateSetupNsi.cmake b/cmake/module/GenerateSetupNsi.cmake index b7ea423611f..3c358c54958 100644 --- a/cmake/module/GenerateSetupNsi.cmake +++ b/cmake/module/GenerateSetupNsi.cmake @@ -14,5 +14,5 @@ function(generate_setup_nsi) set(BITCOIN_WALLET_TOOL_NAME "bitcoin-wallet") set(BITCOIN_TEST_NAME "test_bitcoin") set(EXEEXT ${CMAKE_EXECUTABLE_SUFFIX}) - configure_file(${PROJECT_SOURCE_DIR}/share/setup.nsi.in ${PROJECT_BINARY_DIR}/bitcoin-win64-setup.nsi @ONLY) + configure_file(${PROJECT_SOURCE_DIR}/share/setup.nsi.in ${PROJECT_BINARY_DIR}/bitcoin-win64-setup.nsi USE_SOURCE_PERMISSIONS @ONLY) endfunction() diff --git a/cmake/module/Maintenance.cmake b/cmake/module/Maintenance.cmake index 2c6cfc1863c..a232a9fc1eb 100644 --- a/cmake/module/Maintenance.cmake +++ b/cmake/module/Maintenance.cmake @@ -92,11 +92,11 @@ function(add_macos_deploy_target) if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND TARGET bitcoin-qt) set(macos_app "Bitcoin-Qt.app") # Populate Contents subdirectory. - configure_file(${PROJECT_SOURCE_DIR}/share/qt/Info.plist.in ${macos_app}/Contents/Info.plist) + configure_file(${PROJECT_SOURCE_DIR}/share/qt/Info.plist.in ${macos_app}/Contents/Info.plist USE_SOURCE_PERMISSIONS) file(CONFIGURE OUTPUT ${macos_app}/Contents/PkgInfo CONTENT "APPL????") # Populate Contents/Resources subdirectory. file(CONFIGURE OUTPUT ${macos_app}/Contents/Resources/empty.lproj CONTENT "") - configure_file(${PROJECT_SOURCE_DIR}/src/qt/res/icons/bitcoin.icns ${macos_app}/Contents/Resources/bitcoin.icns COPYONLY) + configure_file(${PROJECT_SOURCE_DIR}/src/qt/res/icons/bitcoin.icns ${macos_app}/Contents/Resources/bitcoin.icns USE_SOURCE_PERMISSIONS COPYONLY) file(CONFIGURE OUTPUT ${macos_app}/Contents/Resources/Base.lproj/InfoPlist.strings CONTENT "{ CFBundleDisplayName = \"@PACKAGE_NAME@\"; CFBundleName = \"@PACKAGE_NAME@\"; }" ) diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 61a7653e4aa..310a90612bb 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -6,7 +6,7 @@ find_package(Doxygen COMPONENTS dot) if(DOXYGEN_FOUND) set(doxyfile ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile) - configure_file(Doxyfile.in ${doxyfile}) + configure_file(Doxyfile.in ${doxyfile} USE_SOURCE_PERMISSIONS) # In CMake 3.27, The FindDoxygen module's doxygen_add_docs() # command gained a CONFIG_FILE option to specify a custom doxygen diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d6fa21d7667..4fe3793b81e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -5,7 +5,7 @@ include(GNUInstallDirs) include(AddWindowsResources) -configure_file(${PROJECT_SOURCE_DIR}/cmake/bitcoin-config.h.in config/bitcoin-config.h @ONLY) +configure_file(${PROJECT_SOURCE_DIR}/cmake/bitcoin-config.h.in config/bitcoin-config.h USE_SOURCE_PERMISSIONS @ONLY) include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) # TODO: After the transition from Autotools to CMake, the obj/ subdirectory diff --git a/src/qt/CMakeLists.txt b/src/qt/CMakeLists.txt index 19698d75cfc..297408a926b 100644 --- a/src/qt/CMakeLists.txt +++ b/src/qt/CMakeLists.txt @@ -46,7 +46,7 @@ file(GLOB ts_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} locale/*.ts) set_source_files_properties(${ts_files} PROPERTIES OUTPUT_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/locale) qt5_add_translation(qm_files ${ts_files}) -configure_file(bitcoin_locale.qrc bitcoin_locale.qrc COPYONLY) +configure_file(bitcoin_locale.qrc bitcoin_locale.qrc USE_SOURCE_PERMISSIONS COPYONLY) # The bitcoinqt sources have to include headers in # order to parse them to collect translatable strings. diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 9fd4e6e84ea..3a5998697d4 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -27,7 +27,7 @@ function(create_test_config) set_configure_variable(ENABLE_EXTERNAL_SIGNER ENABLE_EXTERNAL_SIGNER) set_configure_variable(WITH_USDT ENABLE_USDT_TRACEPOINTS) - configure_file(config.ini.in config.ini @ONLY) + configure_file(config.ini.in config.ini USE_SOURCE_PERMISSIONS @ONLY) endfunction() create_test_config()