How can I disable compiler warnings regarding certain library?

Multi tool use
Multi tool use












1















I'm using CLion as my IDE. I downloaded MinGW from here (comes with boost), extracted, installed and connected it to CLion successfully. Then I set my compiler flags in CMakeLists and when I compiled my program, I encounted hundreds of warnings coming from boost libraries (in this case - boost/lexical_cast.hpp).



I really want to use most, if not all, of these compiler flags, but I also don't want boost (which is for sure better written than any of my own programs) to generate that much noise.



Is there any way of disabling all warnings from particular header / library (maybe even namespace)?










share|improve this question























  • There is no such thing in modern C++ as "from a library". Modern C++ code is template intensive.

    – curiousguy
    Dec 30 '18 at 20:58











  • I used that term to indicate the intention. While your comment is technically correct, I believe the wider context could bring some interesting answers. Forwarding couple of years, I could as well listed a module there

    – Fureeish
    Dec 30 '18 at 21:01






  • 1





    Correct support of real modules is badly wanted in C++. But without clean templates with true concepts, you can't have true modules with well defined boundaries. Templates are a mess, all of C++ is a mess.

    – curiousguy
    Dec 30 '18 at 21:02
















1















I'm using CLion as my IDE. I downloaded MinGW from here (comes with boost), extracted, installed and connected it to CLion successfully. Then I set my compiler flags in CMakeLists and when I compiled my program, I encounted hundreds of warnings coming from boost libraries (in this case - boost/lexical_cast.hpp).



I really want to use most, if not all, of these compiler flags, but I also don't want boost (which is for sure better written than any of my own programs) to generate that much noise.



Is there any way of disabling all warnings from particular header / library (maybe even namespace)?










share|improve this question























  • There is no such thing in modern C++ as "from a library". Modern C++ code is template intensive.

    – curiousguy
    Dec 30 '18 at 20:58











  • I used that term to indicate the intention. While your comment is technically correct, I believe the wider context could bring some interesting answers. Forwarding couple of years, I could as well listed a module there

    – Fureeish
    Dec 30 '18 at 21:01






  • 1





    Correct support of real modules is badly wanted in C++. But without clean templates with true concepts, you can't have true modules with well defined boundaries. Templates are a mess, all of C++ is a mess.

    – curiousguy
    Dec 30 '18 at 21:02














1












1








1








I'm using CLion as my IDE. I downloaded MinGW from here (comes with boost), extracted, installed and connected it to CLion successfully. Then I set my compiler flags in CMakeLists and when I compiled my program, I encounted hundreds of warnings coming from boost libraries (in this case - boost/lexical_cast.hpp).



I really want to use most, if not all, of these compiler flags, but I also don't want boost (which is for sure better written than any of my own programs) to generate that much noise.



Is there any way of disabling all warnings from particular header / library (maybe even namespace)?










share|improve this question














I'm using CLion as my IDE. I downloaded MinGW from here (comes with boost), extracted, installed and connected it to CLion successfully. Then I set my compiler flags in CMakeLists and when I compiled my program, I encounted hundreds of warnings coming from boost libraries (in this case - boost/lexical_cast.hpp).



I really want to use most, if not all, of these compiler flags, but I also don't want boost (which is for sure better written than any of my own programs) to generate that much noise.



Is there any way of disabling all warnings from particular header / library (maybe even namespace)?







c++ boost compiler-warnings clion






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Dec 30 '18 at 20:43









FureeishFureeish

3,28321029




3,28321029













  • There is no such thing in modern C++ as "from a library". Modern C++ code is template intensive.

    – curiousguy
    Dec 30 '18 at 20:58











  • I used that term to indicate the intention. While your comment is technically correct, I believe the wider context could bring some interesting answers. Forwarding couple of years, I could as well listed a module there

    – Fureeish
    Dec 30 '18 at 21:01






  • 1





    Correct support of real modules is badly wanted in C++. But without clean templates with true concepts, you can't have true modules with well defined boundaries. Templates are a mess, all of C++ is a mess.

    – curiousguy
    Dec 30 '18 at 21:02



















  • There is no such thing in modern C++ as "from a library". Modern C++ code is template intensive.

    – curiousguy
    Dec 30 '18 at 20:58











  • I used that term to indicate the intention. While your comment is technically correct, I believe the wider context could bring some interesting answers. Forwarding couple of years, I could as well listed a module there

    – Fureeish
    Dec 30 '18 at 21:01






  • 1





    Correct support of real modules is badly wanted in C++. But without clean templates with true concepts, you can't have true modules with well defined boundaries. Templates are a mess, all of C++ is a mess.

    – curiousguy
    Dec 30 '18 at 21:02

















There is no such thing in modern C++ as "from a library". Modern C++ code is template intensive.

– curiousguy
Dec 30 '18 at 20:58





There is no such thing in modern C++ as "from a library". Modern C++ code is template intensive.

– curiousguy
Dec 30 '18 at 20:58













I used that term to indicate the intention. While your comment is technically correct, I believe the wider context could bring some interesting answers. Forwarding couple of years, I could as well listed a module there

– Fureeish
Dec 30 '18 at 21:01





I used that term to indicate the intention. While your comment is technically correct, I believe the wider context could bring some interesting answers. Forwarding couple of years, I could as well listed a module there

– Fureeish
Dec 30 '18 at 21:01




1




1





Correct support of real modules is badly wanted in C++. But without clean templates with true concepts, you can't have true modules with well defined boundaries. Templates are a mess, all of C++ is a mess.

– curiousguy
Dec 30 '18 at 21:02





Correct support of real modules is badly wanted in C++. But without clean templates with true concepts, you can't have true modules with well defined boundaries. Templates are a mess, all of C++ is a mess.

– curiousguy
Dec 30 '18 at 21:02












1 Answer
1






active

oldest

votes


















3














You can add the include paths as SYSTEM instead of standard ones:



target_include_directories(target SYSTEM ${Boost_INCLUDE_DIR})


This only works for GCC and clang, as Visual Studio doesn't have a specific include flag for system paths.






share|improve this answer
























  • Unforunately, this gives me the following CMake error: (target_include_directories): Cannot specify include directories for target "SYSTEM" which is not built by this project.. To successfully include boost for now, I've been using: include_directories(${Boost_INCLUDE_DIR})

    – Fureeish
    Dec 30 '18 at 20:50






  • 1





    target is the name of the target you want to add Boost include path to. The error is self explanatory.

    – Matthieu Brucher
    Dec 30 '18 at 20:51











  • My bad, works beautifully. Thank you! Will accept the answer as soon as I am able to

    – Fureeish
    Dec 30 '18 at 20:54













  • No worries ;) happy to help.

    – Matthieu Brucher
    Dec 30 '18 at 21:02











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',
autoActivateHeartbeat: false,
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%2f53981271%2fhow-can-i-disable-compiler-warnings-regarding-certain-library%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









3














You can add the include paths as SYSTEM instead of standard ones:



target_include_directories(target SYSTEM ${Boost_INCLUDE_DIR})


This only works for GCC and clang, as Visual Studio doesn't have a specific include flag for system paths.






share|improve this answer
























  • Unforunately, this gives me the following CMake error: (target_include_directories): Cannot specify include directories for target "SYSTEM" which is not built by this project.. To successfully include boost for now, I've been using: include_directories(${Boost_INCLUDE_DIR})

    – Fureeish
    Dec 30 '18 at 20:50






  • 1





    target is the name of the target you want to add Boost include path to. The error is self explanatory.

    – Matthieu Brucher
    Dec 30 '18 at 20:51











  • My bad, works beautifully. Thank you! Will accept the answer as soon as I am able to

    – Fureeish
    Dec 30 '18 at 20:54













  • No worries ;) happy to help.

    – Matthieu Brucher
    Dec 30 '18 at 21:02
















3














You can add the include paths as SYSTEM instead of standard ones:



target_include_directories(target SYSTEM ${Boost_INCLUDE_DIR})


This only works for GCC and clang, as Visual Studio doesn't have a specific include flag for system paths.






share|improve this answer
























  • Unforunately, this gives me the following CMake error: (target_include_directories): Cannot specify include directories for target "SYSTEM" which is not built by this project.. To successfully include boost for now, I've been using: include_directories(${Boost_INCLUDE_DIR})

    – Fureeish
    Dec 30 '18 at 20:50






  • 1





    target is the name of the target you want to add Boost include path to. The error is self explanatory.

    – Matthieu Brucher
    Dec 30 '18 at 20:51











  • My bad, works beautifully. Thank you! Will accept the answer as soon as I am able to

    – Fureeish
    Dec 30 '18 at 20:54













  • No worries ;) happy to help.

    – Matthieu Brucher
    Dec 30 '18 at 21:02














3












3








3







You can add the include paths as SYSTEM instead of standard ones:



target_include_directories(target SYSTEM ${Boost_INCLUDE_DIR})


This only works for GCC and clang, as Visual Studio doesn't have a specific include flag for system paths.






share|improve this answer













You can add the include paths as SYSTEM instead of standard ones:



target_include_directories(target SYSTEM ${Boost_INCLUDE_DIR})


This only works for GCC and clang, as Visual Studio doesn't have a specific include flag for system paths.







share|improve this answer












share|improve this answer



share|improve this answer










answered Dec 30 '18 at 20:46









Matthieu BrucherMatthieu Brucher

15.3k32140




15.3k32140













  • Unforunately, this gives me the following CMake error: (target_include_directories): Cannot specify include directories for target "SYSTEM" which is not built by this project.. To successfully include boost for now, I've been using: include_directories(${Boost_INCLUDE_DIR})

    – Fureeish
    Dec 30 '18 at 20:50






  • 1





    target is the name of the target you want to add Boost include path to. The error is self explanatory.

    – Matthieu Brucher
    Dec 30 '18 at 20:51











  • My bad, works beautifully. Thank you! Will accept the answer as soon as I am able to

    – Fureeish
    Dec 30 '18 at 20:54













  • No worries ;) happy to help.

    – Matthieu Brucher
    Dec 30 '18 at 21:02



















  • Unforunately, this gives me the following CMake error: (target_include_directories): Cannot specify include directories for target "SYSTEM" which is not built by this project.. To successfully include boost for now, I've been using: include_directories(${Boost_INCLUDE_DIR})

    – Fureeish
    Dec 30 '18 at 20:50






  • 1





    target is the name of the target you want to add Boost include path to. The error is self explanatory.

    – Matthieu Brucher
    Dec 30 '18 at 20:51











  • My bad, works beautifully. Thank you! Will accept the answer as soon as I am able to

    – Fureeish
    Dec 30 '18 at 20:54













  • No worries ;) happy to help.

    – Matthieu Brucher
    Dec 30 '18 at 21:02

















Unforunately, this gives me the following CMake error: (target_include_directories): Cannot specify include directories for target "SYSTEM" which is not built by this project.. To successfully include boost for now, I've been using: include_directories(${Boost_INCLUDE_DIR})

– Fureeish
Dec 30 '18 at 20:50





Unforunately, this gives me the following CMake error: (target_include_directories): Cannot specify include directories for target "SYSTEM" which is not built by this project.. To successfully include boost for now, I've been using: include_directories(${Boost_INCLUDE_DIR})

– Fureeish
Dec 30 '18 at 20:50




1




1





target is the name of the target you want to add Boost include path to. The error is self explanatory.

– Matthieu Brucher
Dec 30 '18 at 20:51





target is the name of the target you want to add Boost include path to. The error is self explanatory.

– Matthieu Brucher
Dec 30 '18 at 20:51













My bad, works beautifully. Thank you! Will accept the answer as soon as I am able to

– Fureeish
Dec 30 '18 at 20:54







My bad, works beautifully. Thank you! Will accept the answer as soon as I am able to

– Fureeish
Dec 30 '18 at 20:54















No worries ;) happy to help.

– Matthieu Brucher
Dec 30 '18 at 21:02





No worries ;) happy to help.

– Matthieu Brucher
Dec 30 '18 at 21:02


















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.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53981271%2fhow-can-i-disable-compiler-warnings-regarding-certain-library%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







zTCQsOUnaYkdvRAPFgyfmq7IH62mTo3d3vrU5YPT2v7C14Mtovos3BlJdb Rs3EWjUbUA NZ,kg3YZ
vTGLG1RjE,vjy,n,KyTOo9wOAspV3YVgPEOsD,qS3N6,0gRp

Popular posts from this blog

Monofisismo

Angular Downloading a file using contenturl with Basic Authentication

Olmecas