[CMake] CFLAGS and CPPFLAGS

Tyler Roscoe tyler at cryptio.net
Fri Apr 17 11:08:02 EDT 2009


On Fri, Apr 17, 2009 at 11:31:52AM +0200, christophe laferriere wrote:
> I'm currently using add_definition("-Wall -std=c99 -pedantic") to have  
> CFLAGS sets, but I'm now adding some tests that uses the project  
> library I'm working on, and those tests are in C++. So I'm getting an  
> error about the -std=c99 flag which does not work for C++.
> 
> So my question is what is the best way to have both CFLAGS and  
> CPPFLAGS (apparently not using add_definition()).

You could move your c++ unittests to a CMakeLists that is different from
the CMakeLists for your c library. Not sure if there's a better
solution, but I would think you're going to run into other issues having
c and c++ code living together. This is just a guess though; I don't
have experience with such a setup.

tyler


More information about the CMake mailing list