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

Commit

Permalink
Use PROJECT_SOURCE_DIR instead of CMAKE_SOURCE_DIR for includes (#267)
Browse files Browse the repository at this point in the history
Allows including the project using `add_subdirectory` command.

`CMAKE_SOURCE_DIR` always resolves to the top level project, breaking includes.
  • Loading branch information
nvartolomei authored and g-easy committed Jan 18, 2019
1 parent 6d11e6b commit a2de572
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cmake/OpenCensusHelpers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ function(opencensus_lib NAME)
if(ARG_SRCS)
add_library(${_NAME} ${ARG_SRCS})
target_link_libraries(${_NAME} PUBLIC ${ARG_DEPS})
target_include_directories(${_NAME} PUBLIC ${CMAKE_SOURCE_DIR})
target_include_directories(${_NAME} PUBLIC ${PROJECT_SOURCE_DIR})
else()
add_library(${_NAME} INTERFACE)
target_link_libraries(${_NAME} INTERFACE ${ARG_DEPS})
target_include_directories(${_NAME} INTERFACE ${CMAKE_SOURCE_DIR})
target_include_directories(${_NAME} INTERFACE ${PROJECT_SOURCE_DIR})
endif()
if(ARG_PUBLIC)
add_library(${PROJECT_NAME}::${NAME} ALIAS ${_NAME})
Expand Down

0 comments on commit a2de572

Please sign in to comment.