View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0014553CMakeCMakepublic2013-11-08 11:072016-06-10 14:31
ReporterJan Rüegg 
Assigned ToKitware Robot 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionmoved 
PlatformArch Linux, 64-bitOSOS Version
Product VersionCMake 2.8.12 
Target VersionFixed in Version 
Summary0014553: add_subdirectory fails when using Ninja generator
DescriptionThis is the setup:

./folder1/CMakeLists.txt:
  cmake_minimum_required(VERSION 2.8)
  set(LIBRARY_OUTPUT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/libs/")
  add_subdirectory(../folder2 ${CMAKE_CURRENT_BINARY_DIR}/folder2)

./folder2/CMakeLists.txt:
  project(foo)
  add_library(foo foo.cpp)

./folder2/foo.cpp:
  int main() {}
Steps To ReproduceWhen I run cmake with the Unix Makefiles generator, everything works fine:

~/tmp/problem/folder1/build❯ cmake ..
-- The C compiler identification is GNU 4.8.2
-- The CXX compiler identification is GNU 4.8.2
...
-- Configuring done
-- Generating done
-- Build files have been written to: /home/jan/tmp/problem/folder1/build

~/tmp/problem/folder1/build❯ make
Scanning dependencies of target foo
[100%] Building CXX object folder2/CMakeFiles/foo.dir/foo.cpp.o
Linking CXX static library /home/jan/tmp/problem/folder1/libs/libfoo.a
[100%] Built target foo

However, using the Ninja generator doesn't work:

~/tmp/problem/folder1/build❯ cmake -GNinja ..
-- The C compiler identification is GNU 4.8.2
-- The CXX compiler identification is GNU 4.8.2
...
-- Configuring done
-- Generating done
-- Build files have been written to: /home/jan/tmp/problem/folder1/build

~/tmp/problem/folder1/build❯ ninja
ninja: error: '../libs/libfoo.a', needed by 'all', missing and no known rule to make it
Additional Information~/tmp/problem/folder1/build❯ ninja --version
1.4.0

~/tmp/problem/folder1/build❯ cmake --version
cmake version 2.8.12
TagsNo tags attached.
Attached Fileszip file icon subdir.zip [^] (907 bytes) 2013-11-26 06:18

 Relationships

  Notes
(0035061)
Jan Rüegg (reporter)
2014-02-10 09:18

Still not working for cmake 2.8.12.2
(0036497)
Jan Rüegg (reporter)
2014-07-30 06:36

Still not working for cmake 3.0.0 :(
(0042415)
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
2013-11-08 11:07 Jan Rüegg New Issue
2013-11-25 03:48 Peter Kuemmel Note Added: 0034539
2013-11-25 03:48 Peter Kuemmel Assigned To => Peter Kuemmel
2013-11-25 03:48 Peter Kuemmel Status new => assigned
2013-11-26 06:18 Peter Kuemmel File Added: subdir.zip
2013-11-26 06:18 Peter Kuemmel Status assigned => confirmed
2013-11-26 06:18 Peter Kuemmel Note Deleted: 0034539
2014-02-10 09:18 Jan Rüegg Note Added: 0035061
2014-04-13 05:42 Peter Kuemmel Assigned To Peter Kuemmel =>
2014-07-30 06:36 Jan Rüegg Note Added: 0036497
2016-06-10 14:29 Kitware Robot Note Added: 0042415
2016-06-10 14:29 Kitware Robot Status confirmed => 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