MantisBT - CMake
View Issue Details
0004017CMakeCMakepublic2006-11-02 21:512016-06-10 14:30
Craig Ringer 
Brad King 
lowmajoralways
closedmoved 
 
 
0004017: CMake doesn't handle flags with = in them passed as command line -DCMAKE_CXX_FLAGS
CMake does not handle compiler flags with an equals sign in them when they're passed on the command line with -DCMAKE_CXX_FLAGS . The entire argument gets silently ignored.

For example:

cmake -G "Unix Makefiles" ../podofo \
  -DCMAKE_CXX_FLAGS=" -O2 -DBLAHBLAH "

(just as an example) works fine, and `make VERBOSE=1' shows them being passed, but:

cmake -G "Unix Makefiles" ../podofo \
  -DCMAKE_CXX_FLAGS=" -O2 -DBLAHBLAH -march=athlon-xp -mfpmath=sse,387 -fvisibility=hidden"

... causes the entire set of flags, including those deemed valid before, to be ignored. This happens in at least CMake 2.4-patch3 and 2.5-20061102 . Any set of flags with an = in it seems to cause problems, even:

-DCMAKE_CXX_FLAGS=" -DFLAGTEST=1 "

Setting them with:

SET(CMAKE_CXX_FLAGS " ... ")

in the CMakeLists file causes them to be output on the command line, however it appears to prevent CMake from adding any target-specific COMPILE_FLAGS, the include path, etc, causing the build to fail.

It would be helpful if the documentation described things like the right way to send additional flags to the build process.

In any case, this issue is more likely an argument parsing bug, probably confusion between the = separating the cmake var from the argument and = signs in the argument its self.
No tags attached.
Issue History
2012-08-13 10:44Brad KingStatusassigned => backlog
2012-08-13 10:44Brad KingNote Added: 0030565
2016-06-10 14:27Kitware RobotNote Added: 0041329
2016-06-10 14:27Kitware RobotStatusbacklog => resolved
2016-06-10 14:27Kitware RobotResolutionopen => moved
2016-06-10 14:30Kitware RobotStatusresolved => closed

Notes
(0030565)
Brad King   
2012-08-13 10:44   
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.
(0041329)
Kitware Robot   
2016-06-10 14:27   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.