summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorDomen Vrankar <domen.vrankar@gmail.com>2017-03-25 20:01:59 (GMT)
committerDomen Vrankar <domen.vrankar@gmail.com>2017-12-09 11:50:28 (GMT)
commit93d5f464cc9cdf4a3b30565828ce23065ce51d01 (patch)
tree48033517d8bda79f0382ad1e6b4f81a948a1eda0 /Modules
parent0fe1966b7994969c2220efbec51bf49c0406fac8 (diff)
downloadCMake-93d5f464cc9cdf4a3b30565828ce23065ce51d01.zip
CMake-93d5f464cc9cdf4a3b30565828ce23065ce51d01.tar.gz
CMake-93d5f464cc9cdf4a3b30565828ce23065ce51d01.tar.bz2
CPack: enable all CMake policies for generator scripts
Diffstat (limited to 'Modules')
-rw-r--r--Modules/CPackDeb.cmake28
-rw-r--r--Modules/CPackRPM.cmake69
2 files changed, 28 insertions, 69 deletions
diff --git a/Modules/CPackDeb.cmake b/Modules/CPackDeb.cmake
index 91bf2f2..de1df3d 100644
--- a/Modules/CPackDeb.cmake
+++ b/Modules/CPackDeb.cmake
@@ -610,12 +610,7 @@ function(cpack_deb_prepare_package_vars)
if(CPACK_DEBIAN_PACKAGE_SHLIBDEPS OR CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS)
# Generating binary list - Get type of all install files
- cmake_policy(PUSH)
- # Tell file(GLOB_RECURSE) not to follow directory symlinks
- # even if the project does not set this policy to NEW.
- cmake_policy(SET CMP0009 NEW)
- file(GLOB_RECURSE FILE_PATHS_ LIST_DIRECTORIES false RELATIVE "${WDIR}" "${WDIR}/*")
- cmake_policy(POP)
+ file(GLOB_RECURSE FILE_PATHS_ LIST_DIRECTORIES false RELATIVE "${WDIR}" "${WDIR}/*")
find_program(FILE_EXECUTABLE file)
if(NOT FILE_EXECUTABLE)
@@ -931,13 +926,10 @@ function(cpack_deb_prepare_package_vars)
if(CPACK_DEBIAN_ARCHIVE_TYPE)
set(archive_types_ "paxr;gnutar")
- cmake_policy(PUSH)
- cmake_policy(SET CMP0057 NEW)
- if(NOT CPACK_DEBIAN_ARCHIVE_TYPE IN_LIST archive_types_)
- message(FATAL_ERROR "CPACK_DEBIAN_ARCHIVE_TYPE set to unsupported"
- "type ${CPACK_DEBIAN_ARCHIVE_TYPE}")
- endif()
- cmake_policy(POP)
+ if(NOT CPACK_DEBIAN_ARCHIVE_TYPE IN_LIST archive_types_)
+ message(FATAL_ERROR "CPACK_DEBIAN_ARCHIVE_TYPE set to unsupported"
+ "type ${CPACK_DEBIAN_ARCHIVE_TYPE}")
+ endif()
else()
set(CPACK_DEBIAN_ARCHIVE_TYPE "paxr")
endif()
@@ -1039,13 +1031,9 @@ function(cpack_deb_prepare_package_vars)
set(CPACK_OUTPUT_FILE_NAME
"${CPACK_DEBIAN_PACKAGE_NAME}_${CPACK_DEBIAN_PACKAGE_VERSION}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}.deb")
else()
- cmake_policy(PUSH)
- cmake_policy(SET CMP0010 NEW)
- if(NOT CPACK_DEBIAN_FILE_NAME MATCHES ".*\\.(deb|ipk)")
- cmake_policy(POP)
- message(FATAL_ERROR "'${CPACK_DEBIAN_FILE_NAME}' is not a valid DEB package file name as it must end with '.deb' or '.ipk'!")
- endif()
- cmake_policy(POP)
+ if(NOT CPACK_DEBIAN_FILE_NAME MATCHES ".*\\.(deb|ipk)")
+ message(FATAL_ERROR "'${CPACK_DEBIAN_FILE_NAME}' is not a valid DEB package file name as it must end with '.deb' or '.ipk'!")
+ endif()
set(CPACK_OUTPUT_FILE_NAME "${CPACK_DEBIAN_FILE_NAME}")
endif()
diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake
index faa2df8..bb5181f 100644
--- a/Modules/CPackRPM.cmake
+++ b/Modules/CPackRPM.cmake
@@ -962,7 +962,6 @@ function(get_file_permissions FILE RETURN_VAR)
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
- cmake_policy(SET CMP0007 NEW)
string(REPLACE " " ";" permissions_ "${permissions_}")
list(GET permissions_ 0 permissions_)
@@ -1066,12 +1065,7 @@ function(cpack_rpm_prepare_relocation_paths)
endforeach()
# warn about all the paths that are not relocatable
- cmake_policy(PUSH)
- # Tell file(GLOB_RECURSE) not to follow directory symlinks
- # even if the project does not set this policy to NEW.
- cmake_policy(SET CMP0009 NEW)
- file(GLOB_RECURSE FILE_PATHS_ "${WDIR}/*")
- cmake_policy(POP)
+ file(GLOB_RECURSE FILE_PATHS_ "${WDIR}/*")
foreach(TMP_PATH ${FILE_PATHS_})
string(LENGTH "${WDIR}" WDIR_LEN)
string(SUBSTRING "${TMP_PATH}" ${WDIR_LEN} -1 TMP_PATH)
@@ -1098,10 +1092,7 @@ endfunction()
function(cpack_rpm_prepare_content_list)
# get files list
- cmake_policy(PUSH)
- cmake_policy(SET CMP0009 NEW)
- file(GLOB_RECURSE CPACK_RPM_INSTALL_FILES LIST_DIRECTORIES true RELATIVE "${WDIR}" "${WDIR}/*")
- cmake_policy(POP)
+ file(GLOB_RECURSE CPACK_RPM_INSTALL_FILES LIST_DIRECTORIES true RELATIVE "${WDIR}" "${WDIR}/*")
set(CPACK_RPM_INSTALL_FILES "/${CPACK_RPM_INSTALL_FILES}")
string(REPLACE ";" ";/" CPACK_RPM_INSTALL_FILES "${CPACK_RPM_INSTALL_FILES}")
@@ -1120,10 +1111,7 @@ function(cpack_rpm_prepare_content_list)
set(_DISTINCT_PATH "${_RPM_RELOCATION_PREFIX}")
string(REPLACE "/" ";" _CPACK_RPM_PACKAGE_PREFIX_ELEMS " ${_RPM_RELOCATION_PREFIX}")
- cmake_policy(PUSH)
- cmake_policy(SET CMP0007 NEW)
- list(REMOVE_AT _CPACK_RPM_PACKAGE_PREFIX_ELEMS -1)
- cmake_policy(POP)
+ list(REMOVE_AT _CPACK_RPM_PACKAGE_PREFIX_ELEMS -1)
unset(_TMP_LIST)
# Now generate all of the parent dirs of the relocation path
foreach(_PREFIX_PATH_ELEM ${_CPACK_RPM_PACKAGE_PREFIX_ELEMS})
@@ -1608,7 +1596,6 @@ function(cpack_rpm_debugsymbol_check INSTALL_FILES WORKING_DIR)
endif()
get_file_permissions("${WORKING_DIR}/${F}" permissions_)
- cmake_policy(SET CMP0057 NEW)
if(NOT "USER_EXECUTE" IN_LIST permissions_ AND
NOT "GROUP_EXECUTE" IN_LIST permissions_ AND
NOT "WORLD_EXECUTE" IN_LIST permissions_)
@@ -1997,19 +1984,15 @@ function(cpack_rpm_generate_package)
endif()
if(DEFINED CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER})
- cmake_policy(PUSH)
- cmake_policy(SET CMP0057 NEW)
- # Prefix can be replaced by Prefixes but the old version stil works so we'll ignore it for now
- # Requires* is a special case because it gets transformed to Requires(pre/post/preun/postun)
- # Auto* is a special case because the tags can not be queried by querytags rpmbuild flag
- set(special_case_tags_ PREFIX REQUIRES_PRE REQUIRES_POST REQUIRES_PREUN REQUIRES_POSTUN AUTOPROV AUTOREQ AUTOREQPROV)
- if(NOT _RPM_SPEC_HEADER IN_LIST RPMBUILD_TAG_LIST AND NOT _RPM_SPEC_HEADER IN_LIST special_case_tags_)
- cmake_policy(POP)
- message(AUTHOR_WARNING "CPackRPM:Warning: ${_RPM_SPEC_HEADER} not "
- "supported in provided rpmbuild. Tag will not be used.")
- continue()
- endif()
- cmake_policy(POP)
+ # Prefix can be replaced by Prefixes but the old version stil works so we'll ignore it for now
+ # Requires* is a special case because it gets transformed to Requires(pre/post/preun/postun)
+ # Auto* is a special case because the tags can not be queried by querytags rpmbuild flag
+ set(special_case_tags_ PREFIX REQUIRES_PRE REQUIRES_POST REQUIRES_PREUN REQUIRES_POSTUN AUTOPROV AUTOREQ AUTOREQPROV)
+ if(NOT _RPM_SPEC_HEADER IN_LIST RPMBUILD_TAG_LIST AND NOT _RPM_SPEC_HEADER IN_LIST special_case_tags_)
+ message(AUTHOR_WARNING "CPackRPM:Warning: ${_RPM_SPEC_HEADER} not "
+ "supported in provided rpmbuild. Tag will not be used.")
+ continue()
+ endif()
if(CPACK_RPM_PACKAGE_DEBUG)
message("CPackRPM:Debug: using CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}")
@@ -2301,12 +2284,9 @@ function(cpack_rpm_generate_package)
continue()
endif()
- cmake_policy(PUSH)
- cmake_policy(SET CMP0009 NEW)
- file(GLOB_RECURSE files_for_move_ LIST_DIRECTORIES false RELATIVE
- "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/${component_}"
- "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/${component_}/*")
- cmake_policy(POP)
+ file(GLOB_RECURSE files_for_move_ LIST_DIRECTORIES false RELATIVE
+ "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/${component_}"
+ "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/${component_}/*")
foreach(f_ IN LISTS files_for_move_)
get_filename_component(dir_path_ "${f_}" DIRECTORY)
@@ -2438,13 +2418,9 @@ ${TMP_DEBUGINFO_ADDITIONAL_SOURCES}
"CPACK_RPM_FILE_NAME")
if(NOT CPACK_RPM_FILE_NAME STREQUAL "RPM-DEFAULT")
if(CPACK_RPM_FILE_NAME)
- cmake_policy(PUSH)
- cmake_policy(SET CMP0010 NEW)
- if(NOT CPACK_RPM_FILE_NAME MATCHES ".*\\.rpm")
- cmake_policy(POP)
- message(FATAL_ERROR "'${CPACK_RPM_FILE_NAME}' is not a valid RPM package file name as it must end with '.rpm'!")
- endif()
- cmake_policy(POP)
+ if(NOT CPACK_RPM_FILE_NAME MATCHES ".*\\.rpm")
+ message(FATAL_ERROR "'${CPACK_RPM_FILE_NAME}' is not a valid RPM package file name as it must end with '.rpm'!")
+ endif()
else()
# old file name format for back compatibility
string(TOUPPER "${CPACK_RPM_MAIN_COMPONENT}"
@@ -2762,13 +2738,8 @@ mv %_topdir/tmpBBroot $RPM_BUILD_ROOT
endif()
# find generated rpm files and take their names
- cmake_policy(PUSH)
- # Tell file(GLOB_RECURSE) not to follow directory symlinks
- # even if the project does not set this policy to NEW.
- cmake_policy(SET CMP0009 NEW)
- file(GLOB_RECURSE GENERATED_FILES "${CPACK_RPM_DIRECTORY}/RPMS/*.rpm"
- "${CPACK_RPM_DIRECTORY}/SRPMS/*.rpm")
- cmake_policy(POP)
+ file(GLOB_RECURSE GENERATED_FILES "${CPACK_RPM_DIRECTORY}/RPMS/*.rpm"
+ "${CPACK_RPM_DIRECTORY}/SRPMS/*.rpm")
if(NOT GENERATED_FILES)
message(FATAL_ERROR "RPM package was not generated! ${CPACK_RPM_DIRECTORY}")