From 9ff08bcebfcfe938112572d34dd3f3911bab08ee Mon Sep 17 00:00:00 2001 From: Felix Exner Date: Mon, 16 Jun 2025 15:13:07 +0200 Subject: [PATCH] Install endian.h and add that to the target include directories... ... 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. Installing it to a 3rdparty folder and adding that to the target_include_directories on Windows should do the trick from my understanding. --- CMakeLists.txt | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 515295fc..a6aeebdf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,9 +58,18 @@ add_library(ur_client_library::urcl ALIAS urcl) target_compile_features(urcl PUBLIC cxx_std_17) if(MSVC) - include_directories(${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/endian) target_link_libraries(urcl ws2_32) + target_include_directories(urcl PUBLIC + $ + $ + ) else() + if(APPLE) + target_include_directories(urcl PUBLIC + $ + $ + ) + endif() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic") target_compile_options(urcl PRIVATE -Wall -Wextra -Wno-unused-parameter) @@ -70,7 +79,7 @@ else() endif() endif() -target_include_directories( urcl PUBLIC +target_include_directories(urcl PUBLIC $ $ ) @@ -102,6 +111,9 @@ install(TARGETS urcl EXPORT urcl_targets RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) install(DIRECTORY include/ DESTINATION include) +install(DIRECTORY 3rdparty/endian/ DESTINATION include/${PROJECT_NAME}/3rdparty + FILES_MATCHING PATTERN "*.h" +) install(EXPORT urcl_targets DESTINATION lib/cmake/ur_client_library