[CMake] Circular Dependancy?

Mike Jackson imikejackson at gmail.com
Tue Jun 5 19:19:04 EDT 2007


All correct. Basically I have a project (MXADataModel) that creates a  
library. Then I have another project that uses that library. I want  
to make sure that the library is built FIRST and built into the bin  
directory of the PFImport Project. I do not want to "install" the  
MXADataModel into /usr/local/lib or anything as this is all still  
under development.

So my question is do I have this really setup right according to  
CMake conventions. I supplied the binary directory and CMake seems to  
like everything now. Is this the right way to do this?

-- 
Mike Jackson   Senior Research Engineer
Innovative Management & Technology Services


On Jun 5, 2007, at 6:56 PM, Eric Noulard wrote:

> 2007/6/5, Mike Jackson <imikejackson at gmail.com>:
>> When I try as suggested I get the following error:
>>
>> make -C /Users/mjackson/Task_7/MXA_Workspace/PFImport/Build all
>> CMake Error: Error in cmake code at
>> /Users/mjackson/Task_7/MXA_Workspace/PFImport/CMakeLists.txt:23:
>> ADD_SUBDIRECTORY not given a binary directory but the given source
>> directory "/Users/mjackson/Task_7/MXA_Workspace/MXADataModel" is not
>> a subdirectory of "/Users/mjackson/Task_7/MXA_Workspace/PFImport".
>> When specifying an out-of-tree source a binary directory must be
>> explicitly specified.
>> Current CMake stack: /Users/mjackson/Task_7/MXA_Workspace/PFImport/
>> CMakeLists.txt;/usr/local/share/cmake-2.4/Modules/
>> CMakeCInformation.cmake;/usr/local/share/cmake-2.4/Modules/
>> CMakeCXXInformation.cmake
>> -- Configuring done
>> make: *** [cmake_check_build_system] Error 255
>
> The CMake error message is right indeed.
>
> Your "MXADataModel" is not a  subdirectory
> of "PFImport"
>
> In CMake handled project one usually puts the top level
> CMakeLists.txt (the one with PROJECT macro)
> in the top most directory you did not do this.
>
> Whatever your reason are, this is the reason you need to
> specify the binary_dir to ADD_SUBDIRECTORY.
>
> In fact in your case you do not go to a subdir
> but to a "sibling" dir since as far as I understand you have:
>
> /Users/mjackson/Task_7/MXA_Workspace/PFImport
> /Users/mjackson/Task_7/MXA_Workspace/MXADataModel
>
>>
>> If I do ADD_SUBDIRECTORY(MXADataModel ${PROJECT_BINARY_DIR}/
>> MXADataModel)
>>
>> Then cmake and make both run without complaints.
>>
>> --
>> Mike Jackson   Senior Research Engineer
>> Innovative Management & Technology Services
>>
>>
>> On Jun 5, 2007, at 1:47 PM, Eric Noulard wrote:
>>
>> > 2007/6/5, David Cole <david.cole at kitware.com>:
>> >> The thing that's strange about it is the second arg to
>> >> ADD_SUBDIRECTORY.
>> >> That should be a binary directory that is used by no other
>> >> ADD_SUBDIRECTORY
>> >> call and it should be different than the main PROJECT_BINARY_DIR
>> >> as well...
>> >
>> > I didn't know thta (in fact I never use the [binary_dir] arg)
>> >
>> > Nevertheless, should it be DIFFERENT or UNIQUE from
>> > ADD_LIBRARY/ADD_EXECUTABLE point of view?
>> >
>> >>
>> >> It should perhaps be "${PROJECT_BINARY_DIR}/MXADataModel"
>> >> ...?
>> >
>> > in this case:
>> >
>> > ADD_SUBDIRECTORY(MXADataModel)
>> >
>> > should be enough to get what you suggest, no?
>> >
>> >>
>> >> HTH,
>> >> David
>> >>
>> > --
>> > Erk
>>
>>
>
>
> -- 
> Erk



More information about the CMake mailing list