if(${RunCMake_SUBTEST_SUFFIX} MATCHES "CMAKE_var_set" OR
  ${RunCMake_SUBTEST_SUFFIX} MATCHES "both_set")

  set(CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS
      OWNER_READ
      OWNER_WRITE
      OWNER_EXECUTE
      GROUP_READ
    )
endif()

if(${RunCMake_SUBTEST_SUFFIX} MATCHES "invalid_CMAKE_var")
  list(APPEND CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS "INVALID")
endif()

if(${RunCMake_SUBTEST_SUFFIX} MATCHES "CPACK_var_set" OR
  ${RunCMake_SUBTEST_SUFFIX} MATCHES "both_set")

  set(CPACK_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS
      OWNER_READ
      OWNER_WRITE
      OWNER_EXECUTE
    )
endif()

if(${RunCMake_SUBTEST_SUFFIX} MATCHES "invalid_CPACK_var")
  list(APPEND CPACK_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS "INVALID")
endif()

install(FILES CMakeLists.txt DESTINATION foo COMPONENT test)

if(PACKAGING_TYPE STREQUAL "COMPONENT")
  set(CPACK_COMPONENTS_ALL test)
endif()
