Avoid CMP0048 warning (#570)

Fixes #567.

If pybind's CMakeLists gets loaded via an include_directory from another
CMakeLists with a higher minimum version (e.g. 3.0), the project()
command without a version produces a CMP0048 warning.

This commit explicitly requests the new behaviour if the policy exists,
as it won't cause problems (we set VERSION later).
This commit is contained in:
Jason Rhinelander 2016-12-26 05:26:21 -05:00 committed by Wenzel Jakob
parent c40d8c617f
commit a3fec901b8

View File

@ -7,6 +7,11 @@
cmake_minimum_required(VERSION 2.8.12) cmake_minimum_required(VERSION 2.8.12)
if (POLICY CMP0048)
# cmake warns if loaded from a min-3.0-required parent dir, so silence the warning:
cmake_policy(SET CMP0048 NEW)
endif()
project(pybind11) project(pybind11)
# Check if pybind11 is being used directly or via add_subdirectory # Check if pybind11 is being used directly or via add_subdirectory