-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
35 lines (29 loc) · 1.11 KB
/
CMakeLists.txt
File metadata and controls
35 lines (29 loc) · 1.11 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
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (c) 2023 Intercreate, Inc.
# Author: J.P. Hutchins <jp@intercreate.io>
cmake_minimum_required(VERSION 3.20)
# declare ic_macro_magic
project(ic_macro_magic LANGUAGES C CXX)
# add the headers to the library
add_library(${PROJECT_NAME} INTERFACE)
target_include_directories(${PROJECT_NAME} INTERFACE include)
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
# We're in the root, define additional targets for developers.
add_subdirectory(tests)
# generate a package for distribution
# reference: https://www.foonathan.net/2022/06/cmake-fetchcontent/
set(package_files include/ CMakeLists.txt LICENSE)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.zip
COMMAND ${CMAKE_COMMAND} -E tar
c ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.zip
--format=zip
-- ${package_files}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS ${package_files}
)
add_custom_target(package
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.zip
)
endif()