Skip to content

Commit d0d9365

Browse files
authored
Install endian.h and add that to the target include directories... (#345)
... on Windows and MacOS When installing this library the source directory might not be available, thus we need to install the header. However, we need to make sure it is doesn't spill into the global include directories to shadow and os-specific installations e.g. on Linux.
1 parent f0ee8ca commit d0d9365

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

CMakeLists.txt

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,18 @@ add_library(ur_client_library::urcl ALIAS urcl)
5858
target_compile_features(urcl PUBLIC cxx_std_17)
5959

6060
if(MSVC)
61-
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/endian)
6261
target_link_libraries(urcl ws2_32)
62+
target_include_directories(urcl PUBLIC
63+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/endian>
64+
$<INSTALL_INTERFACE:include/${PROJECT_NAME}/3rdparty>
65+
)
6366
else()
67+
if(APPLE)
68+
target_include_directories(urcl PUBLIC
69+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/endian>
70+
$<INSTALL_INTERFACE:include/${PROJECT_NAME}/3rdparty>
71+
)
72+
endif()
6473
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic")
6574
target_compile_options(urcl PRIVATE -Wall -Wextra -Wno-unused-parameter)
6675

@@ -70,7 +79,7 @@ else()
7079
endif()
7180
endif()
7281

73-
target_include_directories( urcl PUBLIC
82+
target_include_directories(urcl PUBLIC
7483
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
7584
$<INSTALL_INTERFACE:include>
7685
)
@@ -102,6 +111,9 @@ install(TARGETS urcl EXPORT urcl_targets
102111
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
103112
)
104113
install(DIRECTORY include/ DESTINATION include)
114+
install(DIRECTORY 3rdparty/endian/ DESTINATION include/${PROJECT_NAME}/3rdparty
115+
FILES_MATCHING PATTERN "*.h"
116+
)
105117

106118
install(EXPORT urcl_targets
107119
DESTINATION lib/cmake/ur_client_library

0 commit comments

Comments
 (0)