[CMake] newcomer question about dependencies

Anatoly Shirokov shirokov_a at mail.ru
Fri Sep 18 06:25:01 EDT 2009


Hello there!

I have a simple project with the following structure:
root
  CMakeLists.txt
  app
     CMakeLists.txt
     app.cpp
  lib
     CMakeLists.txt
     lib.cpp

The root\CMakeLists.txt contains:
cmake_minimum_required(VERSION 2.6)
project(ROOT)
add_subdirectory(app)
add_subdirectory(lib)

The root\app\CMakeLists.txt contains:
project( APP )
add_executable( app app.cpp )
target_link_libraries( app lib )
add_dependencies( app lib )

The root\app\CMakeLists.txt contains:
project( LIB )
add_library( lib STATIC lib.cpp)

I try to generate Visual Studio 6 project:
cd root
mkdir build
cd build
cmake -G "Visual Studio 6" ..

CMake generates the following:
ALL_BUILD.dsp
ALL_BUILD.dsp.cmake
CMakeCache.txt
cmake_install.cmake
ROOT.dsw
app\ALL_BUILD.dsp
app\ALL_BUILD.dsp.cmake
app\app.dsp
app\app.dsp.cmake
app\APP.dsw
app\CMakeFiles
app\cmake_install.cmake
app\CMakeFiles\ALL_BUILD.rule
CMakeFiles\ALL_BUILD.rule
CMakeFiles\cmake.check_cache
CMakeFiles\CMakeCCompiler.cmake
CMakeFiles\CMakeCPlatform.cmake
CMakeFiles\CMakeCXXCompiler.cmake
CMakeFiles\CMakeCXXPlatform.cmake
CMakeFiles\CMakeDetermineCompilerABI_C.bin
CMakeFiles\CMakeDetermineCompilerABI_CXX.bin
CMakeFiles\CMakeOutput.log
CMakeFiles\CMakeRCCompiler.cmake
CMakeFiles\CMakeSystem.cmake
CMakeFiles\CMakeTmp
CMakeFiles\CMakeTmp\CMakeFiles
CMakeFiles\CMakeTmp\Debug
lib\ALL_BUILD.dsp
lib\ALL_BUILD.dsp.cmake
lib\CMakeFiles
lib\cmake_install.cmake
lib\lib.dsp
lib\lib.dsp.cmake
lib\LIB.dsw
lib\CMakeFiles\ALL_BUILD.rule

When I open ROOT.dsw,  I can  build  all targets correctly according to 
dependencies. Why cannot I do the same when I open nested app\APP.dsw 
workspace?
In other words, why CMake does not include the lib project into the 
APP.DSW workspace?

Is it possible to hint CMake to do it?

Thanks in advance for any suggestions,
Anatoly Shirokov.







-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090918/ac4ac657/attachment-0001.htm>


More information about the CMake mailing list