-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathbundling.cmake
More file actions
41 lines (36 loc) · 1.44 KB
/
Copy pathbundling.cmake
File metadata and controls
41 lines (36 loc) · 1.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
include_guard(GLOBAL)
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/dist" CACHE PATH "..." FORCE)
endif()
# set RPATH to the planned install path of lib folder
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
# bundling
# FIXME (aw): in case of dist folder, we could only clean up the dist folder
add_custom_target(bundle
COMMAND "${CMAKE_COMMAND}" -E remove_directory ${CMAKE_BINARY_DIR}/bundle
COMMAND "${CMAKE_COMMAND}" --build "${CMAKE_BINARY_DIR}"
COMMAND "${CMAKE_COMMAND}"
-E env DESTDIR=bundle
"${CMAKE_COMMAND}" --install "${CMAKE_BINARY_DIR}"
$<$<NOT:$<BOOL:${EVEREST_CMAKE_DISABLE_STRIPPING_BUNDLE}>>:--strip>
COMMAND rm -rf
bundle/${CMAKE_INSTALL_PREFIX}/include
bundle/${CMAKE_INSTALL_PREFIX}/lib/cmake
bundle/${CMAKE_INSTALL_PREFIX}/lib/pkgconfig
bundle/${CMAKE_INSTALL_PREFIX}/lib/*.a
COMMAND "${CMAKE_COMMAND}" -E echo ""
COMMAND "${CMAKE_COMMAND}" -E echo "Created bundle folder at ${CMAKE_BINARY_DIR}/bundle"
COMMAND "${CMAKE_COMMAND}" -E echo ""
WORKING_DIRECTORY
${CMAKE_BINARY_DIR}
)
set(BUNDLE_TAR_FILE "${CMAKE_BINARY_DIR}/${PROJECT_NAME}.tgz")
add_custom_target(bundle-tar
DEPENDS bundle
COMMAND tar
-czf "${BUNDLE_TAR_FILE}"
-C "${CMAKE_BINARY_DIR}/bundle/${CMAKE_INSTALL_PREFIX}"
./
WORKING_DIRECTORY
${CMAKE_BINARY_DIR}
)