How can I disable compiler warnings regarding certain library?

Multi tool use
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
add a comment |
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
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
add a comment |
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
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
c++ boost compiler-warnings clion
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
add a comment |
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
add a comment |
1 Answer
1
active
oldest
votes
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.
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 includeboost
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
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
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 includeboost
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
add a comment |
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.
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 includeboost
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
add a comment |
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.
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.
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 includeboost
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
add a comment |
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 includeboost
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
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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