View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0011940CMakeCMakepublic2011-03-08 11:452016-06-10 14:31
ReporterNicolas Despres 
Assigned ToKitware Robot 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionmoved 
Platformi686OSUbuntuOS Version10.10
Product VersionCMake 2.8.4 
Target VersionFixed in Version 
Summary0011940: Wrong paths in generated Makefile when builddir is a symlink to an out-of-source directory.
DescriptionWhen you have a directory layout like this:
/tmp/sourcedir
/tmp/sourcedir/_build -> /tmp/build
/tmp/build

And you call cmake /tmp/sourcedir from /tmp/sourcedir/_build the paths in the generated Makefile are wrong. See the steps to reproduce for more details.

I will try to add a test and a patch that fix it as soon as I have time.
Steps To Reproduce$ cd /tmp
$ mkdir helloworld
$ cd helloworld
$ cat > CMakeLists.txt <<EOF
cmake_minimum_required(VERSION 2.8)
project(helloworld)

add_executable(helloworld
  src/main.cc
  )
EOF
$ mkdir src
$ cat > src/main.cc <<EOF
#include <iostream>

int main(void)
{
  std::cout << "Hello world\n" << std::endl;
  return 0;
}
EOF
$ mkdir /tmp/build
$ ln -s /tmp/build _build
$ cd _build
$ cmake ..
CMake Error: The source directory "/tmp" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.
$ cmake /tmp/helloworld
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- 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
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/helloworld/_build
$ make
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/helloworld/_build
Scanning dependencies of target helloworld
make[2]: *** No rule to make target `../src/main.cc', needed by `CMakeFiles/helloworld.dir/src/main.cc.o'. Stop.
make[1]: *** [CMakeFiles/helloworld.dir/all] Error 2
make: *** [all] Error 2


I have attached the CMakeCache.txt
Additional InformationHowever doing the following works:
$ rm -rf /tmp/helloworld/_build /tmp/build
$ mkdir /tmp/build
$ cd /tmp/build
$ cmake /tmp/helloworld
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- 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
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/build
$ make
Scanning dependencies of target helloworld
[100%] Building CXX object CMakeFiles/helloworld.dir/src/main.cc.o
Linking CXX executable helloworld
[100%] Built target helloworld
TagsNo tags attached.
Attached Filestxt file icon CMakeCache.txt [^] (10,456 bytes) 2011-03-08 11:45 [Show Content]

- Relationships Relation Graph ] Dependency Graph ]

-  Notes
(0030239)
David Cole (manager)
2012-08-11 11:09

Sending old, never assigned issues to the backlog.

(The age of the bug, plus the fact that it's never been assigned to anyone means that nobody is actively working on it...)

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 who has the bandwidth to take it on, and ferry a fix through to our 'next' branch for dashboard testing.
(0041814)
Kitware Robot (administrator)
2016-06-10 14:28

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.

- Issue History
Date Modified Username Field Change
2011-03-08 11:45 Nicolas Despres New Issue
2011-03-08 11:45 Nicolas Despres File Added: CMakeCache.txt
2012-08-11 11:09 David Cole Status new => backlog
2012-08-11 11:09 David Cole Note Added: 0030239
2016-06-10 14:28 Kitware Robot Note Added: 0041814
2016-06-10 14:28 Kitware Robot Status backlog => resolved
2016-06-10 14:28 Kitware Robot Resolution open => moved
2016-06-10 14:28 Kitware Robot Assigned To => Kitware Robot
2016-06-10 14:31 Kitware Robot Status resolved => closed


Copyright © 2000 - 2017 MantisBT Team
Powered by Mantis Bugtracker