Skip to content

Commit

Permalink
Merge pull request #319 from nim65s/topic/relocatable
Browse files Browse the repository at this point in the history
cmake: relocatable package for recent CMake versions
  • Loading branch information
jcarpent authored Jul 15, 2022
2 parents a5d5ef2 + 0cd9bcf commit 0d46417
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 21 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ ELSE(WIN32)
ADD_PROJECT_DEPENDENCY(Boost REQUIRED chrono serialization)
ENDIF(WIN32)
if(BUILD_PYTHON_INTERFACE)
set(PYTHON_COMPONENTS Interpreter Development.Module NumPy)
FINDPYTHON()
search_for_boost_python(REQUIRED)
find_package(Boost REQUIRED COMPONENTS system)
Expand Down
2 changes: 1 addition & 1 deletion cmake
33 changes: 13 additions & 20 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -173,20 +173,16 @@ add_library(${LIBRARY_NAME}
${${LIBRARY_NAME}_SOURCES}
)

set_target_properties(${PROJECT_NAME} PROPERTIES INSTALL_RPATH "\$ORIGIN")

# IDE sources and headers sorting
ADD_SOURCE_GROUP(${LIBRARY_NAME}_SOURCES)
ADD_HEADER_GROUP(PROJECT_HEADERS_FULL_PATH)

TARGET_INCLUDE_DIRECTORIES(${LIBRARY_NAME}
SYSTEM PUBLIC
${Boost_INCLUDE_DIRS}
)

TARGET_LINK_LIBRARIES(${LIBRARY_NAME}
PRIVATE
${assimp_LIBRARIES}
# assimp::assimp # Not working
)
MODERNIZE_TARGET_LINK_LIBRARIES(${LIBRARY_NAME} SCOPE PRIVATE
TARGETS assimp::assimp
LIBRARIES ${assimp_LIBRARIES}
INCLUDE_DIRS ${assimp_INCLUDE_DIR})

TARGET_LINK_LIBRARIES(${LIBRARY_NAME}
PUBLIC
Expand All @@ -213,23 +209,20 @@ if(HPP_FCL_HAS_QHULL)
endif()
endif()

target_include_directories(${LIBRARY_NAME}
SYSTEM PUBLIC
${EIGEN3_INCLUDE_DIR}
)
target_include_directories(${LIBRARY_NAME}
SYSTEM PRIVATE
${assimp_INCLUDE_DIR}
)
MODERNIZE_TARGET_LINK_LIBRARIES(${PROJECT_NAME} SCOPE PUBLIC
TARGETS Eigen3::Eigen
INCLUDE_DIRS ${EIGEN3_INCLUDE_DIR})

target_include_directories(${LIBRARY_NAME}
PUBLIC
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)

IF(octomap_FOUND)
target_include_directories(${LIBRARY_NAME} SYSTEM PUBLIC ${OCTOMAP_INCLUDE_DIRS})
target_link_libraries(${LIBRARY_NAME} PUBLIC ${OCTOMAP_LIBRARIES})
MODERNIZE_TARGET_LINK_LIBRARIES(${PROJECT_NAME} SCOPE PUBLIC
TARGETS octomap
LIBRARIES ${OCTOMAP_LIBRARIES}
INCLUDE_DIRS ${OCTOMAP_INCLUDE_DIRS})
target_compile_definitions (${LIBRARY_NAME} PUBLIC
-DHPP_FCL_HAS_OCTOMAP
-DHPP_FCL_HAVE_OCTOMAP
Expand Down

0 comments on commit 0d46417

Please sign in to comment.