Hello, CMake does not allow generating project files for shared library output with cyclic dependencies using Microsoft VS compiler. CMake crashes trying to index an empty list. The following patch fixes that issue (source from cmake-2.7.20080602 build)
C:\cache\build\cmake-2.7.20080602 [dk]diff -p ../cmComputeTargetDepends.cxx Source/cmComputeTargetDepends.cxx *** ../cmComputeTargetDepends.cxx 2008-06-02 00:39:52.000000000 +0530 --- Source/cmComputeTargetDepends.cxx 2008-06-03 10:09:41.566880200 +0530 *************** void *** 147,156 **** --- 147,162 ---- cmComputeTargetDepends::GetTargetDirectDepends(cmTarget* t, std::set<cmTarget*>& deps) { + // For shared library with cyclic dependencies, this is empty! + // Gracefully come out so that with 2 link pass, we can solve it + if(this->FinalGraph.empty()) + return; + // Lookup the index for this target. All targets should be known by // this point. std::map<cmTarget*, int>::const_iterator tii = this->TargetIndex.find(t); assert(tii != this->TargetIndex.end()); + int i = tii->second; // Get its final dependencies. Now, a possible work around to get a build with cyclic dependencies on MS Windows using MS tools: You need to have two passes of the linker: 1st PASS: For each project: 1. Compile all files to get object files 2. Link using "/FORCE" without linking to any libraries (you are telling the linker to create a dll and import lib even if there are unresolved symbols) 3. Delete the generated DLL (not the import lib file) 2nd PASS: For each project: 1. Link with all object files and required lib files (built in PASS1 with "/FORCE" option) Bingo, You have working binaries with cyclic dependencies! The only problem here is: I know very minimal CMake to handle this, I have done so in Makefiles! -dhruva -- Contents reflect my personal views only! _______________________________________________ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake