Skip to content

Commit 3833ce4

Browse files
committed
feat: add the package target
1 parent 085d84d commit 3833ce4

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

CMakeLists.txt

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,33 @@
22
# SPDX-License-Identifier: Apache-2.0
33
#
44
# Authors: J.P. Hutchins <jp@intercreate.io>
5+
6+
cmake_minimum_required(VERSION 3.20)
7+
project(ic_cmake)
8+
9+
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
10+
# We're in the root, define additional targets for developers.
11+
12+
# generate a package for distribution
13+
# reference: https://www.foonathan.net/2022/06/cmake-fetchcontent/
14+
set(package_files
15+
ic.cmake
16+
LICENSE
17+
dependencies/fetch_test_cmake.cmake
18+
src/ic_bundle.cmake
19+
src/ic_project.cmake
20+
src/ic_utils.cmake
21+
)
22+
add_custom_command(
23+
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.zip
24+
COMMAND ${CMAKE_COMMAND} -E tar
25+
c ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.zip
26+
--format=zip
27+
-- ${package_files}
28+
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
29+
DEPENDS ${package_files}
30+
)
31+
add_custom_target(package
32+
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.zip
33+
)
34+
endif()

0 commit comments

Comments
 (0)