View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0015216CMakeCMakepublic2014-10-22 09:442016-06-10 14:31
ReporterJoseph Lisee 
Assigned ToKitware Robot 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionmoved 
PlatformLinuxOSUbuntuOS Version12.04
Product VersionCMake 3.0.2 
Target VersionFixed in Version 
Summary0015216: Ninja makes bad phony targets with parallel "sub" directory and custom CMAKE_LIBRARY_OUTPUT_DIRECTORY
DescriptionI have project where the main build directory is on the same level as some "sub" directories, for example:

  primary/CMakeLists.txt
  secondary/CMakeLists.txt
  primary/build/<CMake generated files>

When I use the CMAKE_LIBRARY_OUTPUT_DIRECTORY to put all the lib files into primary/lib the build fails with ninja but keeps working with Make.

The ninja error:

ninja: error: '../lib/libtestlib.so', needed by 'CMakeFiles/main.dir/main.cpp.o', missing and no known rule to make it

Inside build.ninja the library is being built with the absolute path "/tmp/ninja-parallel-sub-test/primary/lib/libtestlib.so" while other places refer to it as "../lib/libtestlib.so".

Adding the following phony rule fixes the error:

build ../lib/libtestlib.so: phony /tmp/ninja-parallel-sub-test/primary/lib/libtestlib.so
Steps To ReproduceSteps:

 * unzip attached zip files
 * cd primary
 * mkdir build
 * cmake .. -G Ninja
 * ninja

Switching to Make will result in primary/bin/main and primary/lib/libtestlib.so appearing properly.

Make sure to clean up the primary/bin & primary/lib directory while switching build systems, if not done ninja will appear to work only because it's not trying to build the targets.
Additional InformationThis is broken with the latest git head fc9041d0249c113cb812d69ee0b8f1411f1eea15, CMake 3.0.2 and CMake 2.8.9. These bugs are related: 0014972, 0014414
TagsNo tags attached.
Attached Fileszip file icon ninja-parallel-sub-test.zip [^] (1,768 bytes) 2014-10-22 09:44

 Relationships
related to 0014972closedBrad King Ninja gen generates invalid phony dependencies for source files with in-source build 
related to 0014414closedKitware Robot Ninja: Running compiler from build dir makes it being run from bad relative directory 

  Notes
(0042649)
Kitware Robot (administrator)
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.

 Issue History
Date Modified Username Field Change
2014-10-22 09:44 Joseph Lisee New Issue
2014-10-22 09:44 Joseph Lisee File Added: ninja-parallel-sub-test.zip
2014-10-22 10:24 Brad King Relationship added related to 0014972
2014-10-22 10:24 Brad King Relationship added related to 0014414
2016-06-10 14:29 Kitware Robot Note Added: 0042649
2016-06-10 14:29 Kitware Robot Status new => resolved
2016-06-10 14:29 Kitware Robot Resolution open => moved
2016-06-10 14:29 Kitware Robot Assigned To => Kitware Robot
2016-06-10 14:31 Kitware Robot Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team