summarylogtreecommitdiffstats
path: root/cmake.patch
diff options
context:
space:
mode:
authorRomain Reignier2017-02-16 21:56:34 +0100
committerRomain Reignier2017-02-16 21:56:34 +0100
commite85a0ad2c255acdcff6f5de7917d101256c3873e (patch)
tree091ba9e9d7b6abe134efe630fc1ee3313425d09c /cmake.patch
parenta0f30f38e0d8b8a5faab435d07da9eb80d2f2cec (diff)
downloadaur-e85a0ad2c255acdcff6f5de7917d101256c3873e.tar.gz
Change the CMakeLists.txt to generate Cmake Config files.
Used the changed from here: https://github.com/wjwwood/serial/pull/133
Diffstat (limited to 'cmake.patch')
-rw-r--r--cmake.patch82
1 files changed, 82 insertions, 0 deletions
diff --git a/cmake.patch b/cmake.patch
new file mode 100644
index 00000000000..6bd0b786cf0
--- /dev/null
+++ b/cmake.patch
@@ -0,0 +1,82 @@
+diff -aur serial-1.2.1.pristine/CMakeLists.txt serial-1.2.1.new/CMakeLists.txt
+--- serial-1.2.1.pristine/CMakeLists.txt 2015-04-22 06:50:41.000000000 +0200
++++ serial-1.2.1.new/CMakeLists.txt 2017-02-16 21:08:44.642188817 +0100
+@@ -1,29 +1,11 @@
+ cmake_minimum_required(VERSION 2.8.3)
+ project(serial)
+
+-# Find catkin
+-find_package(catkin REQUIRED)
+-
+ 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
+- )
+-else()
+- # Otherwise normal call
+- catkin_package(
+- LIBRARIES ${PROJECT_NAME}
+- INCLUDE_DIRS include
+- )
+-endif()
+-
+ ## Sources
+ set(serial_SRCS
+ src/serial.cc
+@@ -45,7 +27,7 @@
+ endif()
+
+ ## Add serial library
+-add_library(${PROJECT_NAME} ${serial_SRCS})
++add_library(${PROJECT_NAME} STATIC ${serial_SRCS})
+ if(APPLE)
+ target_link_libraries(${PROJECT_NAME} ${FOUNDATION_LIBRARY} ${IOKIT_LIBRARY})
+ elseif(UNIX)
+@@ -54,7 +36,7 @@
+ target_link_libraries(${PROJECT_NAME} setupapi)
+ endif()
+
+-## Uncomment for example
++## Add example project
+ add_executable(serial_example examples/serial_example.cc)
+ add_dependencies(serial_example ${PROJECT_NAME})
+ target_link_libraries(serial_example ${PROJECT_NAME})
+@@ -62,17 +44,23 @@
+ ## Include headers
+ include_directories(include)
+
++## Install
++set(INSTALL_LIB_DIR lib)
++set(INSTALL_INCLUDE_DIR include)
++set(INSTALL_CMAKE_DIR share/serial/cmake)
++
+ ## Install executable
+ install(TARGETS ${PROJECT_NAME}
+- ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
+- LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
++ DESTINATION ${INSTALL_LIB_DIR}
++ EXPORT ${PROJECT_NAME}-targets
+ )
+
+ ## Install headers
+ install(FILES include/serial/serial.h include/serial/v8stdint.h
+- DESTINATION ${CATKIN_GLOBAL_INCLUDE_DESTINATION}/serial)
++ DESTINATION ${INSTALL_INCLUDE_DIR}/serial)
+
+-## Tests
+-if(CATKIN_ENABLE_TESTING)
+- add_subdirectory(tests)
+-endif()
++## Install CMake files
++install(EXPORT ${PROJECT_NAME}-targets DESTINATION ${INSTALL_CMAKE_DIR})
++
++install(FILES ${CMAKE_SOURCE_DIR}/cmake/${PROJECT_NAME}Config.cmake ${CMAKE_SOURCE_DIR}/cmake/${PROJECT_NAME}ConfigVersion.cmake
++ DESTINATION ${INSTALL_CMAKE_DIR})