Hi Owen,
On Mon, Jul 6, 2015 at 3:48 PM, Owen Alanzo Hogarth <gurenc...@gmail.com> wrote: > I created this simple project but I am having linking errors. Everything > builds correctly but when I try to add my lib to my main.c cmake complains > about linking errors. > > Here's what the project looks like: http://pastebin.com/22bCsuiE > > if i #include "time_utils.h" in my main.c I get this error: > > Scanning dependencies of target launcher > [ 50%] Building C object CMakeFiles/launcher.dir/main.c.o > /Users/xx/project/main.c:2:10: fatal error: 'time_utils.h' file not found > #include "time_utils.h" > > if I remove that line from the main.c it builds properly. I though adding > this line TARGET_LINK_LIBRARIES(auncher time_utils) to my cmakelists.txt it > would find the library but seems not. How can I make sure that the library > is found and properly linked? Perhaps you can try adding: INCLUDE_DIRECTORIES (<path to where time_utils.h is>) It looks like the problem is with compiling main.c. That's when it is looking for the header files. It isn't linking yet. That is what TARGET_LINK_LIBRARIES is for. Not sure if this is the right solution, but maybe you can give it a try; that is what I'm doing. Ray -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake