Skip to content

Use C++17 to build if we find POCO 1.14 or higher. #97

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
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
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ find_package(projectM4 REQUIRED COMPONENTS Playlist)
find_package(SDL2 REQUIRED)
find_package(Poco REQUIRED COMPONENTS JSON XML Util Foundation)

if(Poco_VERSION VERSION_GREATER_EQUAL 1.14.0)
# POCO 1.14 requires at least C++17
set(CMAKE_CXX_STANDARD 17)
Copy link
Contributor

Choose a reason for hiding this comment

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

will it not overwrite if we're using a newer version?

Copy link
Member Author

@kblaschke kblaschke Mar 18, 2025

Choose a reason for hiding this comment

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

This block simply checks if the found POCO version is 1.14.0 or higher, and in this case sets the required C++ standard to C++17 for the app's compilation (CMAKE_CXX_STANDARD default-initializes the CXX_STANDARD property of targets defined later on to the given value, which makes the build system pass -std=c++17 or -std=gnu++17 to the compiler).

The logic is, if we have POCO 1.14, we should also have a C++17-capable toolchain since otherwise, we'd have many other issues like mismatching C++ runtimes etc., but keeping C++14 as the minimum requirement if someone builds the application in an environment that uses an older toolchain and POCO version (e.g. Ubuntu 22 or the default Steam Runtime v3 compiler, which is GCC 10).

endif()

if(ENABLE_FREETYPE)
find_package(Freetype)
endif()
Expand Down