[CMake] Unmet dependency when builddir is a symlink out of srcdir

Nicolas Desprès nicolas.despres at gmail.com
Tue Mar 8 11:47:12 EST 2011


I have created an issue in the bug tracker:
http://public.kitware.com/Bug/view.php?id=11940

-Nico

2011/2/24 Nicolas Desprès <nicolas.despres at gmail.com>:
> I have checked by calling cmake from the "real" builddir (not the
> symlink) and it works fine:
>
> $ pwd
> /home/despre_n/build/test/helloworld-cmake/_build
> $ cmake ~/src/test/helloworld-cmake
> -- 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:
> /home/despre_n/build/test/helloworld-cmake/_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
>
> Cheers,
>
> -Nico
>
> 2011/2/24 Nicolas Desprès <nicolas.despres at gmail.com>:
>> Hi there,
>>
>> I am having a problem with cmake-2.8.4 for Linux with the Makefile
>> generator. I have my srcdir in an encrypted partition and my builddir
>> in a normal partition. For convenience I have a symlink inside my
>> srcdir pointing to my buildir.
>>
>> Here the scenario:
>> $  pwd
>> /home/despre_n/src/test/helloworld-cmake     #  src is a symlink to
>> /media/blabla/src (the encrypted partition)
>> $ find
>> .
>> ./src
>> ./src/main.cc
>> ./CMakeLists.txt
>> $ cat CMakeLists.txt
>> cmake_minimum_required(VERSION 2.8)
>> project(helloworld)
>>
>> add_executable(helloworld
>>  src/main.cc
>>  )
>> $ cat src/main.cc
>> #include <iostream>
>>
>> int main(void)
>> {
>>  std::cout << "Hello world\n" << std::endl;
>>  return 0;
>> }
>> $ mkdir -p ~/build/test/helloworld-cmake/_build            # Out of
>> the encrypted partition
>> $ ln -s ~/build/test/helloworld-cmake/_build                 # Create
>> the convenient symlink
>> $ cd _build
>> $ cmake ..
>> CMake Error: The source directory
>> "/home/despre_n/build/test/helloworld-cmake" does not appear to
>> contain CMakeLists.txt.
>> Specify --help for usage, or press the help button on the CMake GUI.
>> $ cmake ~/src/test/helloworld-cmake
>> -- 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:
>> /home/despre_n/src/test/helloworld-cmake/_build
>> $ make
>> -- Configuring done
>> -- Generating done
>> -- Build files have been written to:
>> /home/despre_n/src/test/helloworld-cmake/_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 tested with cmake-2.8.2 and I have the same result.
>>
>> I thought CMake was generating absolute path whenever possible.  Maybe
>> it should resolve symlinks as well.  I don't know.  Shall I create a
>> bug report?
>>
>> Regards,
>>
>> --
>> Nicolas Desprès
>>
>
>
>
> --
> Nicolas Desprès
>



-- 
Nicolas Desprès


More information about the CMake mailing list