Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ endif()

project(MuseScore LANGUAGES C CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_SCAN_FOR_MODULES OFF)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Verify CMAKE_CXX_SCAN_FOR_MODULES availability in CMake 3.22-3.27

echo "Checking if CMAKE_CXX_SCAN_FOR_MODULES could cause issues with CMake 3.22..."
echo "Searching for usage patterns and potential compatibility notes in the repository..."

# Search for any CMake version checks or notes about CMAKE_CXX_SCAN_FOR_MODULES
rg -n "CMAKE_CXX_SCAN_FOR_MODULES" --type cmake

# Check for any minimum CMake version comments or requirements
rg -n "cmake_minimum_required" --type cmake -A 2 -B 2

Repository: musescore/MuseScore

Length of output: 2264


🌐 Web query:

CMake CMAKE_CXX_SCAN_FOR_MODULES minimum version requirement compatibility

💡 Result:

The CMAKE_CXX_SCAN_FOR_MODULES variable and the associated CXX_SCAN_FOR_MODULES target and source file properties were introduced in CMake 3.28 [1][2][3]. These features are part of CMake's support for C++20 modules [2][4]. When using CMake 3.28 or later, the policy CMP0155 governs the default behavior for scanning C++ sources for module dependencies [2][5]. Under the NEW behavior of CMP0155 (which is the default for projects specifying a minimum required CMake version of 3.28 or higher), CMake will automatically scan C++ sources in targets using C++20 or newer for module imports [2][4]. To disable this automatic scanning—which is often necessary for projects that use C++20 but do not use modules to avoid unnecessary build overhead—you can set the CMAKE_CXX_SCAN_FOR_MODULES variable to 0 (or OFF) in your CMakeLists.txt file [6][4][5]: set(CMAKE_CXX_SCAN_FOR_MODULES 0) It is recommended to set this near the top of your top-level CMakeLists.txt file and avoid placing it in the cache to prevent unintended side effects in projects included via FetchContent [6][4][5].

Citations:


CMAKE_CXX_SCAN_FOR_MODULES requires CMake 3.28+, but minimum supported version is 3.22.

CMAKE_CXX_SCAN_FOR_MODULES was introduced in CMake 3.28. On CMake 3.22–3.27 (or 3.26–3.27 for macOS), this variable will be silently ignored without warnings, meaning the module scanning disable won't take effect. Consider conditionally setting this variable only when CMake 3.28+ is available, or updating the minimum required version to 3.28 if C++ modules are a core feature.

🧰 Tools
🪛 GitHub Actions: Check: Unit Tests (utest) / 0_run_tests.txt

[warning] 31-31: CMake deprecation warning: Compatibility with CMake < 3.10 will be removed; update VERSION argument min value (CMakeLists.txt:31 (cmake_minimum_required)).

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@CMakeLists.txt` at line 31, The CMakeLists currently unconditionally sets
CMAKE_CXX_SCAN_FOR_MODULES (symbol CMAKE_CXX_SCAN_FOR_MODULES) which requires
CMake 3.28+; either guard that set with a version check (inspect CMAKE_VERSION
or use if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.28") / if(POLICY ...) and
only set CMAKE_CXX_SCAN_FOR_MODULES when the version is >= 3.28) or raise the
project minimum via the cmake_minimum_required(VERSION ...) entry to 3.28 if C++
modules are a core requirement; update the code around the existing CMake
minimum/version declaration and the line that sets CMAKE_CXX_SCAN_FOR_MODULES
accordingly.


set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
Expand Down
7 changes: 7 additions & 0 deletions src/app/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@

#include "log.h"

// C++20 check
#include <concepts>
#include <type_traits>
consteval int square(int n) { return n * n; }
static_assert(square(5) == 25);
// ========================

#ifndef MUSE_MODULE_DIAGNOSTICS_CRASHPAD_CLIENT
static void crashCallback(int signum)
{
Expand Down
2 changes: 0 additions & 2 deletions src/engraving/playback/renderingcontext.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@

namespace mu::engraving {
struct RenderingContext {
RenderingContext() = default;

muse::mpe::timestamp_t nominalTimestamp = 0;
muse::mpe::duration_t nominalDuration = 0;
muse::mpe::dynamic_level_t nominalDynamicLevel = 0;
Expand Down
0 mftool.sh → wf
100644 → 100755
File renamed without changes.
Loading