View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0009670CMakeCMakepublic2009-10-06 23:112014-06-02 08:37
ReporterPhilip Lowman 
Assigned ToBrad King 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product VersionCMake-2-8 
Target VersionFixed in VersionCMake 2.8.12 
Summary0009670: [PATCH] CMake fails to escape quotes in CMAKE_C_FLAGS during try_compile()
DescriptionIn generating CMakeLists.txt for a try_compile() CMake does not properly
escape quotes present in CMAKE_C_FLAGS. This can lead to CMAKE_C_FLAGS being
outputted as a list, rather than a string, which likely will lead to a
compilation error.

Example:

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /FI\"C:/Temp/TryCompile Escape Bug/force_foo.h\"")
include(TestBigEndian)
TEST_BIG_ENDIAN(AM_BIG_ENDIAN)

Output of CMakeLists.txt:
<snip>
SET(CMAKE_C_FLAGS " /DWIN32 /D_WINDOWS /W3 /Zm1000 /FI"C:/Temp/TryCompile Escape Bug/blah/hi.h" ${COMPILE_DEFINITIONS}")
</snip>

Patch is attached

This problem can be worked around by deferring the manipulation of
CMAKE_{C,CXX}_FLAGS until after all compilation tests have completed.
TagsNo tags attached.
Attached Filespatch file icon escape_cmake_c_flags.patch [^] (784 bytes) 2009-10-06 23:11 [Show Content]

 Relationships

  Notes
(0018172)
Brad King (manager)
2009-10-22 08:46

Unfortunately this problem can also be worked around by temporarily adding the escapes to CMAKE_C_FLAGS, and I bet there are projects that do this. If we start escaping automatically those projects will break. Escaping changes need a policy. See CMP0005 for example.
(0030532)
Brad King (manager)
2012-08-13 10:37

Sending issues I'm not actively working on to the backlog to await someone with time for them.

If an issue you care about is sent to the backlog when you feel it should have been addressed in a different manner, please bring it up on the CMake mailing list for discussion. Sign up for the mailing list here, if you're not already on it:

 http://www.cmake.org/mailman/listinfo/cmake [^]

It's easy to re-activate a bug here if you can find a CMake developer or contributor who has the bandwidth to take it on.
(0034333)
Stephen Kelly (developer)
2013-11-02 11:24

There are now COMPILE_OPTIONS properties and the target_compile_options and add_compile_options commands to satisfy this.
(0035994)
Robert Maynard (manager)
2014-06-02 08:37

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2009-10-06 23:11 Philip Lowman New Issue
2009-10-06 23:11 Philip Lowman File Added: escape_cmake_c_flags.patch
2009-10-21 21:39 Bill Hoffman Status new => assigned
2009-10-21 21:39 Bill Hoffman Assigned To => Brad King
2009-10-22 08:46 Brad King Note Added: 0018172
2012-08-13 10:37 Brad King Status assigned => backlog
2012-08-13 10:37 Brad King Note Added: 0030532
2013-11-02 11:24 Stephen Kelly Note Added: 0034333
2013-11-02 11:24 Stephen Kelly Status backlog => resolved
2013-11-02 11:24 Stephen Kelly Fixed in Version => CMake 2.8.12
2013-11-02 11:24 Stephen Kelly Resolution open => fixed
2014-06-02 08:37 Robert Maynard Note Added: 0035994
2014-06-02 08:37 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team