Make kirigami.qrc ressource path relative to CMAKE_CURRENT_SOURCE_DIR
ClosedPublic

Authored by franckarrecot on Dec 12 2016, 11:27 AM.

Details

Summary

The point is that a project embedding kirigami as submodule would have
CMAKE_SOURCE_DIR wrong in this case so better use CMAKE_CURRENT_SOURCE_DIR
that will always be correct.

Test Plan

kairo project using kirigami as submodule

Diff Detail

Repository
R169 Kirigami
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
franckarrecot retitled this revision from to Make kirigami.qrc ressource path relative to CMAKE_CURRENT_SOURCE_DIR.
franckarrecot updated this object.
franckarrecot edited the test plan for this revision. (Show Details)
franckarrecot added a reviewer: mart.
Restricted Application added a project: Kirigami. · View Herald TranscriptDec 12 2016, 11:27 AM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
apol added a subscriber: apol.Dec 12 2016, 4:39 PM
apol added inline comments.
src/CMakeLists.txt
17

Sounds like ${kirigami_SOURCE_DIR}/kirigami.qrc would be best. I don't really understand the .. you added though.

franckarrecot added inline comments.Dec 12 2016, 9:10 PM
src/CMakeLists.txt
17

Well my main problem is when embedding kirigami as submodule in my cmake project, CMAKE_SOURCE_DIR is pointing to my top level source dir, not kirigami' one, so would be better to use a variable that can work on a standalone build of kirigamo or an "embedded" one.

So I thought that CMAKE_CURRENT_SOURCE_DIR was ok for this, and since it's refering to a file qrc which is one level upper than the current source dir I used CMAKE_CURRENT_SOURCE_DIR/.. to refer to it.

Is there a better way to refer to this file with a cmake variable which would not be impacted by the project kirigami is embedded into ?

" CMAKE_SOURCE_DIR is pointing to my top level source dir, not kirigami' one, "

> so : qt5_add_resources(RESOURCES ${CMAKE_SOURCE_DIR}/kirigami.qrc) would refer to an incorrect path and then make cmake fails at config time, for any projecting embedding kirigami.

franckarrecot added inline comments.Dec 12 2016, 9:17 PM
src/CMakeLists.txt
17

In my case kirigami_SOURCE_DIR points to /MyProject/3rdparty/kirigami/src and not kirigami top level directory, so I would have to put kirigami_SOURCE_DIR/.. as well.

apol accepted this revision.Dec 12 2016, 11:44 PM
apol added a reviewer: apol.

Right, of course. that makes sense. With CMAKE_CURRENT_SOURCE_DIR should be fine.

This revision is now accepted and ready to land.Dec 12 2016, 11:44 PM

thanks, I can't push though, do I need special access or special urls to do so ?

my current urls are :

origin git://anongit.kde.org/kirigami.git (fetch)
origin git://anongit.kde.org/kirigami.git (push)

This revision was automatically updated to reflect the committed changes.