0001-cmake-build-shared-libs-by-default-on-linux.patch 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. Upstream status: Merged
  2. Fetched from: https://github.com/intel-iot-devkit/mraa/commit/86a0e10c037e5c069c48012f169f9e8e2587a0ef
  3. From 86a0e10c037e5c069c48012f169f9e8e2587a0ef Mon Sep 17 00:00:00 2001
  4. From: Samuel Martin <s.martin49@gmail.com>
  5. Date: Wed, 6 Jan 2016 01:07:10 +0100
  6. Subject: [PATCH] cmake: build shared libs by default on linux
  7. The change allows to build shared libraries by default on Linux, while
  8. respecting the requested library build type when the standard CMake flag
  9. BUILD_SHARED_LIBS is defined.
  10. Signed-off-by: Samuel Martin <s.martin49@gmail.com>
  11. Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
  12. ---
  13. CMakeLists.txt | 7 +++++++
  14. src/CMakeLists.txt | 2 +-
  15. 2 files changed, 8 insertions(+), 1 deletion(-)
  16. diff --git a/CMakeLists.txt b/CMakeLists.txt
  17. index 9860556..6a189b9 100644
  18. --- a/CMakeLists.txt
  19. +++ b/CMakeLists.txt
  20. @@ -10,6 +10,13 @@ set (LIB_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}" CACHE PATH "Installation path for
  21. # Set CMAKE_LIB_INSTALL_DIR if not defined
  22. include(GNUInstallDirs)
  23. +# By default, build shared object libraries on linux
  24. +if (UNIX AND NOT APPLE)
  25. + if (NOT DEFINED BUILD_SHARED_LIBS)
  26. + set(BUILD_SHARED_LIBS ON)
  27. + endif()
  28. +endif()
  29. +
  30. # Appends the cmake/modules path to MAKE_MODULE_PATH variable.
  31. set (CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH})
  32. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
  33. index ceb31e4..6698fa4 100644
  34. --- a/src/CMakeLists.txt
  35. +++ b/src/CMakeLists.txt
  36. @@ -111,7 +111,7 @@ set (mraa_LIB_GLOB_HEADERS
  37. ${PROJECT_SOURCE_DIR}/api/mraa.hpp
  38. )
  39. -add_library (mraa SHARED ${mraa_LIB_SRCS})
  40. +add_library (mraa ${mraa_LIB_SRCS})
  41. target_link_libraries (mraa ${mraa_LIBS})
  42. --
  43. 1.9.1