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 ADD_DEFINITIONS(-std=gnu99)
39 #http://gcc.gnu.org/wiki/Visibility
40 add_definitions(-fvisibility=hidden)
43 ########################################################################
44 # Find build dependencies
45 ########################################################################
46 find_package(PkgConfig)
47 find_package(LibRTLSDR)
49 ########################################################################
50 # Setup the include and linker paths
51 ########################################################################
53 ${CMAKE_SOURCE_DIR}/include
54 ${LIBRTLSDR_INCLUDE_DIRS}
57 ########################################################################
58 # Create uninstall target
59 ########################################################################
61 ${CMAKE_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in
62 ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
65 add_custom_target(uninstall
66 ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
69 ########################################################################
71 ########################################################################
72 add_subdirectory(include)
74 add_subdirectory(tests)
76 # use space-separation format for the pc file
77 STRING(REPLACE ";" " " RTL433_PC_CFLAGS "${RTL433_PC_CFLAGS}")
78 STRING(REPLACE ";" " " RTL433_PC_LIBS "${RTL433_PC_LIBS}")
80 # unset these vars to avoid hard-coded paths to cross environment
81 IF(CMAKE_CROSSCOMPILING)
82 UNSET(RTL433_PC_CFLAGS)
84 ENDIF(CMAKE_CROSSCOMPILING)
86 set(prefix ${CMAKE_INSTALL_PREFIX})
87 set(exec_prefix \${prefix})
88 set(libdir \${exec_prefix}/lib)
89 set(includedir \${prefix}/include)
93 DESTINATION lib/pkgconfig