MantisBT - CMake
View Issue Details
0011689CMakeCMakepublic2011-01-12 09:212012-06-06 08:54
Michal Cihar 
Brad King 
normalminoralways
closedfixed 
CMake 2.8.3 
CMake 2.8.5CMake 2.8.5 
0011689: check_type_size fails if source dir contains =
If the project directory name contains =, all check_type_size calls fail. There seems to be problem in calling make...
Create following CMakeLists.txt and try it in directory containing =

cmake_minimum_required (VERSION 2.4.2)
project(Test C)
include (CheckTypeSize)
check_type_size(intptr_t HAVE_INTPTR_T)
No tags attached.
related to 0012934closed Brad King Limitation on '=' in directory names is causing a problem 
log CMakeError.log (1,454) 2011-01-12 09:21
https://public.kitware.com/Bug/file/3618/CMakeError.log
Issue History
2011-01-12 09:21Michal CiharNew Issue
2011-01-12 09:21Michal CiharFile Added: CMakeError.log
2011-01-12 10:44Brad KingAssigned To => Ben Boeckel
2011-01-12 10:44Brad KingStatusnew => assigned
2011-01-12 10:44Brad KingNote Added: 0024619
2011-01-12 11:04Michal CiharNote Added: 0024620
2011-01-12 11:10Michal CiharNote Added: 0024621
2011-01-12 12:18Brad KingNote Added: 0024625
2011-01-12 12:19Brad KingNote Added: 0024626
2011-01-12 12:24Michal CiharNote Added: 0024627
2011-01-12 13:13Brad KingNote Added: 0024629
2011-01-12 18:11Michal CiharNote Added: 0024638
2011-01-14 10:13Brad KingAssigned ToBen Boeckel => Brad King
2011-01-14 10:14Brad KingNote Added: 0024677
2011-01-14 10:14Brad KingStatusassigned => closed
2011-01-14 10:14Brad KingResolutionopen => fixed
2011-06-17 18:21David ColeFixed in Version => CMake 2.8.5
2011-06-17 18:21David ColeTarget Version => CMake 2.8.5
2012-02-06 08:47Brad KingRelationship addedhas duplicate 0012934
2012-02-06 08:47Brad KingRelationship replacedrelated to 0012934
2012-06-06 08:54Brad KingNote Added: 0029619

Notes
(0024619)
Brad King   
2011-01-12 10:44   
I think this commit may have fixed it already, but have not tested:

  http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6fe8624b [^]

The upcoming 2.8.4 release contains the change.
(0024620)
Michal Cihar   
2011-01-12 11:04   
No it does not fix it. I've rebuilt 2.8.3 with this patch and it still fails in same way.
(0024621)
Michal Cihar   
2011-01-12 11:10   
The problem is in make generator - the dependencies can not contain literal =, but it needs to be escaped.

CMake generates:

CMakeFiles/cmTryCompileExec.dir/HAVE_INTPTR_T.c.o: /tmp/cmake-bug=/CMakeFiles/CheckTypeSize/HAVE_INTPTR_T.c

While it should be:

CMakeFiles/cmTryCompileExec.dir/HAVE_INTPTR_T.c.o: /tmp/cmake-bug\=/CMakeFiles/CheckTypeSize/HAVE_INTPTR_T.c
(0024625)
Brad King   
2011-01-12 12:18   
GNU Make does not seem to like = in rules, especially on the left:

$ cat Makefile
all: a=b
a=b:
        @echo a=b
$ make
make: *** No targets. Stop.
$ cat Makefile
all: a\=b
a=b:
        @echo a=b
$ make
make: *** No rule to make target `a=b', needed by `all'. Stop.
$ cat Makefile
all: a\=b
a\=b:
        @echo a=b
$ make
make: *** No rule to make target `a=b', needed by `all'. Stop.
(0024626)
Brad King   
2011-01-12 12:19   
Out of curiosity, why do you need = in your path?

I think the right solution here might be to make CMake error-out up front if = is in the path to the source or build tree.
(0024627)
Michal Cihar   
2011-01-12 12:24   
I don't need it. I was just debugging why Gammu fails to compile in such path: https://bugs.cihar.com/view.php?id=1128#c4447 [^]

Telling user he is doing something wrong is also a solution and definitely better than some silently failing checks.

However all other things seems to be working (I can build the project after forcing results of these checks), so this is single place where the absolute path is put to makefile in way which causes troubles.
(0024629)
Brad King   
2011-01-12 13:13   
Unfortunately your "single place" is just one instance of a more general problem. I built CMake itself under such a path and ran the test suite. Everything passed except for 2 tests:

         42 - LinkDirectory (Failed)
         75 - OutOfSource (Failed)

Most things work because CMake writes Makefiles with mostly relative paths under the top of the build tree on the left-hand side of make rules. Therefore the '=' does not appear in most of the rules. However, there are cases when CMake cannot do this and ends up requiring the full path on the left-hand side. The above tests cover some of these cases.

I think an early error is the safest approach.
(0024638)
Michal Cihar   
2011-01-12 18:11   
Indeed failing early is still much better than failing silently somewhere during the build process.
(0024677)
Brad King   
2011-01-14 10:14   
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8704525f [^]
(0029619)
Brad King   
2012-06-06 08:54   
Just to follow up here after more work in issue 0012934, my conclusion in 0011689:0024625 was incorrect. It is possible to support '=' in Makefile dependencies:

 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ee6c1b8a [^]