[CMake] Multiple CMakeLists.txt in the same directory

Jon Shuler jonshuler at yahoo.com
Thu Dec 18 12:13:12 EST 2008


Is there a recommended way to organize our cmake files?

Thanks,
Jon



________________________________
From: David Cole <david.cole at kitware.com>
To: Jon Shuler <jonshuler at yahoo.com>
Cc: cmake at cmake.org
Sent: Thursday, December 18, 2008 11:03:33 AM
Subject: Re: [CMake] Multiple CMakeLists.txt in the same directory

Well, if you want to organize things that way, you could have one CMakeLists.txt file and then Project1.cmake, Project2.cmake ....

and then:

CMakeLists.txt:
==============
cmake_minimum_required(VERSION 2.6)
project(AllProjects)
include(${CMAKE_CURRENT_SOURCE_DIR}/Project1.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/Project2.cmake)
....





On Thu, Dec 18, 2008 at 11:53 AM, Jon Shuler <jonshuler at yahoo.com> wrote:

Right now we have a build\win32 directory that contains all the projects files.  I was looking at creating a CMakeLists.txt for each project and putting them in the same directory.  I rather have separate CMakeLists.txt for each project instead of one big file.

How would this work based on what you explained?

Jon




________________________________
From: David Cole <david.cole at kitware.com>
To: Jon Shuler <jonshuler at yahoo.com>
Cc: cmake at cmake.org
Sent: Thursday, December 18, 2008 10:29:40 AM
Subject: Re: [CMake] Multiple CMakeLists.txt in the same directory


Consider a CMakeLists.txt file as if it were one of your project files. You will use the CMakeLists.txt file to generate project files after converting to cmake. You should be able to write one that references your source, just as you reference your source from your existing VS project files.

The source can exist in any directory you want it to, you just have to reference it correctly from within the CMakeLists.txt file. It's only by convention and history that CMakeLists.txt files typically reference source files in the same directory.


Does that make sense?


On Thu, Dec 18, 2008 at 11:12 AM, Jon Shuler <jonshuler at yahoo.com> wrote:

I am looking at converting our build system to cmake and have found an issue.  We keep all the project files (VS 6, VS 2003 and VS 2008) in one common directory that is separate from the source tree.  Based on what I read it looks like CMake expects the CMakeLists.txt to exist in the same directory as the source.

What options do we have other than moving the projects files?

Thanks,
Jon

_______________________________________________
CMake mailing list
CMake at cmake.org
http://www.cmake.org/mailman/listinfo/cmake
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20081218/77d033e3/attachment.htm>


More information about the CMake mailing list