Skip to content
Snippets Groups Projects
Commit 48f132e6 authored by Joaquim Casals Buñuel's avatar Joaquim Casals Buñuel
Browse files

Make CMake config file fetch its own dependencies + CMakeLists.txt cleanup

parent 3f7de559
No related branches found
No related tags found
No related merge requests found
...@@ -91,23 +91,9 @@ ENDIF(BUILD_EXAMPLES OR BUILD_TESTS) ...@@ -91,23 +91,9 @@ ENDIF(BUILD_EXAMPLES OR BUILD_TESTS)
#find dependencies. #find dependencies.
# ============EXAMPLE================== # ============EXAMPLE==================
FIND_PACKAGE(Eigen3 3.2.92 REQUIRED)
FIND_PACKAGE(Threads REQUIRED)
FIND_PACKAGE(wolf REQUIRED) FIND_PACKAGE(wolf REQUIRED)
FIND_PACKAGE(YamlCpp REQUIRED) FIND_PACKAGE(laser_scan_utils REQUIRED)
IF(YAMLCPP_FOUND)
MESSAGE("yaml-cpp Library FOUND: yaml-cpp related sources will be built.")
ELSEIF(YAMLCPP_FOUND)
MESSAGE("yaml-cpp Library NOT FOUND!")
ENDIF(YAMLCPP_FOUND)
FIND_PACKAGE(Ceres QUIET) #Ceres is not required
IF(Ceres_FOUND)
MESSAGE("Ceres Library FOUND: Ceres related sources will be built.")
ENDIF(Ceres_FOUND)
#FIND_PATH( #FIND_PATH(
# Suitesparse_INCLUDE_DIRS # Suitesparse_INCLUDE_DIRS
...@@ -142,16 +128,9 @@ include_directories("${PROJECT_BINARY_DIR}/conf") ...@@ -142,16 +128,9 @@ include_directories("${PROJECT_BINARY_DIR}/conf")
#INCLUDES SECTION #INCLUDES SECTION
# ============================== # ==============================
INCLUDE_DIRECTORIES(${EIGEN_INCLUDE_DIRS})
INCLUDE_DIRECTORIES(${wolf_INCLUDE_DIRS}) INCLUDE_DIRECTORIES(${wolf_INCLUDE_DIRS})
INCLUDE_DIRECTORIES(${laser_utils_INCLUDE_DIRS})
INCLUDE_DIRECTORIES(BEFORE "include") INCLUDE_DIRECTORIES(BEFORE "include")
INCLUDE_DIRECTORIES(${laser_scan_utils_INCLUDE_DIRS})
INCLUDE_DIRECTORIES(${YAMLCPP_INCLUDE_DIR})
IF(Ceres_FOUND)
INCLUDE_DIRECTORIES(${CERES_INCLUDE_DIRS})
ENDIF(Ceres_FOUND)
#HEADERS #HEADERS
SET(HDRS_COMMON SET(HDRS_COMMON
...@@ -263,25 +242,16 @@ ADD_LIBRARY(${PLUGIN_NAME} ...@@ -263,25 +242,16 @@ ADD_LIBRARY(${PLUGIN_NAME}
#Link the created libraries #Link the created libraries
#===============EXAMPLE========================= #===============EXAMPLE=========================
TARGET_LINK_LIBRARIES(${PLUGIN_NAME} ${CMAKE_THREAD_LIBS_INIT}) TARGET_LINK_LIBRARIES(${PLUGIN_NAME} ${wolf_LIBRARIES})
TARGET_LINK_LIBRARIES(${PLUGIN_NAME} ${wolf_LIBRARY}) TARGET_LINK_LIBRARIES(${PLUGIN_NAME} ${laser_scan_utils_LIBRARY})
TARGET_LINK_LIBRARIES(${PLUGIN_NAME} ${YAMLCPP_LIBRARY})
IF (GLOG_FOUND)
TARGET_LINK_LIBRARIES(${PLUGIN_NAME} ${GLOG_LIBRARY})
ENDIF (GLOG_FOUND)
IF (Ceres_FOUND)
TARGET_LINK_LIBRARIES(${PLUGIN_NAME} ${CERES_LIBRARIES})
ENDIF(Ceres_FOUND)
#Build tests #Build tests
#===============EXAMPLE========================= #===============EXAMPLE=========================
IF (GLOG_FOUND) IF(BUILD_TESTS)
IF(BUILD_TESTS) MESSAGE("Building tests.")
MESSAGE("Building tests.") add_subdirectory(test)
add_subdirectory(test) ENDIF(BUILD_TESTS)
ENDIF(BUILD_TESTS)
ENDIF (GLOG_FOUND)
#install library #install library
#============================================================= #=============================================================
......
#edit the following line to add the librarie's header files
FIND_PATH(
wolf_INCLUDE_DIRS
NAMES wolf.found
PATHS /usr/local/include/iri-algorithms/wolf/plugin_core)
#change INCLUDE_DIRS to its parent directory
# get_filename_component(wolf_INCLUDE_DIRS ${wolf_INCLUDE_DIRS} DIRECTORY)
MESSAGE("Found wolf include dirs: ${wolf_INCLUDE_DIRS}")
FIND_LIBRARY(
wolf_LIBRARY
NAMES wolf
PATHS /usr/lib /usr/local/lib /usr/local/lib/iri-algorithms)
IF (wolf_INCLUDE_DIRS AND wolf_LIBRARY)
SET(wolf_FOUND TRUE)
ENDIF (wolf_INCLUDE_DIRS AND wolf_LIBRARY)
IF (wolf_FOUND)
IF (NOT wolf_FIND_QUIETLY)
MESSAGE(STATUS "Found wolf: ${wolf_LIBRARY}")
ENDIF (NOT wolf_FIND_QUIETLY)
ELSE (wolf_FOUND)
IF (wolf_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find wolf")
ENDIF (wolf_FIND_REQUIRED)
ENDIF (wolf_FOUND)
...@@ -62,4 +62,22 @@ if(NOT wolfgnss_FOUND) ...@@ -62,4 +62,22 @@ if(NOT wolfgnss_FOUND)
wolf_report_not_found("Something went wrong while setting up wolf gnss.") wolf_report_not_found("Something went wrong while setting up wolf gnss.")
endif(NOT wolfgnss_FOUND) endif(NOT wolfgnss_FOUND)
# Set the include directories for wolf (itself). # Set the include directories for wolf (itself).
set(wolfgnss_FOUND TRUE) set(wolfgnss_FOUND TRUE)
\ No newline at end of file
# Now we gather all the required dependencies for Wolf Laser
FIND_PACKAGE(laser_scan_utils REQUIRED)
list(APPEND wolfgnss_INCLUDE_DIRS ${laser_scan_utils_INCLUDE_DIRS})
list(APPEND wolfgnss_LIBRARIES ${laser_scan_utils_LIBRARY})
if(NOT wolf_FOUND)
FIND_PACKAGE(wolf REQUIRED)
#We reverse in order to insert at the start
list(REVERSE wolfgnss_INCLUDE_DIRS)
list(APPEND wolfgnss_INCLUDE_DIRS ${wolf_INCLUDE_DIRS})
list(REVERSE wolfgnss_INCLUDE_DIRS)
list(REVERSE wolfgnss_LIBRARIES)
list(APPEND wolfgnss_LIBRARIES ${wolf_LIBRARIES})
list(REVERSE wolfgnss_LIBRARIES)
endif()
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment