cmake: only define test policy on old versions

CMP0037 only reserves the test name if CTest is included on newer versions of CMake.

This commit fixes a build warning.
This commit is contained in:
David Adam 2019-11-01 20:58:35 +08:00
parent 6702c84d15
commit 3365410bde

View File

@ -99,7 +99,8 @@ ADD_CUSTOM_TARGET(serial_test_high_level
# Create the 'test' target. # Create the 'test' target.
# Set a policy so CMake stops complaining about the name 'test'. # Set a policy so CMake stops complaining about the name 'test'.
CMAKE_POLICY(PUSH) CMAKE_POLICY(PUSH)
IF(POLICY CMP0037)
IF(${CMAKE_VERSION} VERSION_LESS 3.11.0 AND POLICY CMP0037)
CMAKE_POLICY(SET CMP0037 OLD) CMAKE_POLICY(SET CMP0037 OLD)
ENDIF() ENDIF()
ADD_CUSTOM_TARGET(test) ADD_CUSTOM_TARGET(test)