Skip to content

Commit

Permalink
Merge pull request #135 from v4hn/with-octomap-option
Browse files Browse the repository at this point in the history
add option to disable octomap in build
  • Loading branch information
jslee02 authored Jun 26, 2016
2 parents 1bcb2c3 + 7526e56 commit 9755ce0
Showing 1 changed file with 30 additions and 24 deletions.
54 changes: 30 additions & 24 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,32 +66,38 @@ endif()

# Find Octomap (optional)
find_package(PkgConfig QUIET)

option(FCL_WITH_OCTOMAP "octomap library support" ON)
set(FCL_HAVE_OCTOMAP 0)
if(PKG_CONFIG_FOUND)
pkg_check_modules(OCTOMAP QUIET octomap)
endif()
if(NOT OCTOMAP_FOUND)
# if pkfconfig is not installed, then fall back on more fragile detection
# of octomap
find_path(OCTOMAP_INCLUDE_DIRS octomap.h
PATH_SUFFIXES octomap)
find_library(OCTOMAP_LIBRARY_DIRS
${CMAKE_SHARED_LIBRARY_PREFIX}octomap${CMAKE_SHARED_LIBRARY_SUFFIX})
if(OCTOMAP_INCLUDE_DIRS AND OCTOMAP_LIBRARY_DIRS)
set(OCTOMAP_LIBRARIES "octomap;octomath")
endif()
endif()
if (OCTOMAP_FOUND OR (OCTOMAP_INCLUDE_DIRS AND OCTOMAP_LIBRARY_DIRS))
string(REPLACE "." ";" VERSION_LIST ${OCTOMAP_VERSION})
list(GET VERSION_LIST 0 OCTOMAP_MAJOR_VERSION)
list(GET VERSION_LIST 1 OCTOMAP_MINOR_VERSION)
list(GET VERSION_LIST 2 OCTOMAP_PATCH_VERSION)
include_directories(${OCTOMAP_INCLUDE_DIRS})
link_directories(${OCTOMAP_LIBRARY_DIRS})
set(FCL_HAVE_OCTOMAP 1)
message(STATUS "FCL uses Octomap")
if(FCL_WITH_OCTOMAP)
if(PKG_CONFIG_FOUND)
pkg_check_modules(OCTOMAP QUIET octomap)
endif()
if(NOT OCTOMAP_FOUND)
# if pkgconfig is not installed, then fall back on more fragile detection
# of octomap
find_path(OCTOMAP_INCLUDE_DIRS octomap.h
PATH_SUFFIXES octomap)
find_library(OCTOMAP_LIBRARY_DIRS
${CMAKE_SHARED_LIBRARY_PREFIX}octomap${CMAKE_SHARED_LIBRARY_SUFFIX})
if(OCTOMAP_INCLUDE_DIRS AND OCTOMAP_LIBRARY_DIRS)
set(OCTOMAP_LIBRARIES "octomap;octomath")
endif()
endif()
if (OCTOMAP_FOUND OR (OCTOMAP_INCLUDE_DIRS AND OCTOMAP_LIBRARY_DIRS))
string(REPLACE "." ";" VERSION_LIST ${OCTOMAP_VERSION})
list(GET VERSION_LIST 0 OCTOMAP_MAJOR_VERSION)
list(GET VERSION_LIST 1 OCTOMAP_MINOR_VERSION)
list(GET VERSION_LIST 2 OCTOMAP_PATCH_VERSION)
include_directories(${OCTOMAP_INCLUDE_DIRS})
link_directories(${OCTOMAP_LIBRARY_DIRS})
set(FCL_HAVE_OCTOMAP 1)
message(STATUS "FCL uses Octomap")
else()
message(STATUS "FCL does not use Octomap")
endif()
else()
message(STATUS "FCL does not use Octomap")
message(STATUS "FCL does not use Octomap (as requested)")
endif()


Expand Down

0 comments on commit 9755ce0

Please sign in to comment.