xref: /libbtbb/CMakeLists.txt (revision 5cf4c9cb441aa735be0ac77081632db31c920700)
1#
2# Copyright 2013 Dominic Spill
3#
4# This file is part of Libbtbb.
5#
6# This program is free software; you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
8# the Free Software Foundation; either version 2, or (at your option)
9# any later version.
10#
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License
17# along with this program; see the file COPYING.  If not, write to
18# the Free Software Foundation, Inc., 51 Franklin Street,
19# Boston, MA 02110-1301, USA.
20#
21#top level cmake project for libbtbb lib + tools
22
23cmake_minimum_required(VERSION 2.8)
24set(MAJOR_VERSION 0)
25set(MINOR_VERSION 2)
26project(libbtbb_all)
27set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules)
28
29set(INSTALL_DEFAULT_BINDIR "bin" CACHE STRING "Appended to CMAKE_INSTALL_PREFIX")
30
31# Instruct user to remove previous versions, unless using a package manager
32if(NOT PACKAGE_MANAGER)
33  # Unset variables to force the recheck next time
34  # (there has to be a better way to do it than this)
35  UNSET(LIBBTBB_FOUND CACHE)
36  UNSET(LIBBTBB_INCLUDE_DIR CACHE)
37  UNSET(LIBBTBB_LIBRARIES CACHE)
38
39  find_package(BTBB)
40  if(LIBBTBB_FOUND)
41    message( FATAL_ERROR
42      "An existing installation of libbtbb is already present on this system. Please remove it, and any depending applications before building. A helper script is provided, run\n$ sudo ../cmake/cleanup.sh -d\nto find and remove libbtbb and libubertooth and the ubertooth tools")
43  endif()
44endif()
45
46add_subdirectory(lib)
47if(NOT DISABLE_PYTHON)
48	add_subdirectory(python)
49endif()
50
51# Comment the following out for releases.
52set(CMAKE_C_FLAGS "$ENV{CFLAGS}")
53
54# Create uninstall target
55configure_file(
56    ${PROJECT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in
57    ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
58@ONLY)
59
60add_custom_target(uninstall
61    ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
62)
63