forked from szechyjs/mbelib
-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
51 lines (38 loc) · 1.42 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
project(mbe)
cmake_minimum_required(VERSION 2.6)
if(MSVC)
# needed for M_PI macro
add_definitions(-D_USE_MATH_DEFINES)
endif()
FILE(GLOB SRCS *.c)
include_directories("${PROJECT_SOURCE_DIR}")
ADD_LIBRARY(mbe-static STATIC ${SRCS})
ADD_LIBRARY(mbe-shared SHARED ${SRCS})
if(NOT WIN32)
TARGET_LINK_LIBRARIES(mbe-static m)
TARGET_LINK_LIBRARIES(mbe-shared m)
endif()
include(GNUInstallDirs)
set_target_properties(mbe-static mbe-shared
PROPERTIES
OUTPUT_NAME mbe
VERSION 1.3
SOVERSION 1
INSTALL_NAME_DIR ${CMAKE_INSTALL_FULL_LIBDIR}
PUBLIC_HEADER "mbelib.h")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/libmbe.pc.in"
"${CMAKE_CURRENT_BINARY_DIR}/libmbe.pc"
@ONLY)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libmbe.pc"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
install(TARGETS mbe-static mbe-shared
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
# uninstall target
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)