How to debug issue with CMake custom command dependencies











up vote
0
down vote

favorite












I'm trying to debug an issue with dependencies in custom commands in CMake. My dependence structure basically looks like (using GraphViz notation):



A -> B
{A; B} -> C -> D -> E


Where C and E are add_custom_target, and A, B and D are add_custom_command. CMake correctly infers a target-level dependency between C and E, but on the first build of the project, B does not get built as part of target C. As a result E fails (because it needs B to exist). But on the second build, B gets generated as part of C and everything works fine.



At the moment, I don't even know how to debug this, especially in Visual Studio where the project files are fairly opaque. I can see what gets built in any given build, but for the things that aren't getting built, I can't see why they aren't being built. The available debugging methods in CMake (like --trace) seem to be useful only for configure-time issues, which this isn't.



Are there any tools for debugging these sorts of things, or do I just have to stare at my CMake file until I figure this out?



For posterity, there are more specific details about my problem below, but I will be happy to debug it myself if I can find any reasonable way to do so: https://github.com/zdevito/terra/pull/322#issuecomment-441084534










share|improve this question






















  • Building is not controlled by CMake, so you unlikely will get help from it. You are better consult Visual Studio, as it actually performs the building. As for the specific case, it seems that D and E are unrelated for your problem: Have you tried to build just C and check whether B is built? If B is not built in this case, you need to recheck only B->C dependency in your CMake code.
    – Tsyvarev
    Nov 22 at 17:47















up vote
0
down vote

favorite












I'm trying to debug an issue with dependencies in custom commands in CMake. My dependence structure basically looks like (using GraphViz notation):



A -> B
{A; B} -> C -> D -> E


Where C and E are add_custom_target, and A, B and D are add_custom_command. CMake correctly infers a target-level dependency between C and E, but on the first build of the project, B does not get built as part of target C. As a result E fails (because it needs B to exist). But on the second build, B gets generated as part of C and everything works fine.



At the moment, I don't even know how to debug this, especially in Visual Studio where the project files are fairly opaque. I can see what gets built in any given build, but for the things that aren't getting built, I can't see why they aren't being built. The available debugging methods in CMake (like --trace) seem to be useful only for configure-time issues, which this isn't.



Are there any tools for debugging these sorts of things, or do I just have to stare at my CMake file until I figure this out?



For posterity, there are more specific details about my problem below, but I will be happy to debug it myself if I can find any reasonable way to do so: https://github.com/zdevito/terra/pull/322#issuecomment-441084534










share|improve this question






















  • Building is not controlled by CMake, so you unlikely will get help from it. You are better consult Visual Studio, as it actually performs the building. As for the specific case, it seems that D and E are unrelated for your problem: Have you tried to build just C and check whether B is built? If B is not built in this case, you need to recheck only B->C dependency in your CMake code.
    – Tsyvarev
    Nov 22 at 17:47













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I'm trying to debug an issue with dependencies in custom commands in CMake. My dependence structure basically looks like (using GraphViz notation):



A -> B
{A; B} -> C -> D -> E


Where C and E are add_custom_target, and A, B and D are add_custom_command. CMake correctly infers a target-level dependency between C and E, but on the first build of the project, B does not get built as part of target C. As a result E fails (because it needs B to exist). But on the second build, B gets generated as part of C and everything works fine.



At the moment, I don't even know how to debug this, especially in Visual Studio where the project files are fairly opaque. I can see what gets built in any given build, but for the things that aren't getting built, I can't see why they aren't being built. The available debugging methods in CMake (like --trace) seem to be useful only for configure-time issues, which this isn't.



Are there any tools for debugging these sorts of things, or do I just have to stare at my CMake file until I figure this out?



For posterity, there are more specific details about my problem below, but I will be happy to debug it myself if I can find any reasonable way to do so: https://github.com/zdevito/terra/pull/322#issuecomment-441084534










share|improve this question













I'm trying to debug an issue with dependencies in custom commands in CMake. My dependence structure basically looks like (using GraphViz notation):



A -> B
{A; B} -> C -> D -> E


Where C and E are add_custom_target, and A, B and D are add_custom_command. CMake correctly infers a target-level dependency between C and E, but on the first build of the project, B does not get built as part of target C. As a result E fails (because it needs B to exist). But on the second build, B gets generated as part of C and everything works fine.



At the moment, I don't even know how to debug this, especially in Visual Studio where the project files are fairly opaque. I can see what gets built in any given build, but for the things that aren't getting built, I can't see why they aren't being built. The available debugging methods in CMake (like --trace) seem to be useful only for configure-time issues, which this isn't.



Are there any tools for debugging these sorts of things, or do I just have to stare at my CMake file until I figure this out?



For posterity, there are more specific details about my problem below, but I will be happy to debug it myself if I can find any reasonable way to do so: https://github.com/zdevito/terra/pull/322#issuecomment-441084534







cmake






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 22 at 17:16









Elliott Slaughter

407816




407816












  • Building is not controlled by CMake, so you unlikely will get help from it. You are better consult Visual Studio, as it actually performs the building. As for the specific case, it seems that D and E are unrelated for your problem: Have you tried to build just C and check whether B is built? If B is not built in this case, you need to recheck only B->C dependency in your CMake code.
    – Tsyvarev
    Nov 22 at 17:47


















  • Building is not controlled by CMake, so you unlikely will get help from it. You are better consult Visual Studio, as it actually performs the building. As for the specific case, it seems that D and E are unrelated for your problem: Have you tried to build just C and check whether B is built? If B is not built in this case, you need to recheck only B->C dependency in your CMake code.
    – Tsyvarev
    Nov 22 at 17:47
















Building is not controlled by CMake, so you unlikely will get help from it. You are better consult Visual Studio, as it actually performs the building. As for the specific case, it seems that D and E are unrelated for your problem: Have you tried to build just C and check whether B is built? If B is not built in this case, you need to recheck only B->C dependency in your CMake code.
– Tsyvarev
Nov 22 at 17:47




Building is not controlled by CMake, so you unlikely will get help from it. You are better consult Visual Studio, as it actually performs the building. As for the specific case, it seems that D and E are unrelated for your problem: Have you tried to build just C and check whether B is built? If B is not built in this case, you need to recheck only B->C dependency in your CMake code.
– Tsyvarev
Nov 22 at 17:47

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53435714%2fhow-to-debug-issue-with-cmake-custom-command-dependencies%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53435714%2fhow-to-debug-issue-with-cmake-custom-command-dependencies%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Trompette piccolo

Slow SSRS Report in dynamic grouping and multiple parameters

Simon Yates (cyclisme)