Hi!

I would like to add a library and the sources are distributed in different directories, something like the following example:

/ CmakeLists.txt
 hello.cpp
 subdir1 / hello1.cpp
           hello2.cpp
           CMakeLists.txt
 subdir2 / hello3.cpp
           hello4.cpp
           CMakeLists.txt

In the CMakeLists.txt of subdir1 I would write:

set( subdir1_SOURCES
    hello1.cpp
    hello2.cpp )

similar in subdir2

set( subdir2_SOURCES
    hello3.cpp
    hello4.cpp )

in /CMakeLists.txt I would add something like that:

add_subdirectory(subdir1)
add_subdirectory(subdir2)

add_library( irgendwas
            hello.cpp
            subdir_1/${subdir1_SOURCES}
            subdir_2/${subdir2_SOURCES} )

Unfortunately this doesn't work ;) CMake doesn't set the variables subdirx_SOURCES by calling add_subdirectory. The next problem I see is the add_library statement. In subdir1_SOURCES there is a necessary path prefix (subdir1/, subdir2/) missing - I am really not sure if I can add the prefix the way I have done it here (obviously not ;)).

Perhaps someone can help? I am sure there is a "good" or "accurate" way to do this - thanks a lot.

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