Skip to content

Commit a73593d

Browse files
rpcmeJustin Boswell
and
Justin Boswell
authored
guard include directory statements with condition on whether or not d… (#266)
* guard include directory statements with condition on whether or not dependencies are being built * By default, this project (parent) clones dependencies (children) recursively (their children and so on). By non-default, this project allows itself to be built when when its children and so on, are pre-built. This is how the meta-aws project handles dependencies. In the non-default case, the sources are not compiled which infers that the sources are not in the source tree - i.e. -DBUILD_DEPS=OFF. The CMakeFiles assume that the dependent sources are in the source tree. This commit allows building this project when the sources are not in the source tree by adding guards around the statements requiring the dependent sources to be in the source tree. Co-authored-by: Justin Boswell <boswej@amazon.com>
1 parent ef0b21f commit a73593d

File tree

7 files changed

+31
-20
lines changed

7 files changed

+31
-20
lines changed

devicedefender/CMakeLists.txt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,13 @@ target_include_directories(IotDeviceDefender-cpp PUBLIC
9090
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
9191
$<INSTALL_INTERFACE:include>)
9292

93-
if (NOT IS_SUBDIRECTORY_INCLUDE)
94-
aws_use_package(aws-crt-cpp)
93+
if (BUILD_DEPS)
94+
if (NOT IS_SUBDIRECTORY_INCLUDE)
95+
aws_use_package(aws-crt-cpp)
96+
endif()
97+
aws_use_package(aws-c-iot)
9598
endif()
9699

97-
aws_use_package(aws-c-iot)
98-
99100
if (BUILD_TESTING)
100101
aws_use_package(IotDeviceCommon-cpp)
101102
endif()

discovery/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,10 @@ target_include_directories(Discovery-cpp PUBLIC
9090
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
9191
$<INSTALL_INTERFACE:include>)
9292

93-
if (NOT IS_SUBDIRECTORY_INCLUDE)
94-
aws_use_package(aws-crt-cpp)
93+
if (BUILD_DEPS)
94+
if (NOT IS_SUBDIRECTORY_INCLUDE)
95+
aws_use_package(aws-crt-cpp)
96+
endif()
9597
endif()
9698

9799
target_link_libraries(Discovery-cpp ${DEP_AWS_LIBS})

identity/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,10 @@ target_include_directories(IotIdentity-cpp PUBLIC
9090
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
9191
$<INSTALL_INTERFACE:include>)
9292

93-
if (NOT IS_SUBDIRECTORY_INCLUDE)
94-
aws_use_package(aws-crt-cpp)
93+
if (BUILD_DEPS)
94+
if (NOT IS_SUBDIRECTORY_INCLUDE)
95+
aws_use_package(aws-crt-cpp)
96+
endif()
9597
endif()
9698

9799
target_link_libraries(IotIdentity-cpp ${DEP_AWS_LIBS})

iotdevicecommon/CMakeLists.txt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,13 @@ target_include_directories(IotDeviceCommon-cpp PUBLIC
9090
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
9191
$<INSTALL_INTERFACE:include>)
9292

93-
if (NOT IS_SUBDIRECTORY_INCLUDE)
94-
aws_use_package(aws-crt-cpp)
93+
if (BUILD_DEPS)
94+
if (NOT IS_SUBDIRECTORY_INCLUDE)
95+
aws_use_package(aws-crt-cpp)
96+
endif()
97+
aws_use_package(aws-c-iot)
9598
endif()
9699

97-
aws_use_package(aws-c-iot)
98-
99100
target_link_libraries(IotDeviceCommon-cpp ${DEP_AWS_LIBS})
100101

101102
install(FILES ${AWS_IOTDEVICECOMMON_HEADERS} DESTINATION "include/aws/iotdevicecommon/" COMPONENT Development)

jobs/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,10 @@ target_include_directories(IotJobs-cpp PUBLIC
9090
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
9191
$<INSTALL_INTERFACE:include>)
9292

93-
if (NOT IS_SUBDIRECTORY_INCLUDE)
94-
aws_use_package(aws-crt-cpp)
93+
if (BUILD_DEPS)
94+
if (NOT IS_SUBDIRECTORY_INCLUDE)
95+
aws_use_package(aws-crt-cpp)
96+
endif()
9597
endif()
9698

9799
target_link_libraries(IotJobs-cpp ${DEP_AWS_LIBS})

secure_tunneling/CMakeLists.txt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,13 @@ target_include_directories(IotSecureTunneling-cpp PUBLIC
9090
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
9191
$<INSTALL_INTERFACE:include>)
9292

93-
if (NOT IS_SUBDIRECTORY_INCLUDE)
94-
aws_use_package(aws-crt-cpp)
93+
if (BUILD_DEPS)
94+
if (NOT IS_SUBDIRECTORY_INCLUDE)
95+
aws_use_package(aws-crt-cpp)
96+
endif()
97+
aws_use_package(aws-c-iot)
9598
endif()
9699

97-
aws_use_package(aws-c-iot)
98-
99100
if (BUILD_TESTING)
100101
aws_use_package(IotDeviceCommon-cpp)
101102
endif()

shadow/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,10 @@ target_include_directories(IotShadow-cpp PUBLIC
9090
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
9191
$<INSTALL_INTERFACE:include>)
9292

93-
if (NOT IS_SUBDIRECTORY_INCLUDE)
94-
aws_use_package(aws-crt-cpp)
93+
if (BUILD_DEPS)
94+
if (NOT IS_SUBDIRECTORY_INCLUDE)
95+
aws_use_package(aws-crt-cpp)
96+
endif()
9597
endif()
9698

9799
target_link_libraries(IotShadow-cpp ${DEP_AWS_LIBS})

0 commit comments

Comments
 (0)