Skip to content

Commit 4da34b7

Browse files
author
Lawrence O'Boyle
committed
These two lines allow the scope of the property <target> for the public
headers to be available when making use of the add_subdirectory from a parent project. This will allow other add_subdirectory's to reference the headers during the build process of cmake.
1 parent 7d31d1e commit 4da34b7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,11 @@ list(APPEND restclient-cpp_PUBLIC_HEADERS
6262
# target_sources(restclient-cpp PRIVATE ${restclient-cpp_PUBLIC_HEADERS})
6363
set_property(TARGET restclient-cpp PROPERTY
6464
PUBLIC_HEADER ${restclient-cpp_PUBLIC_HEADERS})
65-
target_include_directories(restclient-cpp PRIVATE include)
65+
target_include_directories(restclient-cpp
66+
PRIVATE include
67+
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
68+
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
69+
)
6670

6771
if(NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/version.h.in")
6872
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/version.h.in" [=[

0 commit comments

Comments
 (0)