blob: 3842a83df559256631c698de4b5492f13c25d387 [file] [log] [blame]
zeshuai007348790d2020-03-23 16:48:35 +08001#
2# Licensed to the Apache Software Foundation (ASF) under one
3# or more contributor license agreements. See the NOTICE file
4# distributed with this work for additional information
5# regarding copyright ownership. The ASF licenses this file
6# to you under the Apache License, Version 2.0 (the
7# "License"); you may not use this file except in compliance
8# with the License. You may obtain a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing,
13# software distributed under the License is distributed on an
14# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15# KIND, either express or implied. See the License for the
16# specific language governing permissions and limitations
17# under the License.
18#
19
20cmake_minimum_required(VERSION 3.4)
21
22set(MANIFEST "${CMAKE_CURRENT_BINARY_DIR}/install_manifest.txt")
23
24if(NOT EXISTS ${MANIFEST})
25 message(FATAL_ERROR "Cannot find install mainfest: ${MANIFEST}")
26endif()
27
28file(STRINGS ${MANIFEST} files)
29foreach(file ${files})
30 if(EXISTS ${file} OR IS_SYMLINK ${file})
31 message(STATUS "Removing: ${file}")
32
33 execute_process(
34 COMMAND ${CMAKE_COMMAND} -E remove ${file}
35 RESULT_VARIABLE result
36 OUTPUT_QUIET
37 ERROR_VARIABLE stderr
38 ERROR_STRIP_TRAILING_WHITESPACE
39 )
40
41 if(NOT ${result} EQUAL 0)
42 message(FATAL_ERROR "${stderr}")
43 endif()
44 else()
45 message(STATUS "Does-not-exist: ${file}")
46 endif()
47endforeach(file)