From daa675f4639e8587ca6b460f8f88672cc88514c3 Mon Sep 17 00:00:00 2001 From: Tomaz Solc Date: Tue, 6 Jan 2015 14:35:01 +0100 Subject: [PATCH 1/3] 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: From b488236edb8c20f3261a566b9e3b9d554463cbd8 Mon Sep 17 00:00:00 2001 From: Doug Johnston Date: Thu, 10 Sep 2015 11:16:57 -0700 Subject: [PATCH 2/3] Make catkin support implicitly optional --- CMakeLists.txt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 792292c..e8229c9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,10 +2,7 @@ cmake_minimum_required(VERSION 2.8.3) project(serial) # Find catkin -option(BUILD_WITH_CATKIN "Build using catkin" ON) -if(BUILD_WITH_CATKIN) - find_package(catkin REQUIRED) -endif() +find_package(catkin) if(APPLE) find_library(IOKIT_LIBRARY IOKit) @@ -28,6 +25,7 @@ if(catkin_FOUND) ) endif() else() + message(WARNING "catkin not found, building without catkin support") set(CATKIN_PACKAGE_LIB_DESTINATION lib) set(CATKIN_GLOBAL_INCLUDE_DESTINATION include) endif() From ef98ccae7983a10dc99a8ff07c4f14d5a020916e Mon Sep 17 00:00:00 2001 From: Doug Johnston Date: Thu, 10 Sep 2015 11:19:46 -0700 Subject: [PATCH 3/3] Update readme --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 5cd0249..96eb651 100644 --- a/README.md +++ b/README.md @@ -22,8 +22,7 @@ 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. +If catkin is not available, project will build without catkin support, which will currently disable tests ### Install