Skip to content

Commit 5f1ab38

Browse files
committed
cmake: Add option for alternative name cxx-serial.
The name serial is problematic when packaging since it's basically too generic and easily generates name clashes. Add an option which builds the package as cxx-serial instead, by default off to not break existing usage. Gbp-Pq: Name 0008-cmake-Add-option-for-alternative-name-cxx-serial.patch
1 parent e1dabd8 commit 5f1ab38

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

CMakeLists.txt

+12-2
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,26 @@
11
cmake_minimum_required(VERSION 3.5.0)
22

33

4+
option(USE_CXX_SERIAL "build package name cxx-serial" OFF)
5+
if (USE_CXX_SERIAL)
6+
set(PKG_NAME cxx-serial)
7+
else ()
8+
set(PKG_NAME serial)
9+
endif ()
10+
message(STATUS "Building package ${PKG_NAME}")
11+
412
# Find catkin
513
find_package(catkin REQUIRED)
614

715
set(PROJ_SOVERSION 1)
8-
project(serial
16+
project(${PKG_NAME}
917
VERSION 1.2.1
1018
DESCRIPTION "Cross-platform, Serial Port library written in C++"
1119
HOMEPAGE_URL "http://wjwwood.io/serial/"
1220
)
1321

22+
configure_file(package.xml.in ${PROJECT_SOURCE_DIR}/package.xml @ONLY)
23+
1424
if(APPLE)
1525
find_library(IOKIT_LIBRARY IOKit)
1626
find_library(FOUNDATION_LIBRARY Foundation)
@@ -19,7 +29,7 @@ endif()
1929
# Public options and command line configuration
2030
option(ENABLE_TEST_PROGRAM "Build test program" OFF)
2131
option(CATKIN_ENABLE_TESTING "Enable catkin unit tests" ON)
22-
set(SERIAL_DOCDIR ${CMAKE_INSTALL_PREFIX}/share/doc/serial
32+
set(SERIAL_DOCDIR ${CMAKE_INSTALL_PREFIX}/share/doc/${PROJECT_NAME}
2333
CACHE STRING "Installation root for doxygen docs."
2434
)
2535

package.xml package.xml.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0"?>
22
<package>
3-
<name>serial</name>
3+
<name>@PROJECT_NAME@</name>
44
<version>1.2.1</version>
55
<description>
66
Serial is a cross-platform, simple to use library for using serial ports on computers.

0 commit comments

Comments
 (0)