Alexander Neundorf schrieb:
You could also just the the variables in the parent CMakeLists.txt to the full path:

set(subdir1_DIR "${CMAKE_CURRENT_SOURCE_DIR}/subdir1")
set( subdir1_SOURCES
      ${subdir1_DIR/hello1.cpp
      ${subdir1_DIR/hello2.cpp)

add_library(irgendwas ${subdir1_SOURCES} )
This was my first approach. But than I got interested into it if there is a way to set the source files in the corresponding directory.
If you use the idea from James Bigler, I would suggest to name the included files not CMakeLists.txt, but something different, e.g. SourceFiles.txt or something like this.
But that's the point. I would like to add_subdirectory and would like to force cmake to parse the CMakelists.txt inside. The next thing is, I can append my recursive build in this subdirectory by adding add_subdirectory. So I like the version with defining a variable in the CMakeLists.txt inside the subdir and than "re"inherit the variable to the parent directory.
So people won't expect that these are normal cmake files which will be processed as the oother CMakeLists.txt
Ack - it's dangerous of course. People have to now how the variable with the source files has to be named and what happens with it. But I have packaged all about this into macros -> Our developer team is not as big - I can brief everybody to use the macros in the right way.

... but .. I'd be glad to hear further suggestions, greets

Michael

--
----------------------------------------------------------------------
                                                                __
Dipl.-Ing. (MSc) Michael Hammer (Scientific Assistant)     __  _|  |_
Institute for Strength of Materials /                     |  ||      |
          Graz University of Technology                  |_    _||__|
phone: +43 (0) 316 873 / 7667                               |__|
fax:   +43 (0) 316 873 / 7169
http://www.fest.TUGraz.at/                    [EMAIL PROTECTED]
----------------------------------------------------------------------

_______________________________________________
CMake mailing list
[email protected]
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to