Skip to content

Commit ce9a0e7

Browse files
jeffamstutzdoyubkim
authored andcommitted
CMake library exports (#211)
* add CMake exports to libjet install * do no propagate compile options to downstream users of libjet
1 parent a7bf063 commit ce9a0e7

1 file changed

Lines changed: 19 additions & 8 deletions

File tree

src/jet/CMakeLists.txt

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,6 @@ set(target jet)
1212
# Define
1313
set(root_dir ${CMAKE_CURRENT_SOURCE_DIR}/../..)
1414

15-
# Includes
16-
include_directories(
17-
${CMAKE_CURRENT_SOURCE_DIR}
18-
${CMAKE_CURRENT_SOURCE_DIR}/3rdparty
19-
)
20-
2115
# Sources
2216
file(GLOB header_dir
2317
${root_dir}/include/${target})
@@ -53,9 +47,9 @@ set_target_properties(${target}
5347
# Compile options
5448
target_compile_options(${target}
5549
PRIVATE
50+
${DEFAULT_COMPILE_OPTIONS}
5651

5752
PUBLIC
58-
${DEFAULT_COMPILE_OPTIONS}
5953

6054
INTERFACE
6155
)
@@ -70,6 +64,23 @@ target_link_libraries(${target}
7064
INTERFACE
7165
)
7266

67+
# Includes
68+
target_include_directories(${target}
69+
PRIVATE
70+
${CMAKE_CURRENT_SOURCE_DIR}
71+
${CMAKE_CURRENT_SOURCE_DIR}/3rdparty
72+
73+
PUBLIC
74+
75+
INTERFACE
76+
$<BUILD_INTERFACE:${header_dir}>
77+
$<INSTALL_INTERFACE:include>
78+
)
79+
7380
# Install
74-
install(TARGETS ${target} DESTINATION lib)
81+
install(TARGETS ${target} DESTINATION lib EXPORT ${target}_Export)
7582
install(DIRECTORY ${header_dir} DESTINATION include)
83+
install(EXPORT ${target}_Export
84+
DESTINATION lib/cmake/${target}
85+
FILE ${target}Config.cmake
86+
)

0 commit comments

Comments
 (0)