Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmake: relocatable package for recent CMake versions #319

Merged
merged 4 commits into from
Jul 15, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
29 changes: 9 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_LINK(${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,16 @@ 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_LINK(${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_LINK(${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