View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0011712CMakeCMakepublic2011-01-17 06:252011-01-31 15:58
ReporterAndreas Pakulat 
Assigned ToBrad King 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionnot fixable 
PlatformOSOS Version
Product VersionCMake-2-8 
Target VersionCMake 2.8.4Fixed in VersionCMake 2.8.4 
Summary0011712: add_definitions/COMPILE_DEFINITIONS do not support defines with semicolon
DescriptionTrying to add a define which has a semicolon in its text results in completely broken compiler commandlines with wrong escaping of arguments.

The attached project shows this, there doesn't seem to be a way to escape the semicolon so that cmake ignores it. CMake always interprets that as a separator
for the list of defines apparently, which then breaks the compile-commandline due to broken quoting.

I tried this with both gnu makefiles and gcc as well as nmake makefiles and cl, with the same results.
TagsNo tags attached.
Attached Filesgz file icon tst_sep.tar.gz [^] (378 bytes) 2011-01-17 06:25

 Relationships
related to 0011660closedBrad King Semicolons escaped badly 

  Notes
(0024737)
Brad King (manager)
2011-01-17 07:39

There is a disclaimer about this in the documentation:

  http://www.cmake.org/cmake/help/cmake-2-8-docs.html#prop_tgt:COMPILE_DEFINITIONS [^]
  "Dislaimer: Most native build tools have poor support for escaping certain
   values. CMake has work-arounds for many cases but some values may just not be
   possible to pass correctly."
(0024738)
Brad King (manager)
2011-01-17 07:41

There are also a bunch of comments about it for our reference here:

  http://cmake.org/gitweb?p=cmake.git;a=blob;f=Tests/Preprocess/CMakeLists.txt;hb=v2.8.3 [^]

Back when I implemented COMPILE_DEFINITIONS I tried to get every key on the US keyboard to pass through definitions correctly on all supported build systems. Semicolon is basically impossible to do everywhere.

I suggest using configure_file to put the definition directly in a header.
(0024739)
Brad King (manager)
2011-01-17 08:25

> there doesn't seem to be a way to escape the semicolon so that cmake ignores
it.

Either of these works:

  set_property(DIRECTORY PROPERTY COMPILE_DEFINITIONS "PATH_SEP=\"\;\"")

OR

  add_definitions( "-DPATH_SEP=\"\;\"")
(0024740)
Brad King (manager)
2011-01-17 08:30

Documentation updated to mention known limitations:

  http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c64d1385 [^]
(0024748)
Andreas Pakulat (reporter)
2011-01-17 09:56

Indeed that version does work, should've thought about that earlier :|
(0024750)
Brad King (manager)
2011-01-17 10:02

Closing as "not fixable" because the semicolon really can't be made to work everywhere. The documentation update is a good "fix" though.

 Issue History
Date Modified Username Field Change
2011-01-17 06:25 Andreas Pakulat New Issue
2011-01-17 06:25 Andreas Pakulat File Added: tst_sep.tar.gz
2011-01-17 07:38 Brad King Assigned To => Brad King
2011-01-17 07:38 Brad King Status new => assigned
2011-01-17 07:39 Brad King Note Added: 0024737
2011-01-17 07:41 Brad King Note Added: 0024738
2011-01-17 07:45 Brad King Relationship added related to 0011660
2011-01-17 08:25 Brad King Note Added: 0024739
2011-01-17 08:30 Brad King Note Added: 0024740
2011-01-17 09:56 Andreas Pakulat Note Added: 0024748
2011-01-17 10:02 Brad King Note Added: 0024750
2011-01-17 10:02 Brad King Status assigned => closed
2011-01-17 10:02 Brad King Resolution open => not fixable
2011-01-31 15:58 David Cole Fixed in Version => CMake 2.8.4
2011-01-31 15:58 David Cole Target Version => CMake 2.8.4


Copyright © 2000 - 2018 MantisBT Team