[CMake] Best practice for static libraries and include files

Alessandro Saccoia alessandro.saccoia at gmail.com
Fri Mar 8 15:55:20 EST 2013


> Even better, if each of your libraries declares a project, you can use ${lib1_SOURCE_DIR}/src, and you won't have to change it if you later move lib1 to a different place in the source tree.

I didn't know about this syntax, it's very handy indeed. I always try to make self contained projects, with 2 directories: include with the public interface to the library, and src that contains not just .cxx files but also the internal headers. So this is the best solution.

> 
> (I've seen legitimate uses of defining variables for libraries' interface properties, e.g. include directories, but all of this is about to become properly supported :-), and anyway isn't something I would recommend trying to emulate in a young project.)

Where can I find more about it?

OT: Since we're already here, do you know why CTest seems to be broken, as I need to create a new custom target that depends on the tests in order to run them, i.e. "make check" doesnt do anything and "ctest -N" always shows "Total Tests: 0"? Also, I want my tests to be verbose and both cout and cerr seem to be redirected to /dev/null so I can read nothing… thanks

Alessandro

> 
> -- 
> Matthew
> 
> --
> 
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
> 
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake



More information about the CMake mailing list