[CMake] Pre-processor flags issue

Rolf Eike Beer eike at sf-mail.de
Fri Mar 11 18:42:48 EST 2011


Am Freitag 11 März 2011, 23:08:43 schrieb Enrique Izaguirre:
> Hello friends,
> 
> I am trying to cross-compile an application from Windows to Linux. My
> Toolchain file looks like this:
> 
> set(CMAKE_SYSTEM_NAME Linux)
> 
> #specify the cross-compiler
> set (CMAKE_C_COMPILER /bin/gcc-linux)
> set (CMAKE_CXX_COMPILER /bin/g++-linux)
> 
> 
> The problem is that I have in my main CMakeLists.txt file the instruction
> add_definitions ( ) with several flags I need to set for my application.
> 
> The problem is that the last flag I added ( a pre-processor flag) is
> working fine on C compiler but causing a problem on C++ compiler.
> 
> My question is if can I move the add_definition( ) to the Toolchain file to
> define a different set of flags for each compiler? Is it possible?

Set CMAKE_CXX_FLAGS instead of ADD_DEFINITIONS().

Eike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110312/683b5db7/attachment.pgp>


More information about the CMake mailing list