Skip to content
This repository was archived by the owner on Jul 31, 2023. It is now read-only.

Commit a2de572

Browse files
nvartolomeig-easy
authored andcommitted
Use PROJECT_SOURCE_DIR instead of CMAKE_SOURCE_DIR for includes (#267)
Allows including the project using `add_subdirectory` command. `CMAKE_SOURCE_DIR` always resolves to the top level project, breaking includes.
1 parent 6d11e6b commit a2de572

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cmake/OpenCensusHelpers.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ function(opencensus_lib NAME)
4747
if(ARG_SRCS)
4848
add_library(${_NAME} ${ARG_SRCS})
4949
target_link_libraries(${_NAME} PUBLIC ${ARG_DEPS})
50-
target_include_directories(${_NAME} PUBLIC ${CMAKE_SOURCE_DIR})
50+
target_include_directories(${_NAME} PUBLIC ${PROJECT_SOURCE_DIR})
5151
else()
5252
add_library(${_NAME} INTERFACE)
5353
target_link_libraries(${_NAME} INTERFACE ${ARG_DEPS})
54-
target_include_directories(${_NAME} INTERFACE ${CMAKE_SOURCE_DIR})
54+
target_include_directories(${_NAME} INTERFACE ${PROJECT_SOURCE_DIR})
5555
endif()
5656
if(ARG_PUBLIC)
5757
add_library(${PROJECT_NAME}::${NAME} ALIAS ${_NAME})

0 commit comments

Comments
 (0)