[CMake] set(... CACHE ) broken for CMAKE_C_FLAGS_{DEBUG, RELEASE, ...} ?
Yuri Timenkov
yuri at timenkov.ru
Thu Jul 7 11:24:29 EDT 2011
May be you're looking for overriding default flags?
http://www.cmake.org/Wiki/CMake_FAQ#Make_Override_Files
Although it mentions VS static runtime, this approach is very useful to set
own initial flags in CMake.
On Wed, Jul 6, 2011 at 5:41 PM, Jerry Gagelman <gagelman at gmail.com> wrote:
> I'm redistributing a library for which the original authors have hand coded
> their own Makefile, but I would like to streamline everything with CMake.
> Their Makefile provides for Debug and Release flavored configurations, each
> has its own set of CFLAGS, and for consistency I would like to incorporate
> the same set of flags.
>
> Using the following commands, the configuration can be selected in the
> cache:
>
> if( DEFINED CMAKE_BUILD_TYPE )
>
> set( CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "Options are: Debug
> Release")
>
> else( DEFINED CMAKE_BUILD_TYPE )
>
> set(CMAKE_BUILD_TYPE Debug CACHE STRING "Options are: Debug Release")
>
> endif( DEFINED CMAKE_BUILD_TYPE )
>
>
> That works. Next, I tried to update the C_FLAGS :
>
>
> set( CMAKE_C_FLAGS_DEBUG "-Wall -Wno-format -g -DDEBUG" CACHE STRING
> "Recommended debug flags." )
>
> set( CMAKE_C_FLAGS_RELEASE "-Wall -Wno-unknown-pragmas -Wno-format -O3"
> CACHE STRING "Recommended release flags." )
>
> However running "make edit_cache" always reflects the default
> CMAKE_C_FLAGS_{type}, not the new ones that I supplied. I have tried several
> variations on this theme, but can't make it work. Before posting a bug
> report, I thought I'd post this here in case there is anything obvious that
> I'm missing.
>
> Incidentally, I'm running CMake version 2.8.4, built by MacPorts.
>
> Thanks,
> Jerry
>
> _______________________________________________
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110707/a4257a5e/attachment.htm>
More information about the CMake
mailing list