PDA

View Full Version : Misc CMake Questions



kerryhall
May 25th, 2009, 09:01 AM
I have a few more questions about CMake, if anyone would be so kind! :)

1. How do you execute post build commands, such as copying a bin somewhere?

2. How do you detect libraries?

mart_k
May 25th, 2009, 02:02 PM
I have a few more questions about CMake, if anyone would be so kind! :)

1. How do you execute post build commands, such as copying a bin somewhere?You can use the install (http://www.cmake.org/cmake/help/cmake2.6docs.html#command:install) command to install targets after they are compiled. To add custom commands during "make install", you can add install(code ) (http://www.cmake.org/cmake/help/cmake2.6docs.html#command:install) commands.


2. How do you detect libraries?It depends a bit on the library. Some libraries can be found with build-in commands. You can use the find_package (http://www.cmake.org/cmake/help/cmake2.6docs.html#command:find_package) command for those. In some cases, you have to write the method to find a package yourself.

For libraries, there also is the find_library (http://www.cmake.org/cmake/help/cmake2.6docs.html#command:find_library) command.