[CMake] add_subdirectory and build directory

Pierre-Julien Villoud PVilloud at movea.com
Tue Sep 15 05:08:08 EDT 2009


Here is another problem I'm facing with the previous example :



If I do this :

In C:\Maths :

> Cmake -G"MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release && make => builds

> libMaths



And after :

In C:\HelloMath (assuming the cmake has been called before Maths build :

> make => fails with the following output :

C:\Math\CMakeFiles\Maths.dir\build.make:43: CMakeFiles/Maths.dir/depend.make: No such file or directory

C:\Math\CMakeFiles\Maths.dir\build.make:46: CMakeFiles/Maths.dir/progress.make: No such file or directory

C:\Math\CMakeFiles\Maths.dir\build.make:49: CMakeFiles/Maths.dir/flags.make: No such file or directory

mingw32-make[2]: *** No rule to make target `CMakeFiles/Maths.dir/flags.make'.  Stop.

mingw32-make[1]: *** [C:/Math/CMakeFiles/Maths.dir/all] Error 2

mingw32-make: *** [all] Error 2





in build.make, the path of depend.make progress.make and flags.make is relative. In order to make the build work, I need it to be absolute (it is absolute when building HelloMath)



Is there a way to make it absolute ?



Thanks !



Pierre-Julien VILLOUD


-----Message d'origine-----

De : cmake-bounces at cmake.org [mailto:cmake-bounces at cmake.org] De la part de Pierre-Julien Villoud Envoyé : mardi 15 septembre 2009 10:17 À : Marcel Loose Cc : cmake at cmake.org Objet : Re: [CMake] add_subdirectory and build directory



I found my problem



Here are 2 CMakeLists.txt :



===================================

CMakeLists.txt : libMaths :



#Minimum Cmake version required

cmake_minimum_required(VERSION 2.6)



add_library(Maths

      MathFuncsLib.cpp

)

===================================



===================================

CMakeLists.txt : HelloMath :



#Minimum Cmake version required

cmake_minimum_required(VERSION 2.6)



include_directories(../Math)



link_directories(../Math)



add_executable(HelloMath

      hellomath.cpp

)



target_link_libraries(HelloMath

      Maths

)



add_subdirectory(../Math ../Math)

===================================



My build process is the following :

Cmake (...) && make



And it's the cmake call that causes the problem :



In C:\Maths :

> Cmake -G"MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release && make => builds

> libMaths



In C:\HelloMath :

> Cmake -G"MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release && make => builds HelloMath AND builds libMaths (whereas it's up to date) because of the cmake call.



The following works :

In C:\HelloMath :

> Cmake -G"MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release && make => builds HelloMath AND builds libMaths because of the cmake call.



In C:\Maths :

> make => does not build libMaths since it's up to date.



So I must try to remove the cmake call and it will be fine !



Sorry to have bothered you...



Thanks !



Pierre-Julien VILLOUD

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090915/78309ee0/attachment.htm>


More information about the CMake mailing list