[CMake] how to hide cmake files?

Andy Cedilnik andy.cedilnik at kitware.com
Tue Nov 2 08:13:51 EST 2004


(Looks like I forgot to CC CMake lists)

Hi Kutty,

You can put all CMakeLists.txt files to project directory and then refer 
to sources as:

ADD_EXECUTABLE(myexe
  "${CMAKE_CURRENT_SOURCE_DIR}/../src1.c"
  "${CMAKE_CURRENT_SOURCE_DIR}/../src2.c"
  ...
)

This way all CMakeLists.txt files are isolated from the source tree.
The other thing you may want to consider is to do out-of-source build. 
That way your buld tree will have bin lib and Make files, while sources 
and CMake list files will be in the source tree.

       Andy

Kutty Banerjee wrote:

> Hi,
>  Suppose i have the following directory structure viz.,
>  
> MainDir
>     ---src
>     ---project
>         -CMakeLists.txt
>  
> Now in the `CMakeLists.txt' in the project directory, i have a 
> SUBDIRS(../src) which is
> where the source file is. And i do
> CMake -G"NMake Makefiles" . All works fine
> and i get    a makefile in the project directory. When i do nmake in 
> the project
> directory however, the build process crashes.
>  
> The reason i m doing the above is to ensure that the cmake related 
> files stay in a separate
> folder than my src, bin and lib files.
>  
> Is there a work around this please?
>  
> With Thanks
> Kutty S Banerjee
>
>------------------------------------------------------------------------
>
>_______________________________________________
>CMake mailing list
>CMake at www.cmake.org
>http://www.cmake.org/mailman/listinfo/cmake
>  
>





More information about the CMake mailing list