aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFeng Xiao <xiaofeng@google.com>2016-05-31 13:51:07 -0400
committerFeng Xiao <xiaofeng@google.com>2016-05-31 13:51:07 -0400
commita315bb8b1efad36f09d18d94b9ffb2ec080f86fa (patch)
tree7bfe0b85f651d1d6c77ef8a4a46017ac17e32a22
parente215828525e4c5f12b3a65077f262b741370b78a (diff)
parent457a2975f4bff68412d8f4a57c329a5b54750672 (diff)
downloadprotobuf-a315bb8b1efad36f09d18d94b9ffb2ec080f86fa.tar.gz
protobuf-a315bb8b1efad36f09d18d94b9ffb2ec080f86fa.tar.bz2
protobuf-a315bb8b1efad36f09d18d94b9ffb2ec080f86fa.zip
Merge pull request #1614 from yeswalrus/cmake-cleanup
Remove unused lines from CMake files.
-rw-r--r--cmake/install.cmake54
-rw-r--r--cmake/protobuf-config.cmake.in10
2 files changed, 27 insertions, 37 deletions
diff --git a/cmake/install.cmake b/cmake/install.cmake
index 6e3d41a1..a5040b22 100644
--- a/cmake/install.cmake
+++ b/cmake/install.cmake
@@ -16,34 +16,32 @@ endforeach()
install(TARGETS protoc EXPORT protobuf-targets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT protoc)
-if(TRUE)
- file(STRINGS extract_includes.bat.in _extract_strings
- REGEX "^copy")
- foreach(_extract_string ${_extract_strings})
- string(REPLACE "copy \${PROTOBUF_SOURCE_WIN32_PATH}\\" ""
- _extract_string ${_extract_string})
- string(REPLACE "\\" "/" _extract_string ${_extract_string})
- string(REGEX MATCH "^[^ ]+"
- _extract_from ${_extract_string})
- string(REGEX REPLACE "^${_extract_from} ([^$]+)" "\\1"
- _extract_to ${_extract_string})
- get_filename_component(_extract_from "${protobuf_SOURCE_DIR}/${_extract_from}" ABSOLUTE)
- get_filename_component(_extract_name ${_extract_to} NAME)
- get_filename_component(_extract_to ${_extract_to} PATH)
- string(REPLACE "include/" "${CMAKE_INSTALL_INCLUDEDIR}/"
- _extract_to "${_extract_to}")
- if(EXISTS "${_extract_from}")
- install(FILES "${_extract_from}"
- DESTINATION "${_extract_to}"
- COMPONENT protobuf-headers
- RENAME "${_extract_name}")
- else()
- message(AUTHOR_WARNING "The file \"${_extract_from}\" is listed in "
- "\"${protobuf_SOURCE_DIR}/cmake/extract_includes.bat.in\" "
- "but there not exists. The file will not be installed.")
- endif()
- endforeach()
-endif()
+file(STRINGS extract_includes.bat.in _extract_strings
+ REGEX "^copy")
+foreach(_extract_string ${_extract_strings})
+ string(REPLACE "copy \${PROTOBUF_SOURCE_WIN32_PATH}\\" ""
+ _extract_string ${_extract_string})
+ string(REPLACE "\\" "/" _extract_string ${_extract_string})
+ string(REGEX MATCH "^[^ ]+"
+ _extract_from ${_extract_string})
+ string(REGEX REPLACE "^${_extract_from} ([^$]+)" "\\1"
+ _extract_to ${_extract_string})
+ get_filename_component(_extract_from "${protobuf_SOURCE_DIR}/${_extract_from}" ABSOLUTE)
+ get_filename_component(_extract_name ${_extract_to} NAME)
+ get_filename_component(_extract_to ${_extract_to} PATH)
+ string(REPLACE "include/" "${CMAKE_INSTALL_INCLUDEDIR}/"
+ _extract_to "${_extract_to}")
+ if(EXISTS "${_extract_from}")
+ install(FILES "${_extract_from}"
+ DESTINATION "${_extract_to}"
+ COMPONENT protobuf-headers
+ RENAME "${_extract_name}")
+ else()
+ message(AUTHOR_WARNING "The file \"${_extract_from}\" is listed in "
+ "\"${protobuf_SOURCE_DIR}/cmake/extract_includes.bat.in\" "
+ "but there not exists. The file will not be installed.")
+ endif()
+endforeach()
# Internal function for parsing auto tools scripts
function(_protobuf_auto_list FILE_NAME VARIABLE)
diff --git a/cmake/protobuf-config.cmake.in b/cmake/protobuf-config.cmake.in
index bb0997b8..f11796a4 100644
--- a/cmake/protobuf-config.cmake.in
+++ b/cmake/protobuf-config.cmake.in
@@ -2,12 +2,8 @@
set(PROTOBUF_VERSION "@protobuf_VERSION@")
set(PROTOBUF_VERSION_STRING "@protobuf_VERSION_STRING@")
-# Current dir
-get_filename_component(_PROTOBUF_PACKAGE_PREFIX
- "${CMAKE_CURRENT_LIST_FILE}" PATH)
-
# Imported targets
-include("${_PROTOBUF_PACKAGE_PREFIX}/protobuf-targets.cmake")
+include("${CMAKE_CURRENT_LIST_DIR}/protobuf-targets.cmake")
# Compute the installation prefix relative to this file.
get_filename_component(_PROTOBUF_IMPORT_PREFIX
@@ -21,7 +17,3 @@ get_filename_component(_PROTOBUF_IMPORT_PREFIX
if(NOT DEFINED PROTOBUF_MODULE_COMPATIBLE OR "${PROTOBUF_MODULE_COMPATIBLE}")
include("${_PROTOBUF_PACKAGE_PREFIX}/protobuf-module.cmake")
endif()
-
-# Cleanup temporary variables.
-set(_PROTOBUF_PACKAGE_PREFIX)
-set(_PROTOBUF_IMPORT_PREFIX)