-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
61 lines (54 loc) · 2.68 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
52
53
54
55
56
57
58
59
60
61
# Copyright 2016, alex at staticlibs.net
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
cmake_minimum_required ( VERSION 2.8.12 )
project ( staticlib_compress CXX )
set ( ${PROJECT_NAME}_STATICLIB_VERSION 1.2.2 )
set ( ${PROJECT_NAME}_DESCRIPTION "Staticlibs Compress library" )
set ( ${PROJECT_NAME}_URL https://github.com/staticlibs/staticlib_compress )
include ( ${CMAKE_CURRENT_LIST_DIR}/resources/macros.cmake )
option ( ${PROJECT_NAME}_ENABLE_XZ "Enable support for XZ" OFF )
# docs
option ( ${PROJECT_NAME}_ENABLE_DOCS "Generate doxyfile and exit build" OFF )
if ( ${PROJECT_NAME}_ENABLE_DOCS )
configure_file ( ${CMAKE_CURRENT_LIST_DIR}/resources/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile )
return ( )
endif ( )
# standalone build
if ( NOT DEFINED CMAKE_LIBRARY_OUTPUT_DIRECTORY )
set ( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} )
endif ( )
if ( NOT DEFINED STATICLIB_TOOLCHAIN )
if ( NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Linux" )
staticlib_compress_add_subdirectory ( ${CMAKE_CURRENT_LIST_DIR}/../external_zlib )
if ( ${PROJECT_NAME}_ENABLE_XZ )
staticlib_compress_add_subdirectory ( ${CMAKE_CURRENT_LIST_DIR}/../external_xz )
endif ( )
endif ( )
staticlib_compress_add_subdirectory ( ${CMAKE_CURRENT_LIST_DIR}/../staticlib_config )
staticlib_compress_add_subdirectory ( ${CMAKE_CURRENT_LIST_DIR}/../staticlib_support )
staticlib_compress_add_subdirectory ( ${CMAKE_CURRENT_LIST_DIR}/../staticlib_io )
staticlib_compress_add_subdirectory ( ${CMAKE_CURRENT_LIST_DIR}/../staticlib_endian )
endif ( )
# target
file ( GLOB_RECURSE ${PROJECT_NAME}_HEADERS ${CMAKE_CURRENT_LIST_DIR}/include/*.hpp )
source_group ( "include" FILES ${${PROJECT_NAME}_HEADERS} )
add_custom_target ( ${PROJECT_NAME} SOURCES ${${PROJECT_NAME}_HEADERS} )
# pkg-config
set ( ${PROJECT_NAME}_PC_REQUIRES "zlib" )
set ( ${PROJECT_NAME}_PC_CFLAGS "-I${CMAKE_CURRENT_LIST_DIR}/include -DZLIB_CONST" )
if ( ${PROJECT_NAME}_ENABLE_XZ )
set ( ${PROJECT_NAME}_PC_CFLAGS "${${PROJECT_NAME}_PC_CFLAGS} -DSTATCILIB_COMPRESS_ENABLE_XZ" )
endif ( )
configure_file ( ${CMAKE_CURRENT_LIST_DIR}/resources/pkg-config.in
${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/pkgconfig/${PROJECT_NAME}.pc )