[CMake] Using -DOPTION="something=moof" mangles the OPTION value to "something:UNINITIALIZED=moof"

Michael Hertling mhertling at online.de
Mon Aug 29 10:37:45 EDT 2011


On 08/29/2011 02:37 PM, Marcus Fritzsch wrote:
> Turns out, using the "verbose" form of the option definition
> -DOPTION:TYPE=... does not exhibit the issue.
> 
> On 8/29/11, Marcus Fritzsch <fritschy at googlemail.com> wrote:
>> I discovered this behavior on my ubuntu 11.04 amd64 workstation with
>> cmake 2.8.3 when trying to set an -march= option for gcc:
>>
>>     cmake -DCMAKE_C_FLAGS="-Os -march=native -flto
>> -freorder-blocks-and-partition" ....
>>
>> was mangled to be
>>
>>     CMAKE_C_FLAGS=-Os -march:UNINITIALIZED=native -flto
>> -freorder-blocks-and-partition
>>
>> in the CMakeCache.txt.
>>
>> I haven't had much luck with the search engine of my choice finding
>> anything on the issue.

With the following simple CMakeLists.txt, I can't confirm this issue:

CMAKE_MINIMUM_REQUIRED(VERSION 2.8 FATAL_ERROR)
PROJECT(OPTIONS C)
SET(CMAKE_VERBOSE_MAKEFILE ON)
FILE(WRITE ${CMAKE_BINARY_DIR}/main.c "int main(void){return 0;}\n")
ADD_EXECUTABLE(main main.c)

> % cmake -DCMAKE_C_FLAGS="-Os -march=native -flto -freorder-blocks-and-partition" ...
> ...
> % grep CMAKE_C_FLAGS:STRING CMakeCache.txt
> CMAKE_C_FLAGS:STRING=-Os -march=native -flto -freorder-blocks-and-partition

Could you try with this exemplary project and report the results,
especially the exact command line? BTW, which shell do you use?

Regards,

Michael


More information about the CMake mailing list