0001-cmake-handle-static-library-and-find-required-thread.patch 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. From 46660112b76664473cc98b8ae6c863fd27c27d2d Mon Sep 17 00:00:00 2001
  2. From: Samuel Martin <s.martin49@gmail.com>
  3. Date: Fri, 29 Aug 2014 23:40:59 +0200
  4. Subject: [PATCH] cmake: handle static library and find required thread
  5. module
  6. Signed-off-by: Samuel Martin <s.martin49@gmail.com>
  7. ---
  8. CMakeLists.txt | 2 ++
  9. src/CMakeLists.txt | 4 +++-
  10. 2 files changed, 5 insertions(+), 1 deletion(-)
  11. diff --git a/CMakeLists.txt b/CMakeLists.txt
  12. index 79f644c..7779a2a 100644
  13. --- a/CMakeLists.txt
  14. +++ b/CMakeLists.txt
  15. @@ -6,7 +6,9 @@ enable_testing()
  16. # use local module (for Findlibusb-1.0.cmake)
  17. set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
  18. +find_package(Threads REQUIRED)
  19. find_package(libusb-1.0 REQUIRED)
  20. +
  21. if (NOT LIBUSB_1_FOUND)
  22. message(FATAL_ERROR "libusb-1.0 not installed. (try apt-get install libusb-1.0-0-dev)")
  23. endif (NOT LIBUSB_1_FOUND)
  24. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
  25. index 149d198..0597ccd 100644
  26. --- a/src/CMakeLists.txt
  27. +++ b/src/CMakeLists.txt
  28. @@ -18,8 +18,10 @@ set (iqrf_sources
  29. include_directories ("${LIBUSB_1_INCLUDE_DIRS}")
  30. -add_library(iqrf SHARED ${iqrf_sources} ${iqrf_headers})
  31. +add_library(iqrf ${iqrf_sources} ${iqrf_headers})
  32. +
  33. target_link_libraries(iqrf ${LIBUSB_1_LIBRARIES})
  34. +target_link_libraries(iqrf ${CMAKE_THREAD_LIBS_INIT})
  35. set_target_properties(iqrf PROPERTIES
  36. VERSION "${iqrf_version_major}.${iqrf_version_minor}"
  37. --
  38. 2.1.0