[cmake-developers] [CMake 0015193]: Error when one of the parent directory is a symlink to it's parent directory

Mantis Bug Tracker mantis at public.kitware.com
Fri Oct 3 09:01:58 EDT 2014


The following issue has been SUBMITTED. 
====================================================================== 
http://www.cmake.org/Bug/view.php?id=15193 
====================================================================== 
Reported By:                Yichao Yu
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   15193
Category:                   CMake
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2014-10-03 09:01 EDT
Last Modified:              2014-10-03 09:01 EDT
====================================================================== 
Summary:                    Error when one of the parent directory is a symlink
to it's parent directory
Description: 
If one of the parent directory of the source directory is a symlink to one of
its parent directory, cmake fails at configure time on add_subdirectory.

Directory structure to reproduce this:
```
% tree
.
├── 1
│   ├── 2
│   │   └── cmake
│   │       ├── a
│   │       │   └── CMakeLists.txt
│   │       └── CMakeLists.txt
│   └── 4 -> .
└── 3 -> 1

6 directories, 2 files
```

The higher level `CMakeLists.txt` is 
```
% cat 1/2/cmake/CMakeLists.txt 
project(cmake-test)
cmake_minimum_required(VERSION 2.8)
add_subdirectory(a)
```

and the lower level `CMakeLists.txt` is empty.

When trying to build in `1/4/2/cmake/build`
```
% cmake ..
-- The C compiler identification is GNU 4.9.1
-- The CXX compiler identification is GNU 4.9.1
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
CMake Error at CMakeLists.txt:3 (add_subdirectory):
  add_subdirectory not given a binary directory but the given source
  directory "/home/yuyichao/tmp/cmake-test/1/4/4/4/2/cmake/a" is not a
  subdirectory of "/home/yuyichao/tmp/cmake-test/1/4/4/2/cmake".  When
  specifying an out-of-tree source a binary directory must be explicitly
  specified.


-- Configuring incomplete, errors occurred!
See also
"/home/yuyichao/tmp/cmake-test/1/4/2/cmake/build/CMakeFiles/CMakeOutput.log".
```

Another real life example can be found in the comment here[1] and the qtcurve
issue here[2].

[1] http://kde-look.org/content/show.php?content=40492
[2] https://github.com/QtCurve/qtcurve/issues/77

====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2014-10-03 09:01 Yichao Yu      New Issue                                    
======================================================================




More information about the cmake-developers mailing list