-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
51 lines (38 loc) · 1.91 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
cmake_minimum_required (VERSION 3.0.0)
if (CMAKE_BUILD_TYPE STREQUAL "")
set (CMAKE_BUILD_TYPE "Debug")
endif ()
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
project (squash-plugins-extra)
include (GNUInstallDirs)
include (ExtraWarningFlags)
include (CheckFunctionExists)
include (CheckIncludeFile)
include (AddCompilerFlags)
set(SQUASH_VERSION_API "0.8")
find_package (Squash REQUIRED)
include_directories (${Squash_INCLUDE_DIRS})
if (NOT EXISTS "${PROJECT_SOURCE_DIR}/plugins/pithy/pithy/pithy.c")
message (FATAL_ERROR "It looks like you don't have submodules checked out.
If you are compiling from git, make sure to run `git submodule update --init --recursive' or call autogen.sh, which will invoke that command for you.
If you are compiling from a tarball, make sure you don't use the ones automatically generated by GitHub—they don't include submodules and are, therefore, completely broken. Official releases are on https://github.com/quixdb/squash/releases and are the ones labeled \"squash-plugins-extra-x.y.z.tar.bz2\", not \"Source code\". GitHub is aware of the issue.")
endif ()
# This only works with gcc/clang at the moment.
function (squash_set_target_visibility target visibility)
set (flag "-fvisibility=${visibility}")
string (REGEX REPLACE "[-=]+" "_" abbrev_test_name "${flag}")
CHECK_C_COMPILER_FLAG ("-fvisibility=${visibility}" "CFLAG_${abbrev_test_name}")
CHECK_CXX_COMPILER_FLAG ("-fvisibility=${visibility}" "CXXFLAG_${abbrev_test_name}")
if (CFLAG_${abbrev_test_name})
target_add_compiler_flags (${target} ${flag})
set_property (TARGET ${target} APPEND PROPERTY LINKER_FLAGS "${flag}")
endif ()
unset (flag)
unset (abbrev_test_name)
endfunction (squash_set_target_visibility)
if (CMAKE_BUILD_TYPE MATCHES "Release")
global_add_compiler_flags (-O3 -flto -DNDEBUG)
elseif (NOT ENABLE_COVERAGE STREQUAL "yes")
global_add_compiler_flags (-g -O2)
endif ()
add_subdirectory (plugins)