[cmake-developers] [CMake 0015682]: [biicode] Ninja generator uses relative paths in target description when including parent directory

Mantis Bug Tracker mantis at public.kitware.com
Wed Aug 5 02:33:34 EDT 2015


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=15682 
====================================================================== 
Reported By:                Sam Spilsbury
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   15682
Category:                   CMake
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2015-08-05 02:33 EDT
Last Modified:              2015-08-05 02:33 EDT
====================================================================== 
Summary:                    [biicode] Ninja generator uses relative paths in
target description when including parent directory
Description: 
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

Steps to Reproduce: 
Tarball of reduced testcase included.

$ cd bii/
$ mkdir build
$ cd build/
$ cmake ../cmake -G
$ ninja

Additional Information: 
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.
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2015-08-05 02:33 Sam Spilsbury  New Issue                                    
2015-08-05 02:33 Sam Spilsbury  File Added: cmake-ninja-test.tar.gz             
      
======================================================================



More information about the cmake-developers mailing list