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

Use cmake policy instead of minimum #53

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
14 changes: 12 additions & 2 deletions cmake/Templates/PTLConfig.cmake.in
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
# -------------------------------------------------------------------------------------- #

if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.8)
Copy link
Owner

Choose a reason for hiding this comment

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

This seems unnecessary

message(FATAL_ERROR "CMake >= 3.0.0 required")
endif()
if(CMAKE_VERSION VERSION_LESS "3.0.0")
Copy link
Owner

Choose a reason for hiding this comment

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

Why is this 3.0.0 and not 3.8.0?

Copy link
Author

Choose a reason for hiding this comment

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

The updated usage mirrors the CMake-generated Targets.cmake file: assertions to check for the rough CMake version, then a scoped policy change for the file itself.

I suspect cmake does this for better backward compatibility with old versions: each successive test requires newer features. If you look at the cmake-generated Targets from any installation you'll see the same assertions in the same order.

message(FATAL_ERROR "CMake >= 3.0.0 required")
endif()
cmake_policy(PUSH)
cmake_policy(VERSION 3.0.0...3.27)
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
cmake_policy(VERSION 3.0.0...3.27)
cmake_policy(VERSION 3.8.0...3.27)


# package initialization
#
@PACKAGE_INIT@

cmake_minimum_required(VERSION 3.8...3.27)

# -------------------------------------------------------------------------------------- #
# basic paths
#
Expand Down Expand Up @@ -78,3 +86,5 @@ if(NOT TARGET PTL::ptl)
target_compile_definitions(PTL::ptl INTERFACE _PTL_ARCHIVE)
endif()
endif()

cmake_policy(POP)
Loading