thanks for the hints and your help, guys. Indeed, There was one '..\' too much in my source files path.

Eric

Andreas Pakulat a écrit :
On 28.09.11 12:51:53, pellegrini wrote:
Hi all,

I have a project with the following structure:

root/
   CMakeLists.txt
   prog1/
       CMakeLists.txt
       Src/
           file1.f90
   prog2/
       CMakeLists.txt
       Src/
           file2.f90

where prog1, prog2 are individual projects.

I would like to add file1.90 to the build process of prog2. To do
so, in the CMakeLists.txt file of prog2 project, I put:

   set(SOURCES ../../prog1/Src/file1.f90
                           Src/file2.f90)
and further
   add_executable(prog2 ${SOURCES})

when compiling with CMake I get the following error:

##############################################
CMake Error at CMakeLists.txt:35 (add_executable):
 Cannot find source file:

   ../../prog1/Src/file1.f90

 Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm
.hpp  .hxx .in .txx
###############################################

It seems that CMake cna not deal with relative path when declaring
the sources for a project.

Relative paths work just fine, but your expecting a different base-path
than cmake is. In the above example the current directory when
assembling the sources is root/prog2 not root/prog2/Src which you seem
to assume. Hence you have one ".." too much in your set-line. This
should work:

set( SOURCES ../prog1/Src/file1.f90 Src/file2.f90 )

Andreas

--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


--
Eric Pellegrini
Calcul Scientifique
Institut Laue-Langevin
Grenoble, France

--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to