[CMake] Re: Sharing code between projects
Mike Jackson
imikejackson at gmail.com
Fri Aug 24 12:17:41 EDT 2007
--
Mike Jackson Senior Research Engineer
Innovative Management & Technology Services
On Aug 24, 2007, at 10:48 AM, kitts wrote:
> On Thursday 23 Aug 2007 3:53:41 pm kitts wrote:
>> Anyway, I have a new set of projects and my current problem is
>> that i have
>> some code that i share between projects. Once source can be shared
>> not
>> binaries.
>>
>> Code is organized as;
>> src/common
>> src/project1
>> src/project2
>>
>> The CMakeLists.tst files are located inside for each project which
>> sets the
>> right compiler and sources to be built. Now i want common to be
>> included in
>> each of these proejects and build separately for each by
>> inheriting all the
>> settings for that project.
>>
>> What is the best way to achieve this? I cant use ADD_SUBDIRECTORY
>> () as it
>> is really a sibling folder (cmake complains if I use "../common").
>
I have a project where I build a Library and then have a bunch of
other projects use that directory. I also have some unit tests setup
within the library project that uses the generated library to link
against.
My project setup is like:
Project/
CMakeLists.txt
src/
Testing/Test1.cpp
Library/MyLibrary.cpp
I in the CMakeLists.txt file I have the library built and then I
ADD_SUBDIRECOTRY(${CMAKE_CURRENT_SRC_DIR}/src/Testing/)
Have a look at http://titanium.imts.us/viewvc/Task_7/MXADataModel/ to
see how I have things setup. It might help you figure something out.
Mike
More information about the CMake
mailing list