From daa675f4639e8587ca6b460f8f88672cc88514c3 Mon Sep 17 00:00:00 2001 From: Tomaz Solc Date: Tue, 6 Jan 2015 14:35:01 +0100 Subject: [PATCH] Build without catkin with BUILD_WITH_CATKIN=OFF see also https://github.com/BaroboRobotics/serial/commit/7cd3de47425e6564577cde4383513b876031f0ed --- CMakeLists.txt | 34 +++++++++++++++++++++------------- README.md | 3 +++ 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a72acb8..792292c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,26 +2,34 @@ cmake_minimum_required(VERSION 2.8.3) project(serial) # Find catkin -find_package(catkin REQUIRED) +option(BUILD_WITH_CATKIN "Build using catkin" ON) +if(BUILD_WITH_CATKIN) + find_package(catkin REQUIRED) +endif() if(APPLE) find_library(IOKIT_LIBRARY IOKit) find_library(FOUNDATION_LIBRARY Foundation) endif() -if(UNIX AND NOT APPLE) - # If Linux, add rt and pthread - catkin_package( - LIBRARIES ${PROJECT_NAME} - INCLUDE_DIRS include - DEPENDS rt pthread - ) +if(catkin_FOUND) + if(UNIX AND NOT APPLE) + # If Linux, add rt and pthread + catkin_package( + LIBRARIES ${PROJECT_NAME} + INCLUDE_DIRS include + DEPENDS rt pthread + ) + else() + # Otherwise normal call + catkin_package( + LIBRARIES ${PROJECT_NAME} + INCLUDE_DIRS include + ) + endif() else() - # Otherwise normal call - catkin_package( - LIBRARIES ${PROJECT_NAME} - INCLUDE_DIRS include - ) + set(CATKIN_PACKAGE_LIB_DESTINATION lib) + set(CATKIN_GLOBAL_INCLUDE_DESTINATION include) endif() ## Sources diff --git a/README.md b/README.md index 2c4182d..5cd0249 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,9 @@ API Documentation: http://wjwwood.github.com/serial/doc/1.1.0/index.html * [empy](http://www.alcyone.com/pyos/empy/) - Python templating library * [catkin_pkg](http://pypi.python.org/pypi/catkin_pkg/) - Runtime Python library for catkin +Basic build and install without catkin is possible by appending +`CMAKE_FLAGS=-DBUILD_WITH_CATKIN=OFF` to `make` commands below. + ### Install Get the code: