[CMake] Compile flags for a single file

2011-04-18 Thread The Novice Coder
I've been trying most things I can think of, but have been unable to 
come up with a solution.. the basic gist is I need to change the compile 
flags for a SINGLE file within a project. Specifically, disabling all 
compile warnings for that file.


add_definitions() seems to effect the whole project, so that's not 
helping..


Also couldn't use set_property() to do it either. (I could have been 
using it wrong).


Thanks!


Extra nonsense:
If you're wondering why, it mostly has to do with politics.  An outside 
vendor wrote that file and we are not allowed to modify it... and they 
refuse to fix the warnings.  We're also required to treat warnings as 
errors, so this comes as a stand-still and breaks automated build 
machines, as after the projects are generated, they have to manually be 
updated (right now.).


___
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] Compile flags for a single file

2011-04-18 Thread Alexander Neundorf
On Monday 18 April 2011, The Novice Coder wrote:
  I've been trying most things I can think of, but have been unable to
  come up with a solution.. the basic gist is I need to change the compile
  flags for a SINGLE file within a project. Specifically, disabling all
  compile warnings for that file.

  add_definitions() seems to effect the whole project, so that's not
  helping..

  Also couldn't use set_property() to do it either. (I could have been
  using it wrong).

set_source_files_properties() should be able to set COMPILE_FLAGS for single 
files.
* you might also write a file which only does some #define/#undef's and then 
includes the file in question ?
* you might build a static library consisting only of that one file, if 
necessary in an own subdirectory (which has only the CMakeLists.txt  with 
add_library(foo STATIC ../the_file.c), basically)

Alex
___
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] Compile flags for a single file

2011-04-18 Thread The Novice Coder

On Mon, 18 Apr 2011 21:52:31 +0200, Alexander Neundorf wrote:

On Monday 18 April 2011, The Novice Coder wrote:
 I've been trying most things I can think of, but have been unable 
to
 come up with a solution.. the basic gist is I need to change the 
compile
 flags for a SINGLE file within a project. Specifically, disabling 
all

 compile warnings for that file.

 add_definitions() seems to effect the whole project, so that's not
 helping..

 Also couldn't use set_property() to do it either. (I could have 
been

 using it wrong).


set_source_files_properties() should be able to set COMPILE_FLAGS for 
single

files.
* you might also write a file which only does some #define/#undef's 
and then

includes the file in question ?
* you might build a static library consisting only of that one file, 
if
necessary in an own subdirectory (which has only the CMakeLists.txt  
with

add_library(foo STATIC ../the_file.c), basically)

Alex


Thank you very much!  That got me on the right path.  If anyone else 
has the same issue, the final code was:


if(MSVC)
set_source_files_properties( ${contrib_db_cpp} PROPERTIES 
COMPILE_FLAGS  /W0  )

endif(MSVC)

___
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake