Jump to content
  • Advertisement
Sign in to follow this  

Suppress warnings with CMake

This topic is 2819 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi,

I am trying to compile my program using CMake and want to supress the warnings coming from external libraries, which were not written by me.
I heard rumors that there are two ways to do this, either by

1. using a compiler-flag like
SET(CMAKE_CXX_FLAGS "-isystem${MYPROJECT_MAIN_DIR}/include")


or

2. by telling CMake that the include-folders belong to a system library by adding SYSTEM to the include-directories like this

INCLUDE_DIRECTORIES(SYSTEM /usr/include/externallibrary)


unfortunately, both versions do not seem to work.
Can anyone suggest a solution to me?

Martin

Share this post


Link to post
Share on other sites
Advertisement
There are about 708 warnings just for a very small program using the thrust library.

Here's the code:

 
// includes //
#include <iostream>

#include <cuda_runtime.h>

#include <thrust/version.h>
#include <thrust/host_vector.h>
#include <thrust/device_vector.h>
#include <thrust/copy.h>
#include <thrust/fill.h>
#include <thrust/sequence.h>
#include <thrust/transform.h>
#include <thrust/replace.h>
#include <thrust/functional.h>

int main(int argc, char **argv)
{
// H has storage for 4 integers
thrust::host_vector<int> H(4);

// initialize individual elements
H[0] = 14;
H[1] = 20;
H[2] = 38;
H[3] = 46;

// H.size() returns the size of vector H
std::cout << "H has size " << H.size() << std::endl;

// print contents of H
for(int i = 0; i < H.size(); i++)
std::cout << "H[" << i << "] = " << H << ", ";
std::cout << std::endl;

// resize H
H.resize(2);

std::cout << "H now has size " << H.size() << std::endl;

// Copy host_vector H to device_vector D
thrust::device_vector<int> D = H;

// elements of D can be modified
D[0] = 99;
D[1] = 88;

// print contents of D
for(int i = 0; i < D.size(); i++)
std::cout << "D[" << i << "] = " << D << ", ";
std::cout << std::endl;
}






and here are some of the warnings. They only appear because I set a very high warning level. But I want this high level warnings to check my own code.

/afs/cg.cs.tu-bs.de/home/lib64/thrust/detail/vector_base.inl:1002: instantiated from ‘void thrust::detail::vector_base<T, Alloc>::allocate_and_copy(size_t, ForwardIterator, ForwardIterator, size_t&, thrust::detail::normal_iterator<typename Alloc::pointer>&) [with ForwardIterator = thrust::detail::normal_iterator<thrust::device_ptr<const int> >, T = int, Alloc = thrust::device_malloc_allocator<int>]’
/afs/cg.cs.tu-bs.de/home/lib64/thrust/detail/vector_base.inl:204: instantiated from ‘void thrust::detail::vector_base<T, Alloc>::range_init(ForwardIterator, ForwardIterator, thrust::detail::false_type) [with ForwardIterator = thrust::detail::normal_iterator<thrust::device_ptr<const int> >, T = int, Alloc = thrust::device_malloc_allocator<int>]’
/afs/cg.cs.tu-bs.de/home/lib64/thrust/detail/vector_base.inl:79: instantiated from ‘thrust::detail::vector_base<T, Alloc>::vector_base(const thrust::detail::vector_base<T, Alloc>&) [with T = int, Alloc = thrust::device_malloc_allocator<int>]’
/afs/cg.cs.tu-bs.de/home/eisemann/lib64/thrust/device_vector.h:92: instantiated from ‘thrust::device_vector<T, Alloc>::device_vector(const thrust::device_vector<T, Alloc>&) [with T = int, Alloc = thrust::device_malloc_allocator<int>]’
/afs/cg.cs.tu-bs.de/home/Desktop/Testprograms/CUDA/Thrust/src/app/main.cpp:60: instantiated from here



[Edited by - ApochPiQ on August 31, 2010 4:10:36 PM]

Share this post


Link to post
Share on other sites
This isn't really related to CMake, but rather the particular compiler you are using. You will need to look up documentation specific to that compiler on how to suppress warnings, and apply that information to your exact situation.


Also, please prefer [source] tags over [code] tags when posting longer snippets, and FYI the closing character is / not \ [wink]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!