[CMake] How to disable cmake_clean_target.cmake script from executing.

Eric NOULARD eric.noulard at gmail.com
Mon Nov 10 03:12:25 EST 2008


Le Mon, 10 Nov 2008 16:22:48 +0900,
"이명현" <thicliwin at gmail.com> a écrit :

> Hi,
> I am working in a system where a static library(archive) is build with
> source files that are distributed among several directories.
> 
> CMakeLists.txt
> src /
> 
> CMakeLists.txt
> *.cpp files
> src1/
> 
> CMakeLists.txt
> *.cpp files
> 
> src2/
> 
> CMakeLists.txt
> *.cpp files
> 
> 
> 
> In this setting, I wish to build a static library by recursively
> building through the source directories.

I think you should recurse in order to find files 
but not for building lib.

> However, by doing so, each time a library is built for a directory,
> it will destroy the previous build of the library( built from another
> directory) and add the objects from the current directory to the
> static library. I have found that this is being done by calling

You may try to create your static lib from the top-level CMakeLists.txt

FILE(GLOB_RECURSE SOURCE_FILE_LIST "*.cpp")
FILE(GLOB_RECURSE HEADER_FILE_LIST "*.h")
ADD_LIBRARY(whatever STATIC ${SOURCE_FILE_LIST} ${HEADER_FILE_LIST})

 
> cmake -P cmake_clean_target.cmake
>  
> If someway I could be able to block that script from executing I will
> have a static library with all the sources merged into one file.

I won't do that, that way.

-- 
Erk


More information about the CMake mailing list