The current cmake configuration (used for the gradle build) happens to work because vendors subdirectories have a similar layout to each other and relative to the common subdirectory, and the gradle build is always executed from the same location.
However, attempt to execute the gradle build from another location and you'll notice that things fall apart as the specified cmake variables are now pointing to invalid locations.
This PR fixes this issue through the following changes:
In the vendors' cmake configuration (CMakeLists.txt):
Swap the use of CMAKE_SOURCE_DIR with PROJECT_SOURCE_DIR to make the paths relative to the current cmake project directory instead of the root cmake definition directory
Swap the use of CMAKE_PROJECT_NAME with PROJECT_NAME to refer to the current project name instead of the project name from the root cmake definition
Refactor common/CMakeLists.txt to common/common.cmake to better reflect its role: does not contain any cmake project and is instead included in vendors' CMakeLists.txt definition to bring in common paths and dependencies.
Swap the use of CMAKE_CURRENT_SOURCE_DIR with CMAKE_CURRENT_LIST_DIR to make the common paths relative to common/common.cmake
The current cmake configuration (used for the
gradle
build) happens to work because vendors subdirectories have a similar layout to each other and relative to thecommon
subdirectory, and thegradle
build is always executed from the same location. However, attempt to execute thegradle
build from another location and you'll notice that things fall apart as the specified cmake variables are now pointing to invalid locations.This PR fixes this issue through the following changes:
CMakeLists.txt
):CMAKE_SOURCE_DIR
withPROJECT_SOURCE_DIR
to make the paths relative to the current cmake project directory instead of the root cmake definition directoryCMAKE_PROJECT_NAME
withPROJECT_NAME
to refer to the current project name instead of the project name from the root cmake definitioncommon/CMakeLists.txt
tocommon/common.cmake
to better reflect its role: does not contain any cmake project and is instead included in vendors'CMakeLists.txt
definition to bring in common paths and dependencies.CMAKE_CURRENT_SOURCE_DIR
withCMAKE_CURRENT_LIST_DIR
to make the common paths relative tocommon/common.cmake