Remove dotfiles from build files in CMakeLists.txt (#897)

Avoids including unwanted files that could appear in a developer
workspace (e.g. auto-generated files in "dot" folders).
master
Michael Grupp 2018-03-06 18:39:46 +01:00 committed by Wally B. Feed
parent f34df22a24
commit 7e05daa8ca
1 changed files with 12 additions and 2 deletions

View File

@ -57,6 +57,16 @@ file(GLOB_RECURSE ALL_LIBRARY_HDRS "*.h")
file(GLOB_RECURSE ALL_LIBRARY_SRCS "*.cc")
file(GLOB_RECURSE ALL_TESTS "*_test.cc")
file(GLOB_RECURSE ALL_EXECUTABLES "*_main.cc")
# Remove dotfiles/-folders that could potentially pollute the build.
file(GLOB_RECURSE ALL_DOTFILES ".*/*")
if (ALL_DOTFILES)
list(REMOVE_ITEM ALL_LIBRARY_HDRS ${ALL_DOTFILES})
list(REMOVE_ITEM ALL_LIBRARY_SRCS ${ALL_DOTFILES})
list(REMOVE_ITEM ALL_TESTS ${ALL_DOTFILES})
list(REMOVE_ITEM ALL_EXECUTABLES ${ALL_DOTFILES})
endif()
list(REMOVE_ITEM ALL_LIBRARY_SRCS ${ALL_TESTS})
list(REMOVE_ITEM ALL_LIBRARY_SRCS ${ALL_EXECUTABLES})
file(GLOB_RECURSE ALL_GRPC_FILES "cartographer/cloud/*")
@ -78,8 +88,8 @@ set(INSTALL_SOURCE_HDRS ${ALL_LIBRARY_HDRS})
file(GLOB_RECURSE INTERNAL_HDRS "cartographer/*/internal/*.h")
list(REMOVE_ITEM INSTALL_SOURCE_HDRS ${INTERNAL_HDRS})
file(GLOB_RECURSE ALL_PROTOS "*.proto")
file(GLOB_RECURSE ALL_GRPC_SERVICES "*_service.proto")
file(GLOB_RECURSE ALL_PROTOS "cartographer*/*.proto")
file(GLOB_RECURSE ALL_GRPC_SERVICES "cartographer*/*_service.proto")
list(REMOVE_ITEM ALL_PROTOS ALL_GRPC_SERVICES)
if (NOT ${BUILD_GRPC})
list(REMOVE_ITEM ALL_PROTOS ${ALL_GRPC_FILES})