[CMake] link static libraries to a share library

Jiang Xu jxu158 at yahoo.com
Thu Apr 7 13:37:01 EDT 2011


Hi All,

I am new to cmake, but I really like it after looking into it.
I am in the process to make some changes to our current make file system.
I wonder how can I archieve the following goal using cmake:

1.  The root directory is features/
2.  Under root directory, there is a set of subdirectories as: feature_1/, feature_2/, ... feature_n/
3.  Under each subdirectory, there is a CMakeList.txt to compile a static library for each feature. For example, in CMakeList.txt under feature_1 directory, it has a line to create static library target: add_library(feature_1, STATIC, ${FEATURE_1_SRCS})
4.  Under root directory, there is no source code, all it does is based on user input (command line) to go into different sub-directories to build each static libraries and try to link all of them into a shared library.

It looks like add_library command must have any source code files in it.  So I don't know how to add a shared library target and all it does is to link different static libraries, there is no source file.  Can someone please help me?

Thanks in advance.

John


More information about the CMake mailing list