Skip to content
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

CMake: only set policy CMP0148 to OLD if version >= 3.27 #9126

Merged
merged 1 commit into from Jan 19, 2024

Conversation

jeffro256
Copy link
Contributor

@jeffro256 jeffro256 commented Jan 19, 2024

Allows people to compile if their CMake is older than 3.27

@tobtoht

@tobtoht
Copy link
Contributor

tobtoht commented Jan 19, 2024

How did my patch pass CI..

Anyway, cmake_minimum_required should stay at 3.5, see: https://cmake.org/cmake/help/latest/command/cmake_policy.html#setting-policies-by-cmake-version

Edit: Where is Ubuntu 20.04 CI getting CMake 3.28.1 from? It installs 3.16.

CMakeLists.txt Outdated
@@ -40,8 +40,9 @@ include(CheckCXXCompilerFlag)
include(CheckLinkerFlag)
include(CheckLibraryExists)
include(CheckFunctionExists)

cmake_policy(SET CMP0148 OLD)
if (NOT("${CMAKE_VERSION}" VERSION_LESS 3.27)) # If CMake version >= 3.27
Copy link
Collaborator

Choose a reason for hiding this comment

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

if(POLICY CMP0148)
  cmake_policy(SET CMP0148 OLD) # https://cmake.org/cmake/help/latest/policy/CMP0148.html
endif()

It is a cleaner syntax IMHO [1].

  1. https://cmake.org/cmake/help/latest/command/if.html#policy

@0xFFFC0000
Copy link
Collaborator

How did my patch pass CI..

The build shows that CMake is 3.27.8.

https://github.com/monero-project/monero/actions/runs/6991078601/job/19021248770#step:9:25

This is a question for me too, where does our CI get 3.27.8.

@selsta
Copy link
Collaborator

selsta commented Jan 19, 2024

@0xFFFC0000 CI VM has it pre-installed, see #9128

@0xFFFC0000
Copy link
Collaborator

@0xFFFC0000 CI VM has it pre-installed, see #9128

Thanks. Now it makes sense.

Co-authored-by: 0xFFFC0000 <0xFFFC0000@proton.me>
@luigi1111 luigi1111 merged commit 059028a into monero-project:master Jan 19, 2024
18 checks passed
@jeffro256 jeffro256 deleted the fix_cmake_policy_0148 branch January 19, 2024 19:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants