CMakeLists.txt 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. # Copyright 2012 OSMOCOM Project
  2. #
  3. # This file is part of rtl-sdr
  4. #
  5. # GNU Radio is free software; you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation; either version 3, or (at your option)
  8. # any later version.
  9. #
  10. # GNU Radio is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License
  16. # along with GNU Radio; see the file COPYING. If not, write to
  17. # the Free Software Foundation, Inc., 51 Franklin Street,
  18. # Boston, MA 02110-1301, USA.
  19. ########################################################################
  20. # Project setup
  21. ########################################################################
  22. cmake_minimum_required(VERSION 2.6)
  23. project(rtlsdr C)
  24. #select the release build type by default to get optimization flags
  25. if(NOT CMAKE_BUILD_TYPE)
  26. set(CMAKE_BUILD_TYPE "Release")
  27. message(STATUS "Build type not specified: defaulting to release.")
  28. endif(NOT CMAKE_BUILD_TYPE)
  29. set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "")
  30. list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules)
  31. ########################################################################
  32. # Compiler specific setup
  33. ########################################################################
  34. if(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32)
  35. #http://gcc.gnu.org/wiki/Visibility
  36. add_definitions(-fvisibility=hidden)
  37. endif()
  38. ########################################################################
  39. # Find build dependencies
  40. ########################################################################
  41. find_package(PkgConfig)
  42. find_package(LibUSB)
  43. if(NOT LIBUSB_FOUND)
  44. message(FATAL_ERROR "LibUSB 1.0 required to compile rtl-sdr")
  45. endif()
  46. ########################################################################
  47. # Setup the include and linker paths
  48. ########################################################################
  49. include_directories(
  50. ${CMAKE_SOURCE_DIR}/include
  51. ${LIBUSB_INCLUDE_DIR}
  52. )
  53. #link_directories(
  54. # ...
  55. #)
  56. # Set component parameters
  57. #set(INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include CACHE INTERNAL "" FORCE)
  58. ########################################################################
  59. # Create uninstall target
  60. ########################################################################
  61. configure_file(
  62. ${CMAKE_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in
  63. ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
  64. @ONLY)
  65. add_custom_target(uninstall
  66. ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
  67. )
  68. ########################################################################
  69. # Add subdirectories
  70. ########################################################################
  71. add_subdirectory(include)
  72. add_subdirectory(src)