[CMake] error: cmake_policy PUSH without matching POP

Biddiscombe, John A. biddisco at cscs.ch
Thu Jan 24 05:38:35 EST 2013


I don't really understand what these policies are for, but I always get the error message in the title when I include cmake generate config files which contain push pop such as the following example


================== cmakelists

cmake_minimum_required(VERSION 2.8)
project(TEST)

# makes no difference if it is commented out or not
#cmake_policy(SET CMP0011 NEW) # push/pop policies

FIND_PACKAGE(HDF5 REQUIRED NO_MODULE)

==================
And the hdf5 generated config contains the following with a push and a pop in it

The error message is just wrong, because it says push with no pop. But there is a pop.
What is the correct way of doing this?

==================

# Generated by CMake 2.8.9

IF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.5)
   MESSAGE(FATAL_ERROR "CMake >= 2.6.0 required")
ENDIF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.5)
CMAKE_POLICY(PUSH)
CMAKE_POLICY(VERSION 2.6)
#----------------------------------------------------------------
# Generated CMake target import file.
#----------------------------------------------------------------

# Commands may need to know the format version.
SET(CMAKE_IMPORT_FILE_VERSION 1)

# Create imported target hdf5
ADD_LIBRARY(hdf5 SHARED IMPORTED)

# Create imported target hdf5_cpp
ADD_LIBRARY(hdf5_cpp SHARED IMPORTED)

# Create imported target hdf5_tools
ADD_LIBRARY(hdf5_tools SHARED IMPORTED)

# Create imported target hdf5_hl
ADD_LIBRARY(hdf5_hl SHARED IMPORTED)

# Create imported target hdf5_hl_cpp
ADD_LIBRARY(hdf5_hl_cpp SHARED IMPORTED)

# Load information for each installed configuration.
GET_FILENAME_COMPONENT(_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
FILE(GLOB CONFIG_FILES "${_DIR}/hdf5-targets-*.cmake")
FOREACH(f ${CONFIG_FILES})
  INCLUDE(${f})
ENDFOREACH(f)

# Commands beyond this point should not need to know the version.
SET(CMAKE_IMPORT_FILE_VERSION)
CMAKE_POLICY(POP)



Any help appreciated. Thanks.

JB


--
John Biddiscombe,                        email:biddisco @.at.@ cscs.ch
http://www.cscs.ch/
CSCS, Swiss National Supercomputing Centre  | Tel:  +41 (91) 610.82.07
Via Trevano 131, 6900 Lugano, Switzerland   | Fax:  +41 (91) 610.82.82

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20130124/f94b6341/attachment.htm>


More information about the CMake mailing list