-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
103 lines (81 loc) · 3.44 KB
/
CMakeLists.txt
File metadata and controls
103 lines (81 loc) · 3.44 KB
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
cmake_minimum_required(VERSION 3.10)
## start setting
SET (this_target cinterop)
set(TARGET_LIB_NAME cinterop)
SET (this_target ${TARGET_LIB_NAME})
set(TARGET_MAJOR 1)
set(TARGET_MINOR 2)
set(TARGET_RELEASE 0)
set(TARGET_VERSION ${TARGET_MAJOR}.${TARGET_MINOR}.${TARGET_RELEASE})
SET (VERSION ${TARGET_VERSION})
PROJECT(${this_target} VERSION ${TARGET_VERSION} DESCRIPTION "Reusable functions for marshalling data between C, C++ and other programming languages")
include(GNUInstallDirs)
## section: include directory
INCLUDE_DIRECTORIES(
./include
)
## section: source files
# Add your source files here (one file per line), please SORT in alphabetical order for future maintenance
SET (${this_target}_SOURCE_FILES
)
## section: header files
# Add your header files here(one file per line), please SORT in alphabetical order for future maintenance!
SET(${this_target}_HEADER_FILES
include/cinterop/c_boost_posix_time_interop.hpp
include/cinterop/c_cpp_interop.hpp
include/cinterop/c_interop_forward_decl.h
include/cinterop/common_c_interop.h
include/cinterop/object_lifetimes.hpp
include/cinterop/rcpp_interop.hpp
include/cinterop/rcpp_strict_r_headers.hpp
include/cinterop/rcpp_timeseries_interop.hpp
include/cinterop/timeseries_c_interop.h
include/cinterop/timeseries_interop.hpp
)
IF (ENABLE_CODECOVERAGE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_COVERAGE}")
ENDIF()
## section: precompiled header
#ADD_MSVC_PRECOMPILED_HEADER("precompiled.h" "precompiled.cpp" MySources)
#ADD_LIBRARY(MyLibrary ${MySources})
SET_SOURCE_FILES_PROPERTIES(${this_target}_HEADER_FILES
PROPERTIES HEADER_FILE_ONLY TRUE)
LIST(APPEND ${this_target}_SOURCE_FILES ${${this_target}_HEADER_FILES})
## section: add definitions
ADD_DEFINITIONS(
# -DCMAKE_CXX_FLAGS:STRING=' -std=c++11 '
)
# JM needed to use this as of 2016-07, after an upgrade to latest Debian setup. The Add_definitions macro was not working, somehow.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
## section: add target
add_library(${this_target} INTERFACE)
configure_file(${TARGET_LIB_NAME}.pc.in ${TARGET_LIB_NAME}.pc @ONLY)
# Files to be installed
INSTALL(FILES ${${this_target}_HEADER_FILES} DESTINATION include/cinterop)
########### Add uninstall target ###############
# 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)
########### End uninstall target ###############
if(WIN32)
else()
install(FILES ${CMAKE_BINARY_DIR}/${TARGET_LIB_NAME}.pc
# DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig) from examplar, but this appears not prevalent, most I see are under /usr/lib/x86_64-linux-gnu/pkgconfig, so:
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
# The above also prevents a lintian error
endif()
# Packages - currently just an RPM
set(CPACK_PACKAGE_VERSION ${VERSION})
set(CPACK_GENERATOR "RPM;TGZ")
set(CPACK_PACKAGE_NAME "cinterop")
set(CPACK_PACKAGE_RELEASE 1)
set(CPACK_RPM_PACKAGE_RELEASE ${CPACK_PACKAGE_RELEASE})
set(CPACK_PACKAGE_CONTACT "Jean-Michel Perraud")
set(CPACK_PACKAGE_VENDOR "CSIRO")
set(CPACK_PACKAGING_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_PACKAGE_RELEASE}.${CMAKE_SYSTEM_PROCESSOR}")
include(CPack)