-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
61 lines (51 loc) · 1.92 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
cmake_minimum_required(VERSION 3.4 FATAL_ERROR)
project(mpl)
set( version 1.1 )
set( CMAKE_INCLUDE_CURRENT_DIR ON )
##
# for submodules, this needs to be reset to avoid
# preferencing parent module paths.
##
set( CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake )
find_package( NUMA )
find_package( Threads )
find_package( LIBRT )
include( CheckSTD )
install( FILES ${PROJECT_SOURCE_DIR}/include/mpl DESTINATION ${CMAKE_INSTALL_PREFIX}/include )
include_directories ( ${PROJECT_SOURCE_DIR} )
include_directories ( ${PROJECT_SOURCE_DIR}/include )
add_subdirectory( src )
if( NOT WIN32 )
##
# make and setup pkg-config
##
mark_as_advanced( PKG_CONFIG_PATHWAY )
set( PKG_CONFIG_PATH "" CACHE STRING "Set the pkg-config path, othwerwise will figure out" )
if( NOT PKG_CONFIG_PATH )
execute_process( COMMAND pkg-config --variable pc_path pkg-config
COMMAND tr ':' '\n'
COMMAND head -n 1
OUTPUT_VARIABLE LOCAL_PKG_CONFIG_PATHWAY )
set( PKG_CONFIG_PATH ${LOCAL_PKG_CONFIG_PATHWAY} )
endif()
string(REPLACE ":" ";" PREFIX_LIST "${CMAKE_SYSTEM_PREFIX_PATH}")
list(FIND PREFIX_LIST ${CMAKE_INSTALL_PREFIX} _index)
if(${_index} GREATER 0)
file( MAKE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/pkgconfig )
set( PKG_CONFIG_PATH ${CMAKE_INSTALL_PREFIX}/pkgconfig )
message( WARNING "You should set ${RED}PKG_CONFIG_PATH=${CMAKE_INSTALL_PREFIX}/pkgconfig/:$PKG_CONFIG_PATH ${ColourReset} when installing to non-standard prefix for pkg-config to work correctly!" )
else()
message( STATUS "Setting PKG_CONFIG_PATH to: ${PKG_CONFIG_PATH}" )
endif()
configure_file( "mpl.pc.in" "mpl.pc" @ONLY )
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/mpl.pc DESTINATION ${CMAKE_INSTALL_PREFIX}/pkgconfig/ )
##
# BUILD Tests
##
mark_as_advanced( BUILD_TESTS )
set( BUILD_TESTS trrue CACHE BOOL "Tests build target available if true" )
if( BUILD_TESTS )
enable_testing()
add_subdirectory( testsuite )
endif()
endif()