Only include correct source files in cmake (#1085)

This fixes #1050. Tested standalone compilation and with the debian fakeroot tool. I had to build with a custom Protobuf3 instance though, so another build-check on a regular setup would be appreciated.

Before this change all *.cc files would be included. If subprojects
were run individually with the Debian package generator. This resulted in an
inclusion of temporarily checked out *.cc from the abseil include. This
change fixes the import behaviour and enables the creation of a valid
package.
master
Matthias Loebach 2018-11-06 07:06:28 +01:00 committed by Wally B. Feed
parent d0871210e7
commit c493369594
2 changed files with 5 additions and 5 deletions

View File

@ -83,9 +83,9 @@ catkin_package(
LIBRARIES ${PROJECT_NAME} LIBRARIES ${PROJECT_NAME}
) )
file(GLOB_RECURSE ALL_SRCS "*.cc" "*.h") file(GLOB_RECURSE ALL_SRCS "cartographer_ros/*.cc" "cartographer_ros/*.h")
file(GLOB_RECURSE ALL_TESTS "*_test.cc") file(GLOB_RECURSE ALL_TESTS "cartographer_ros/*_test.cc")
file(GLOB_RECURSE ALL_EXECUTABLES "*_main.cc") file(GLOB_RECURSE ALL_EXECUTABLES "cartographer_ros/*_main.cc")
file(GLOB_RECURSE ALL_GRPC_FILES "cartographer_ros/cartographer_grpc/*") file(GLOB_RECURSE ALL_GRPC_FILES "cartographer_ros/cartographer_grpc/*")
list(REMOVE_ITEM ALL_SRCS ${ALL_TESTS}) list(REMOVE_ITEM ALL_SRCS ${ALL_TESTS})
list(REMOVE_ITEM ALL_SRCS ${ALL_EXECUTABLES}) list(REMOVE_ITEM ALL_SRCS ${ALL_EXECUTABLES})
@ -172,7 +172,7 @@ install(TARGETS ${PROJECT_NAME}
) )
# Install source headers. # Install source headers.
file(GLOB_RECURSE HDRS "*.h") file(GLOB_RECURSE HDRS "cartographer_ros/*.h")
foreach(HDR ${HDRS}) foreach(HDR ${HDRS})
file(RELATIVE_PATH REL_FIL ${PROJECT_SOURCE_DIR} ${HDR}) file(RELATIVE_PATH REL_FIL ${PROJECT_SOURCE_DIR} ${HDR})
get_filename_component(INSTALL_DIR ${REL_FIL} DIRECTORY) get_filename_component(INSTALL_DIR ${REL_FIL} DIRECTORY)

View File

@ -42,7 +42,7 @@ catkin_package(
INCLUDE_DIRS "." INCLUDE_DIRS "."
) )
file(GLOB_RECURSE ALL_SRCS "*.cc" "*.h") file(GLOB_RECURSE ALL_SRCS "cartographer_rviz/*.cc" "cartographer_rviz/*.h")
set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOMOC ON)
add_library(${PROJECT_NAME} ${ALL_SRCS}) add_library(${PROJECT_NAME} ${ALL_SRCS})
target_link_libraries(${PROJECT_NAME} PUBLIC ${QT_LIBRARIES}) target_link_libraries(${PROJECT_NAME} PUBLIC ${QT_LIBRARIES})