1 # rtl_433 is distributed in the hope that it will be useful,
2 # but WITHOUT ANY WARRANTY; without even the implied warranty of
3 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 # GNU General Public License for more details.
6 # You should have received a copy of the GNU General Public License
7 # along with GNU Radio; see the file COPYING. If not, write to
8 # the Free Software Foundation, Inc., 51 Franklin Street,
9 # Boston, MA 02110-1301, USA.
12 ########################################################################
14 ########################################################################
15 cmake_minimum_required(VERSION 2.6)
17 set (rtl433_VERSION_MAJOR 1)
18 set (rtl433_VERSION_MINOR 0)
20 #select the release build type by default to get optimization flags
21 if(NOT CMAKE_BUILD_TYPE)
22 set(CMAKE_BUILD_TYPE "Release")
23 message(STATUS "Build type not specified: defaulting to release.")
24 endif(NOT CMAKE_BUILD_TYPE)
25 set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "")
27 list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules)
29 ########################################################################
30 # Compiler specific setup
31 ########################################################################
32 if(CMAKE_COMPILER_IS_GNUCC AND NOT WIN32)
33 ADD_DEFINITIONS(-Wall)
34 ADD_DEFINITIONS(-Wextra)
35 ADD_DEFINITIONS(-Wno-unused)
36 ADD_DEFINITIONS(-Wsign-compare)
37 ADD_DEFINITIONS(-g3 -O0)
38 #http://gcc.gnu.org/wiki/Visibility
39 add_definitions(-fvisibility=hidden)
42 ########################################################################
43 # Find build dependencies
44 ########################################################################
45 find_package(PkgConfig)
46 find_package(LibRTLSDR)
48 ########################################################################
49 # Setup the include and linker paths
50 ########################################################################
52 ${CMAKE_SOURCE_DIR}/include
53 ${LIBRTLSDR_INCLUDE_DIRS}
56 ########################################################################
57 # Create uninstall target
58 ########################################################################
60 ${CMAKE_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in
61 ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
64 add_custom_target(uninstall
65 ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
68 ########################################################################
70 ########################################################################
71 add_subdirectory(include)
74 # use space-separation format for the pc file
75 STRING(REPLACE ";" " " RTL433_PC_CFLAGS "${RTL433_PC_CFLAGS}")
76 STRING(REPLACE ";" " " RTL433_PC_LIBS "${RTL433_PC_LIBS}")
78 # unset these vars to avoid hard-coded paths to cross environment
79 IF(CMAKE_CROSSCOMPILING)
80 UNSET(RTL433_PC_CFLAGS)
82 ENDIF(CMAKE_CROSSCOMPILING)
84 set(prefix ${CMAKE_INSTALL_PREFIX})
85 set(exec_prefix \${prefix})
86 set(libdir \${exec_prefix}/lib)
87 set(includedir \${prefix}/include)
91 DESTINATION lib/pkgconfig