Skip to content

Commit

Permalink
ci: Fix broken samples build
Browse files Browse the repository at this point in the history
Signed-off-by: Siddharth Chandrasekaran <[email protected]>
  • Loading branch information
sidcha committed Mar 22, 2024
1 parent 62baa2e commit 1334309
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
6 changes: 2 additions & 4 deletions examples/c/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@ endif()
set(CP_SAMPLE c_cp_sample)
set(PD_SAMPLE c_pd_sample)

include_directories(${LIBOSDP_INCLUDE_DIR} ${CMAKE_SOURCE_DIRECTORY}/include)

add_executable(${CP_SAMPLE} cp_app.c)
add_executable(${PD_SAMPLE} pd_app.c)

target_link_libraries(${CP_SAMPLE} osdp)
target_link_libraries(${PD_SAMPLE} osdp)
target_link_libraries(${CP_SAMPLE} PRIVATE $<IF:$<TARGET_EXISTS:osdp>,osdp,osdpstatic>)
target_link_libraries(${PD_SAMPLE} PRIVATE $<IF:$<TARGET_EXISTS:osdp>,osdp,osdpstatic>)
4 changes: 2 additions & 2 deletions examples/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ set(PD_SAMPLE cpp_pd_sample)
add_executable(${CP_SAMPLE} cp_app.cpp)
add_executable(${PD_SAMPLE} pd_app.cpp)

target_link_libraries(${CP_SAMPLE} osdp)
target_link_libraries(${PD_SAMPLE} osdp)
target_link_libraries(${CP_SAMPLE} PRIVATE $<IF:$<TARGET_EXISTS:osdp>,osdp,osdpstatic>)
target_link_libraries(${PD_SAMPLE} PRIVATE $<IF:$<TARGET_EXISTS:osdp>,osdp,osdpstatic>)
12 changes: 10 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ if (CONFIG_OSDP_PACKET_TRACE OR CONFIG_OSDP_DATA_TRACE)
)
endif()

list(APPEND LIB_OSDP_INCLUDE_DIRS
${PROJECT_BINARY_DIR}/include
)

list(APPEND LIB_OSDP_PRIVATE_INCLUDE_DIRS
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
Expand Down Expand Up @@ -107,6 +111,7 @@ list(APPEND LIB_OSDP_UTILS_SRC
list(APPEND LIB_OSDP_HEADERS
${PROJECT_SOURCE_DIR}/include/osdp.h
${PROJECT_SOURCE_DIR}/include/osdp.hpp
${CMAKE_CURRENT_BINARY_DIR}/osdp_export.h
)

# These variables are used in other parts of this projects for rebuilding
Expand Down Expand Up @@ -141,6 +146,7 @@ set_target_properties(${LIB_OSDP_STATIC} PROPERTIES
target_include_directories(${LIB_OSDP_STATIC}
PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>
$<INSTALL_INTERFACE:include/libosdp>
PRIVATE
${LIB_OSDP_INCLUDE_DIRS}
Expand All @@ -161,6 +167,7 @@ install(
ARCHIVE DESTINATION ${LIBOSDP_LIBRARY_DIR}
PUBLIC_HEADER DESTINATION include/libosdp
)

endif() # CONFIG_BUILD_STATIC

################################################
Expand Down Expand Up @@ -201,6 +208,7 @@ set_target_properties(${LIB_OSDP_SHARED} PROPERTIES
target_include_directories(${LIB_OSDP_SHARED}
PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>
$<INSTALL_INTERFACE:include/libosdp>
PRIVATE
${LIB_OSDP_PRIVATE_INCLUDE_DIRS}
Expand All @@ -227,10 +235,10 @@ endif() # CONFIG_BUILD_SHARED
include(GenerateExportHeader)
generate_export_header(${LIB_TARGET}
BASE_NAME osdp
EXPORT_FILE_NAME ${CMAKE_CURRENT_BINARY_DIR}/osdp_export.h
EXPORT_FILE_NAME ${PROJECT_BINARY_DIR}/include/osdp_export.h
)

install(FILES ${CMAKE_CURRENT_BINARY_DIR}/osdp_export.h
install(FILES ${PROJECT_BINARY_DIR}/include/osdp_export.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libosdp
COMPONENT headers
)
Expand Down

0 comments on commit 1334309

Please sign in to comment.