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

Fix catkin_lint errors #260

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
29 changes: 16 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
cmake_minimum_required(VERSION 2.8.3)
project(serial)
set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake" )

# Find catkin
find_package(catkin REQUIRED)
if(CATKIN_ENABLE_TESTING)
find_package(Boost REQUIRED)
endif()

if(APPLE)
find_library(IOKIT_LIBRARY IOKit)
Expand All @@ -11,20 +15,19 @@ endif()

if(UNIX AND NOT APPLE)
# If Linux, add rt and pthread
set(rt_LIBRARIES rt)
set(pthread_LIBRARIES pthread)
catkin_package(
LIBRARIES ${PROJECT_NAME}
INCLUDE_DIRS include
DEPENDS rt pthread
)
find_package(pthread)
find_package(rt)
set(CATKIN_PACKAGE_DEPENDS "rt pthread")
#message("rt_LIBRARIES=${rt_LIBRARIES}")
#message("pthread_LIBRARIES=${pthread_LIBRARIES}")
else()
# Otherwise normal call
catkin_package(
LIBRARIES ${PROJECT_NAME}
INCLUDE_DIRS include
)
set(CATKIN_PACKAGE_DEPENDS "")
endif()
catkin_package(
LIBRARIES ${PROJECT_NAME}
INCLUDE_DIRS include
DEPENDS ${CATKIN_PACKAGE_DEPENDS}
)

## Sources
set(serial_SRCS
Expand All @@ -51,7 +54,7 @@ add_library(${PROJECT_NAME} ${serial_SRCS})
if(APPLE)
target_link_libraries(${PROJECT_NAME} ${FOUNDATION_LIBRARY} ${IOKIT_LIBRARY})
elseif(UNIX)
target_link_libraries(${PROJECT_NAME} rt pthread)
target_link_libraries(${PROJECT_NAME} ${rt_LIBRARIES} ${pthread_LIBRARIES})
else()
target_link_libraries(${PROJECT_NAME} setupapi)
endif()
Expand Down
10 changes: 10 additions & 0 deletions cmake/Findpthread.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)

if(Threads_FOUND)
#message( "lib pthread FOUND!" )
set(pthread_LIBRARIES Threads::Threads)
set(pthread_INCLUDE_DIRS ${Threads_INCLUDE_DIR})
else(Threads_FOUND)
#message( "lib pthread NOT FOUND!" )
endif()
16 changes: 16 additions & 0 deletions cmake/Findrt.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
include(FindPackageHandleStandardArgs)

find_library(rt_LIBRARY rt)

find_package_handle_standard_args(rt
DEFAULT_MSG
rt_LIBRARY
)
mark_as_advanced(rt_LIBRARY)

if(rt_FOUND)
#message("lib rt FOUND!")
set(rt_LIBRARIES ${rt_LIBRARY})
else(rt_FOUND)
#message("lib rt NOT FOUND!")
endif()
3 changes: 3 additions & 0 deletions deps.repos
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
apt:
- libboost-dev

3 changes: 1 addition & 2 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
<author email="[email protected]">John Harrison</author>

<buildtool_depend>catkin</buildtool_depend>

<test_depend>boost</test_depend>
<build_depend>Boost</build_depend>

</package>