Enable adding as a CMake subproject (#262)

Add support for building libcartographer in the same project

Support adding as a CMake subproject by using the PROJECT_*_DIR variables
instead of the absolute CMAKE_*_DIR variables.

Resolve a signed-unsigned comparison compiler warning
Fix comment typo
master
Juraj Oršulić 2017-02-09 15:58:35 +01:00 committed by Holger Rapp
parent f7057fc5a3
commit 02044fc86a
4 changed files with 7 additions and 7 deletions

View File

@ -122,8 +122,8 @@ add_dependencies(${PROJECT_NAME} ${catkin_EXPORTED_TARGETS})
# Add the binary directory first, so that port.h is included after it has
# been generated.
target_include_directories(${PROJECT_NAME} PUBLIC
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}>
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}>
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
$<INSTALL_INTERFACE:include>
)
@ -174,7 +174,7 @@ install(TARGETS ${PROJECT_NAME}
# Install source headers.
file(GLOB_RECURSE HDRS "*.h")
foreach(HDR ${HDRS})
file(RELATIVE_PATH REL_FIL ${CMAKE_SOURCE_DIR} ${HDR})
file(RELATIVE_PATH REL_FIL ${PROJECT_SOURCE_DIR} ${HDR})
get_filename_component(INSTALL_DIR ${REL_FIL} DIRECTORY)
install(
FILES

View File

@ -34,7 +34,7 @@ namespace {
namespace carto = ::cartographer;
// Writes an occupany grid.
// Writes an occupancy grid.
void Write2DAssets(const std::vector<::cartographer::mapping::TrajectoryNode>&
trajectory_nodes,
const NodeOptions& options, const std::string& stem) {

View File

@ -117,7 +117,7 @@ void HandleMessage(
ToPointCloudWithIntensities(message);
CHECK(point_cloud.intensities.size() == point_cloud.points.size());
for (int i = 0; i < point_cloud.points.size(); ++i) {
for (size_t i = 0; i < point_cloud.points.size(); ++i) {
batch->points.push_back(sensor_to_map * point_cloud.points[i]);
batch->intensities.push_back(point_cloud.intensities[i]);
}

View File

@ -63,8 +63,8 @@ add_definitions(-DQT_NO_KEYWORDS)
# Add the binary directory first, so that port.h is included after it has
# been generated.
target_include_directories(${PROJECT_NAME} PUBLIC
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}>
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}>
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
$<INSTALL_INTERFACE:include>
)