2011/1/25 luxInteg <[email protected]>: > On Tuesday 25 January 2011 07:53:24 Andreas Pakulat wrote: >> On 25.01.11 02:57:27, luxInteg wrote: >> > Greetings >> > >> > I am learning cmake >> > >> > consider my project with two directories dir1 and dir2 >> > >> > if I want to:- >> > move to dir1 and add a library libA in dir1 >> > move to dir2 and add a library libB in dir2 >> > move back to dir1 and add a test testA in dir1 >> > move back to dir2 and add a test testB to dir2 >> > >> > >> > (the moving back is because of the interdependencies of the tests with >> > the libraries i.e. testA reaquires libB etc)) >> > >> > how do I do this? >> >> You don't. All you need is 2 CMakeLists.txt, one in dir1 with libA and >> testA targets and the other in dir2 with libB and testB targets. CMake >> as a declarative language (to a certain extent) does not depend on the >> order in which you declare targets and use them. > > > Before I made my posting, I tried a setup (as you suggested) but with more > than two directories -lets call this N > > my extended setup had dir1 ......dirN > each with > add_library(someLIB ${sourceFiles(1...N)}) > add_depedencies(someLIB someTEST) > then > add_test(someTEST someFILE(1...N).c ) > target_link_libraries(someTEST > libA > libB > ..... > libN ) > > and it failed siting some 'graph' dependency problem. > > Basically I have to build a set of tests after building some static libraries > and some of these tests require linking to libraries that occur much later > in the build-scheme. {In other words libA.a might be built and testA (built > in the same directory as liba.A} but it requires linking not only to libA.a > but to the 'later-built' libN.a)
Then "TestA" is ill-named :-] I suggest you build all your libs and non inter-dependent test first (in the same "dirX" dir) then any test requiring several libs should be built in a separate "tests" dir that comes after all "dirX" dirs. -- Erk Membre de l'April - « promouvoir et défendre le logiciel libre » - http://www.april.org _______________________________________________ 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
