| 1 |
# |
| 2 |
# %injeqt copyright begin% |
| 3 |
# Copyright 2014 Rafał Malinowski ([email protected]) |
| 4 |
# %injeqt copyright end% |
| 5 |
# |
| 6 |
# This library is free software; you can redistribute it and/or |
| 7 |
# modify it under the terms of the GNU Lesser General Public |
| 8 |
# License as published by the Free Software Foundation; either |
| 9 |
# version 2.1 of the License, or (at your option) any later version. |
| 10 |
# |
| 11 |
# This library 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 GNU |
| 14 |
# Lesser General Public License for more details. |
| 15 |
# |
| 16 |
# You should have received a copy of the GNU Lesser General Public |
| 17 |
# License along with this library; if not, write to the Free Software |
| 18 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 19 |
# |
| 20 |
|
| 21 |
project (injeqt) |
| 22 |
cmake_minimum_required (VERSION 2.8) |
| 23 |
|
| 24 |
set (INJEQT_SOVERSION "1") |
| 25 |
set (INJEQT_VERSION "1.2") |
| 26 |
|
| 27 |
option (DISABLE_TESTS "Do not build tests" OFF) |
| 28 |
option (DISABLE_EXAMPLES "Do not build examples" OFF) |
| 29 |
|
| 30 |
find_package (Qt5Core 5.2 REQUIRED) |
| 31 |
|
| 32 |
# do not link with qtmain on windows |
| 33 |
if (POLICY CMP0020) |
| 34 |
cmake_policy (SET CMP0020 OLD) |
| 35 |
endif () |
| 36 |
if (POLICY CMP0043) |
| 37 |
cmake_policy (SET CMP0043 NEW) |
| 38 |
endif () |
| 39 |
|
| 40 |
set (WARNINGS "-Werror -W -Wall -Wextra -Wundef -Wunused -Wuninitialized -Wcast-align -Wpointer-arith -Woverloaded-virtual -Wnon-virtual-dtor -fno-common") |
| 41 |
set (VISIBILITY "-fvisibility=hidden -fvisibility-inlines-hidden") |
| 42 |
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 ${WARNINGS} ${VISIBILITY}") |
| 43 |
|
| 44 |
set (CMAKE_AUTOMOC TRUE) |
| 45 |
set (CMAKE_INCLUDE_CURRENT_DIR ON) |
| 46 |
|
| 47 |
include_directories ( |
| 48 |
${CMAKE_CURRENT_SOURCE_DIR}/include |
| 49 |
${CMAKE_CURRENT_SOURCE_DIR}/src/internal |
| 50 |
) |
| 51 |
|
| 52 |
add_subdirectory (src) |
| 53 |
|
| 54 |
if (NOT DISABLE_EXAMPLES) |
| 55 |
add_subdirectory (examples) |
| 56 |
endif (NOT DISABLE_EXAMPLES) |
| 57 |
|
| 58 |
if (NOT CMAKE_BUILD_TYPE MATCHES RELEASE AND NOT DISABLE_TESTS) |
| 59 |
enable_testing () |
| 60 |
add_subdirectory (test) |
| 61 |
endif (NOT CMAKE_BUILD_TYPE MATCHES RELEASE AND NOT DISABLE_TESTS) |
| 62 |
|
| 63 |
if (NOT DEFINED CMAKE_INSTALL_LIBDIR) |
| 64 |
set (CMAKE_INSTALL_LIBDIR lib) |
| 65 |
endif (NOT DEFINED CMAKE_INSTALL_LIBDIR) |
| 66 |
|
| 67 |
set (prefix ${CMAKE_INSTALL_PREFIX}) |
| 68 |
set (exec_prefix ${CMAKE_INSTALL_PREFIX}) |
| 69 |
set (libdir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}) |
| 70 |
set (includedir ${CMAKE_INSTALL_PREFIX}/include) |
| 71 |
set (LIBS "-lQt5Core") |
| 72 |
|
| 73 |
configure_file ( |
| 74 |
${CMAKE_CURRENT_SOURCE_DIR}/injeqt.pc.in |
| 75 |
${CMAKE_CURRENT_BINARY_DIR}/injeqt.pc |
| 76 |
@ONLY |
| 77 |
) |
| 78 |
|
| 79 |
install (DIRECTORY |
| 80 |
include/injeqt DESTINATION include |
| 81 |
) |
| 82 |
|
| 83 |
install (FILES |
| 84 |
${CMAKE_CURRENT_BINARY_DIR}/injeqt.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig |
| 85 |
) |