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

added an option 'DISABLE_CATKIN' #297

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
12 changes: 11 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
cmake_minimum_required(VERSION 2.8.3)
project(serial)

option(DISABLE_CATKIN OFF "disables catkin")

# Find catkin
if(NOT DISABLE_CATKIN)
find_package(catkin REQUIRED)
endif()


if(APPLE)
find_library(IOKIT_LIBRARY IOKit)
Expand All @@ -13,17 +18,21 @@ if(UNIX AND NOT APPLE)
# If Linux, add rt and pthread
set(rt_LIBRARIES rt)
set(pthread_LIBRARIES pthread)
if(NOT DISABLE_CATKIN)
catkin_package(
LIBRARIES ${PROJECT_NAME}
INCLUDE_DIRS include
DEPENDS rt pthread
)
endif()
else()
# Otherwise normal call
if(NOT DISABLE_CATKIN)
catkin_package(
LIBRARIES ${PROJECT_NAME}
INCLUDE_DIRS include
)
endif()
endif()

## Sources
Expand Down Expand Up @@ -63,7 +72,7 @@ target_link_libraries(serial_example ${PROJECT_NAME})

## Include headers
include_directories(include)

if(NOT DISABLE_CATKIN)
## Install executable
install(TARGETS ${PROJECT_NAME}
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
Expand All @@ -74,6 +83,7 @@ install(TARGETS ${PROJECT_NAME}
## Install headers
install(FILES include/serial/serial.h include/serial/v8stdint.h
DESTINATION ${CATKIN_GLOBAL_INCLUDE_DESTINATION}/serial)
endif()

## Tests
if(CATKIN_ENABLE_TESTING)
Expand Down