Thanks for the response Andreas. For those poor souls who come after, the solution is to do the following:
set(CMAKE_C_FLAGS "-mmcu=msp430fr5739 -D__MSP430FR5739__ -ffunction-sections -fdata-sections -DGCC_MSP430 -Wall -g -std=c99" CACHE STRING "" FORCE) Using the FORCE attribute forces the specified cflags to take effect. Thomas Taranowski Certified netburner consultant baringforge.com On Tue, May 14, 2013 at 11:55 AM, Andreas Mohr <[email protected]> wrote: > Hi, > > On Tue, May 14, 2013 at 02:38:17PM -0400, [email protected] wrote: >> Date: Tue, 14 May 2013 10:02:56 -0700 >> From: Thomas Taranowski <[email protected]> > >> I am running into a situation when cross compiling where I cannot get >> cmake to emit the write CFLAGS for my cross-compilation toolchain >> correctly. >> >> If I force the C compiler, via the CMakeForceCompiler mechanism, the >> CMAKE_C_FLAGS do not get passed to gcc during the build. >> >> Example make VERBOSE=true snapshot. Note there are no CFLAGS, only >> include paths: >> /usr/local/msp430/bin/msp430-gcc >> -I/home/tom/src/t3gtb.1/t3_i2c_mm/public >> -I/home/tom/src/t3gtb.1/t3_i2c_mm/src/msp430 >> -I/home/tom/src/t3gtb.1/t3_i2c_mm/src -o >> CMakeFiles/t3_i2c_mm_support.dir/src/msp430/t3g_bsp.c.obj -c >> /home/tom/src/t3gtb.1/t3_i2c_mm/src/msp430/t3g_bsp.c >> >> >> Now, I can eliminate the need to force by passing in a -mmcu option >> (required for this processor to find the correct link map), which >> allows the TRY_COMPILE process to pass. So I set: >> >> set(CMAKE_C_COMPILER ${CROSS_COMPILE}gcc ${CMAKE_C_FLAGS}) >> >> This works to allow cmake to do it's thing and figure out what it >> needs to about the toolchain. However, it seems as though the cflags >> is now fixed, because the include_directories directive has absolutely >> no effect. It's as if cmake thinks that if I pass in some additional >> flags to the CMAKE_C_COMPILER, that it can no longer append anything >> to cflags. > > This is the usual CMAKE_<lang>_FOO per-LANGUAGE mechanism > (for pre-defined "languages" and custom-setup ones), e.g. CMAKE_C_COMPILER, > ..._LINKER etc. variables. > > > I believe you're missing the usual (and usually existing!) *extension* parts > within these expressions, which would be the <...> parts (<FLAGS> etc.). > > For details, see all the Platform setup modules within CMake's > pre-installed modules, i.e. INSTALL_PREFIX/share/cmake-VER/Modules/Platform/ , > since *this* is where the game gets played, i.e. where all the magic > happens, thus that is the authoritative place to start investigating about > custom platform setup questions. > > HTH, > > Andreas Mohr > -- > > 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 -- 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
