MantisBT - CMake
View Issue Details
0015682CMakeCMakepublic2015-08-05 02:332016-06-10 14:31
Sam Spilsbury 
Kitware Robot 
normalminoralways
closedmoved 
Apple MacOS X10.4.10
CMake 3.3 
 
0015682: [biicode] Ninja generator uses relative paths in target description when including parent directory
This is the typical directory tree that biicode uses:

CMakeLists.txt
 - bii
   |
   - cmake
     |
     - biicode.cmake
     - CMakeLists.txt
   - build
- bin
- lib

Biicode starts from bii/cmake/CMakeLists.txt which includes bii/cmake/biicode.cmake which then adds the top-level CMakeLists.txt as a subdirectory.

bin and lib are set to CMAKE_RUNTIME_OUTPUT_DIRECTORY and CMAKE_ARCHIVE_OUTPUT_DIRECTORY respectively.

When using the ninja generator with this layout, relative paths are inserted into the build.ninja file, for example:

#############################################
# Link the executable ../../bin/main

build ../../bin/main: C_EXECUTABLE_LINKER build_dir/CMakeFiles/main.dir/main.c.o
  POST_BUILD = :
  PRE_LINK = :
  TARGET_PDB = main.dbg
# =============================================================================
# Target aliases.

However, the all target specifies the absolute path to the output file:

#############################################
# The main all target.

build all: phony /Users/smspillaz/Source/polysquare/cmake-ninja-test/bin/main

Which causes ninja to fail:

ninja: error: '/Users/smspillaz/Source/polysquare/cmake-ninja-test/bin/main', needed by 'all', missing and no known rule to make it
Tarball of reduced testcase included.

$ cd bii/
$ mkdir build
$ cd build/
$ cmake ../cmake -G
$ ninja
Granted, this is a strange build configuration, however biicode uses it and it doesn't appear to me that there is any other way of doing what they want to do without breaking their interface.
No tags attached.
gz cmake-ninja-test.tar.gz (2,279) 2015-08-05 02:33
https://public.kitware.com/Bug/file/5502/cmake-ninja-test.tar.gz
Issue History
2015-08-05 02:33Sam SpilsburyNew Issue
2015-08-05 02:33Sam SpilsburyFile Added: cmake-ninja-test.tar.gz
2016-06-10 14:29Kitware RobotNote Added: 0042816
2016-06-10 14:29Kitware RobotStatusnew => resolved
2016-06-10 14:29Kitware RobotResolutionopen => moved
2016-06-10 14:29Kitware RobotAssigned To => Kitware Robot
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0042816)
Kitware Robot   
2016-06-10 14:29   
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.