Allow building repository as CMake subdirectory (#2059)
* Use PROJECT_SOURCE_DIR rather than CMAKE_SOURCE_DIR to allow building as subdirectory * Also use PROJECT_SOURCE_DIR instead of CMAKE_SOURCE_DIR in c/cxx api examples * Only build examples by default when not building as subdirectory * Do not suggest building binaries either --------- Co-authored-by: user <user@mail.tld>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
include_directories(${CMAKE_SOURCE_DIR})
|
||||
include_directories(${PROJECT_SOURCE_DIR})
|
||||
|
||||
if(SHERPA_ONNX_ENABLE_PYTHON)
|
||||
message(STATUS "PYTHON_EXECUTABLE: ${PYTHON_EXECUTABLE}")
|
||||
@@ -648,7 +648,7 @@ endforeach()
|
||||
# For clang-tidy
|
||||
add_custom_target(
|
||||
clang-tidy-check
|
||||
clang-tidy -p ${CMAKE_BINARY_DIR}/compile_commands.json --config-file ${CMAKE_SOURCE_DIR}/.clang-tidy ${srcs_to_check}
|
||||
clang-tidy -p ${CMAKE_BINARY_DIR}/compile_commands.json --config-file ${PROJECT_SOURCE_DIR}/.clang-tidy ${srcs_to_check}
|
||||
DEPENDS ${sources})
|
||||
|
||||
add_custom_target(check DEPENDS clang-tidy-check)
|
||||
|
||||
Reference in New Issue
Block a user