-
Notifications
You must be signed in to change notification settings - Fork 6
/
CMakeLists.txt
114 lines (90 loc) · 4.28 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
cmake_minimum_required(VERSION 3.0)
project(asplib VERSION 1.0)
set(CMAKE_POSITION_INDEPENDENT_CODE 1)
# Enable C++11
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
# TODO solve 'Enable C++ exceptions' to 'NO' and I got warning: warning C4530: C++ exception handler used,
# but unwind semantics are not enabled. Specify /EHsc'
# Solution: http://stackoverflow.com/questions/552695/how-can-i-switch-off-exception-handling-in-msvc
# make sure CMAKE_PREFIX_PATH is set
# if(NOT CMAKE_PREFIX_PATH)
# set(CMAKE_PREFIX_PATH "E:/Kodi/adsp_addons/asplib_depends")
# list(APPEND CMAKE_PREFIX_PATH "E:/Kodi/adsp_addons/asplib_depends/include")
# list(APPEND CMAKE_PREFIX_PATH "E:/Kodi/adsp_addons/asplib_depends/lib")
# else()
file(TO_CMAKE_PATH "${CMAKE_PREFIX_PATH}" CMAKE_PREFIX_PATH)
list(APPEND CMAKE_PREFIX_PATH "${CMAKE_INSTALL_PREFIX}")
list(APPEND CMAKE_PREFIX_PATH "${CMAKE_INSTALL_PREFIX}/include")
list(APPEND CMAKE_PREFIX_PATH "${CMAKE_INSTALL_PREFIX}/lib")
# endif()
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
message(STATUS "CMAKE_CURRENT_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}")
message(STATUS "CMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}")
foreach(path ${CMAKE_PREFIX_PATH})
message(STATUS "path=${path}")
endforeach()
if(NOT ASPLIB_MODULES_TO_BUILD)
set(ASPLIB_MODULES_TO_BUILD all)
endif()
include(cmake/UseMultiArch.cmake)
include(cmake/asplib_helpers.cmake)
if(NOT ASPLIB_FORCE_DEPENCY_BUILDS)
set(ASPLIB_FORCE_DEPENCY_BUILDS OFF)
endif()
# project defines vars such as PROJECT_NAME, PROJECT_VERSION, ...
if(NOT ${ASPLIB_BUILD_COUNT})
set(ASPLIB_BUILD_COUNT 0)
endif()
set(asplib_VERSION_PATCH ${ASPLIB_BUILD_COUNT})
set(asplib_DESCRIPTION "asplib (Achim's Signal Processing LIBrary), is a small and lightweight C++ library for digital signal processing.")
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
if(CMAKE_SYSTEM_NAME MATCHES Linux)
add_definitions(-DTARGET_LINUX -fPIC)
elseif(CMAKE_SYSTEM_NAME MATCHES Windows)
add_definitions(-DTARGET_WINDOWS)
# Enable the orginization of projects with folders
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
endif()
add_subdirectory(asplib_modules)
if(NOT WIN32)
# Pkgconfig
include(cmake/PkgConfigHandler.cmake)
configure_pc_file(asplib cmake/asplib.pc.in
asplib.pc
${CMAKE_INSTALL_PREFIX}
${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}
${CMAKE_INSTALL_PREFIX}/include)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/asplib.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR_NOARCH}/pkgconfig)
endif()
# config mode
#configure_file(cmake/asplib-config.cmake.in
# asplib-config.cmake @ONLY)
#install(FILES ${CMAKE_CURRENT_BINARY_DIR}/asplib-config.cmake
# DESTINATION ${CMAKE_INSTALL_LIBDIR_NOARCH}/asplib)
# Generate and install a CMake config, version and target file
include(CMakePackageConfigHelpers)
set(CMAKE_INSTALL_CMAKECONFIGDIR
${CMAKE_INSTALL_LIBDIR_NOARCH}/cmake/${PROJECT_NAME}-${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR})
write_basic_package_version_file(${PROJECT_NAME}-config-version.cmake COMPATIBILITY SameMajorVersion)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake
DESTINATION ${CMAKE_INSTALL_CMAKECONFIGDIR})
configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/${PROJECT_NAME}-config.cmake.in ${PROJECT_NAME}-config.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_CMAKECONFIGDIR})
#PATH_VARS INCLUDE_INSTALL_DIR)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake DESTINATION ${CMAKE_INSTALL_CMAKECONFIGDIR})
install(EXPORT ${PROJECT_NAME} FILE ${PROJECT_NAME}-targets.cmake NAMESPACE ${CMAKE_PROJECT_NAME}::
DESTINATION ${CMAKE_INSTALL_CMAKECONFIGDIR})
get_cmake_property(_variableNames VARIABLES)
foreach (_variableName ${_variableNames})
message(STATUS "${_variableName}=${${_variableName}}")
endforeach()
# Print project configuration
message(STATUS)
message(STATUS "${CMAKE_PROJECT_NAME} - Configuration:")
message(STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
message(STATUS "CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}")
message(STATUS)