Set policy CMP0025 to NEW while building CMake itself

CMake is aware of the policy's NEW behavior and the AppleClang compiler
id.  Set the policy to NEW explicitly to avoid the warning and get the
NEW behavior.

Also teach the RunCMake test infrastructure to build tests with
-DCMAKE_POLICY_DEFAULT_CMP0025=NEW to avoid the policy warning
in test output that must match specific regular expressions.
This commit is contained in:
Brad King 2013-10-02 14:45:54 -04:00
parent aa53ee57bb
commit 1763c31c3b
4 changed files with 12 additions and 0 deletions

View File

@ -11,6 +11,9 @@
#============================================================================= #=============================================================================
cmake_minimum_required(VERSION 2.8.2 FATAL_ERROR) cmake_minimum_required(VERSION 2.8.2 FATAL_ERROR)
set(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required set(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required
if(POLICY CMP0025)
cmake_policy(SET CMP0025 NEW)
endif()
project(CMake) project(CMake)
if(CMAKE_BOOTSTRAP) if(CMAKE_BOOTSTRAP)

View File

@ -85,6 +85,9 @@
# written. # written.
CMAKE_MINIMUM_REQUIRED(VERSION 2.6.3 FATAL_ERROR) CMAKE_MINIMUM_REQUIRED(VERSION 2.6.3 FATAL_ERROR)
IF(POLICY CMP0025)
CMAKE_POLICY(SET CMP0025 NEW)
ENDIF()
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# If a namespace is not specified, use "kwsys" and enable testing. # If a namespace is not specified, use "kwsys" and enable testing.

View File

@ -36,6 +36,9 @@ function(run_cmake test)
if(NOT DEFINED RunCMake_TEST_OPTIONS) if(NOT DEFINED RunCMake_TEST_OPTIONS)
set(RunCMake_TEST_OPTIONS "") set(RunCMake_TEST_OPTIONS "")
endif() endif()
if(APPLE)
list(APPEND RunCMake_TEST_OPTIONS -DCMAKE_POLICY_DEFAULT_CMP0025=NEW)
endif()
execute_process( execute_process(
COMMAND ${CMAKE_COMMAND} "${RunCMake_TEST_SOURCE_DIR}" COMMAND ${CMAKE_COMMAND} "${RunCMake_TEST_SOURCE_DIR}"
-G "${RunCMake_GENERATOR}" -G "${RunCMake_GENERATOR}"

View File

@ -1,4 +1,7 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.6.3 FATAL_ERROR) CMAKE_MINIMUM_REQUIRED(VERSION 2.6.3 FATAL_ERROR)
IF(POLICY CMP0025)
CMAKE_POLICY(SET CMP0025 NEW)
ENDIF()
PROJECT(LIBCURL C) PROJECT(LIBCURL C)
# Setup package meta-data # Setup package meta-data