Skip to content

next-release. Use CMAKE_PROJECT_DIR or CMAKE_CURRENT_SOURCE_DIR instead of CMAKE_SOURCE_DIR to be able to use HIPRT as a submodule? #13

@TomClabault

Description

@TomClabault

Maybe this is already planned but just in case:

Suppose I have this project structure:

MyProject/
├── CMakeLists.txt
└── HIPRT/
    ├── CMakeLists.txt
    ├── contrib
    ├── hiprt
    ├── scripts
    ├── test
    ├── tools
    └── ...

If I want to use HIPRT in one of my project as a subdirectory, I would use add_subdirectory(HIPRT). However, the CMakeLists.txt of HIPRT currently uses ${CMAKE_SOURCE_DIR } to refer to the HIPRT/ directory:

include(${CMAKE_SOURCE_DIR}/contrib/Orochi/Orochi/enable_cuew.cmake)

In the case where HIPRT's CMakeLists.txt is called from add_subdirectory(HIPRT), ${CMAKE_SOURCE_DIR } refers to the MyProject/ directory instead of HIPRT/ as expected.

A solution would be to use either ${CMAKE_CURRENT_SOURCE_DIR } or ${CMAKE_PROJECT_DIR}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions