forked from OpenAssetIO/OpenAssetIO
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
82 lines (63 loc) · 2.25 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
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
# SPDX-License-Identifier: Apache-2.0
# Copyright 2013-2022 The Foundry Visionmongers Ltd
#----------------------------------------------------------------------
# Public headers
set(_public_header_source_root ${CMAKE_CURRENT_LIST_DIR}/include)
# Installation location for install phase.
install(
DIRECTORY
${_public_header_source_root}/openassetio
DESTINATION
${CMAKE_INSTALL_INCLUDEDIR}
)
#-----------------------------------------------------------------------
# Create core C target
# Note: static vs. shared is auto-determined by CMake's built-in
# BUILD_SHARED_LIBS option.
add_library(openassetio-core-c)
add_library(${PROJECT_NAME}::openassetio-core-c ALIAS openassetio-core-c)
# Set good default target options.
openassetio_set_default_target_properties(openassetio-core-c)
# Set output artifact base filename.
set_target_properties(openassetio-core-c PROPERTIES OUTPUT_NAME openassetio-c)
# Add to the set of installable targets.
install(TARGETS openassetio-core-c EXPORT ${PROJECT_NAME}_EXPORTED_TARGETS)
#-----------------------------------------------------------------------
# Target dependencies
# Source file dependencies.
target_sources(
openassetio-core-c
PRIVATE
src/hostApi/Manager.cpp
src/managerApi/CManagerInterfaceAdapter.cpp
src/InfoDictionary.cpp
)
# Public header dependency.
target_include_directories(openassetio-core-c
PUBLIC
# Use includes from source tree for building.
"$<BUILD_INTERFACE:${_public_header_source_root}>")
target_link_libraries(openassetio-core-c
PUBLIC
# Core C++ library.
openassetio-core)
#-----------------------------------------------------------------------
# API export header
# Use CMake utility to generate the export header.
include(GenerateExportHeader)
generate_export_header(
openassetio-core-c
EXPORT_FILE_NAME ${PROJECT_BINARY_DIR}/include/openassetio/c/export.h
)
install(
FILES ${PROJECT_BINARY_DIR}/include/openassetio/c/export.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/openassetio/c/
)
#-----------------------------------------------------------------------
# Tests
if (OPENASSETIO_ENABLE_TESTS)
add_subdirectory(tests)
if (OPENASSETIO_ENABLE_TEST_ABI)
openassetio_add_abi_test_target(openassetio-core-c)
endif ()
endif ()