[CMake] Wrong number of "../" elements in target path? 2.4.6 vs. 2.4.7 bug?

Christian Convey christian.convey at gmail.com
Wed Oct 24 08:57:42 EDT 2007


Does anyone know about this?

I've got a C++ project on Linux.  I've been using CMake with it for a
while now.

In the past I had one directory per library or application that's in
my project.  The other day I modified my project so that some lib/app
code directories are at directory level n, and some others are at
directory level n+1.

I have a "bin" directory at (directory level n) that is where the
executable program targets are supposed to be placed.  I accomplish
this with by properly setting EXECUTABLE_OUTPUT_PATH in a top-level
CMakeLists.txt file.

Now that I've moved some of the source directories, though, I'm having
a problem with CMake 2.4.6-based builds of my code, but the problem is
absent in 2.4.7:

When CMake builds an application whose source directory is at level
n+1, the relative path used in the linker invocation, to say where the
resulting program file is supposed to end up, has the wrong number of
"../" elements in the path.  Specifically, it has one more than is
needed, and thus complains that it can't find the "bin" directory.

Here's the output:

Linking CXX executable ../../../bin/p1BTracker
cd /home/cjc/y/trunk/ivp/src/./eickstedt/p1BTracker && /usr/bin/cmake
-P CMakeFiles/p1BTracker.dir/cmake_clean_target.cmake
cd /home/cjc/y/trunk/ivp/src/./eickstedt/p1BTracker && /usr/bin/c++
  -fPIC "CMakeFiles/p1BTracker.dir/1BTrack.o"
"CMakeFiles/p1BTracker.dir/1BTracker.o"
"CMakeFiles/p1BTracker.dir/p1BTrackMain.o"   -o
../../../bin/p1BTracker -rdynamic -L/home/cjc/y/trunk/MOOS/MOOSBin
-L/home/cjc/y/trunk/ivp/src/./eickstedt/lib_track -Wl,-Bstatic -lMOOS
-lMOOSGen -lopt -Wl,-Bdynamic -lm -lpthread
-Wl,-rpath,/home/cjc/y/trunk/MOOS/MOOSBin:/home/cjc/y/trunk/ivp/src/./eickstedt/lib_track
/usr/bin/ld: cannot open output file ../../../bin/p1BTracker: No such
file or directory
collect2: ld returned 1 exit status
make[2]: *** [ivp/src/bin/p1BTracker] Error 1
make[2]: Leaving directory `/home/cjc/y/trunk'
make[1]: *** [ivp/src/./eickstedt/p1BTracker/CMakeFiles/p1BTracker.dir/all]
Error 2
make[1]: Leaving directory `/home/cjc/y/trunk'
make: *** [all] Error 2

I can't find a bug report about this, but I need to figure out a
work-around.  Many of my users have Ubuntu 7.04, which ships with
CMake 2.4.6, not 2.4.7.  Any suggestions?

Thanks,
Christian


More information about the CMake mailing list