[CMake] how to specify static library dependency on current project in CMakeLists.txt

Zahid Iqbal zahid.iqbal at gmail.com
Tue Jul 18 05:15:01 EDT 2017


Hi List,

Previously, I posted a question, I will rephrase it here.

I am building a simple project "my_application". I have all source (.c, and
.h files) under "my_application". My CMakeLists.txt file is under
"my_application".
In this project, I need to link to a static library called
"example_library.a".

The way, I generate "example_library.a" is as follows.  "example_library.a"
needs some definition from "my_application". In the makefile which is used
to generate "example_library.a" , I add the needed paths to
"my_application". It compiles fine and result is "example_library.a".

After linking to "example_library.a" in CMakeLists.txt, when I run cmake,
it reports an error from linked static library.

~/IMPLEMENTATIONS/PollingServer/ftt-se/src/modules/ftt-core.layer/master/M_Server.h:5:
error: my_types.h: No such file or directory
 #include "my_types.h"
                      ^

Please note that "my_types.h" is found under "my_application".

thanks,

Zahid
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20170718/5498f51c/attachment.html>


More information about the CMake mailing list