-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
52 lines (42 loc) · 1.53 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
cmake_minimum_required (VERSION 3.15.4)
project (mutils)
include(GNUInstallDirs)
#Versions
set(mutils_VERSION 1.0)
#CXX FLAGS
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g")
set(CMAKE_SHARED_LINKER_FLAGS "-shared --enable-new-dtags")
if ( NOT DEFINED CMAKE_INSTALL_LIBDIR )
set( CMAKE_INSTALL_LIBDIR lib )
endif ( )
add_library(mutils SHARED utils.cpp abiutils.cpp)
target_include_directories(mutils PRIVATE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
#Make install
install(TARGETS mutils EXPORT mutilsTargets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(DIRECTORY include/mutils
DESTINATION include)
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/mutils/mutilsConfigVersion.cmake"
VERSION ${mutils_VERSION}
COMPATIBILITY AnyNewerVersion
)
set(ConfigPackageLocation lib/cmake/mutils)
configure_package_config_file(mutilsConfig.cmake
"${CMAKE_CURRENT_BINARY_DIR}/mutils/mutilsConfig.cmake"
INSTALL_DESTINATION ${ConfigPackageLocation}
PATH_VARS CMAKE_INSTALL_LIBDIR CMAKE_INSTALL_INCLUDEDIR ConfigPackageLocation
)
install(EXPORT mutilsTargets
FILE mutilsTargets.cmake
NAMESPACE mutils::
DESTINATION ${ConfigPackageLocation})
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/mutils/mutilsConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/mutils/mutilsConfigVersion.cmake"
DESTINATION ${ConfigPackageLocation}
)