What I am looking for: Download library Extract It Apply custom patch Run configure Run build command What library I am trying to build are:
- Openssl
- Boost
- Thrift
- C-ares
- Curl
- Pcre
- Nginx
- ICU
- JsonCPP
I think I can do these things using external module: http://cmake.org/cmake/help/v2.8.8/cmake.html#module:ExternalProject
But I have following question?
I have different type of build and with different directory. Is it going to build all these library for every different target? If yes it will be painful as all these library take one hour to build. Is there a way I can control it and it only build it once. As library remains same for all these targets.
On switching directory to different name. Cmake force everything to be rebuild-ed. Will it be same for external library. If yes? How to solve this problem. I don't want to rebuild the library if I am not changing them and want to use them while switching to different branches without building them.
Yes, you can use CMake's ExternalProject feature to accomplish what you want to do.
When using cross-compilation in combination with external projects, the source code will be built once for each toolchain. You could avoid rebuilds if you checked in the results of the build into a source-control system, and re-checked it out on each new person's machine, but I do not recommend this. Instead, have one of your "set up new computer" tasks actually be allowing the compilation to run overnight, which will also act as a test that the machine is actually usable. That set-up task can be launched by a system administrator prior to a new hire's arrival, or you can leave it to the new hire, as circumstances require.
I'm not completely certain what you are asking in your second question, but if the library is unchanged, CMake will detect that it is unchanged and not recompile it. Typically, the source code would be in a single directory tree: each compiled version would be built in a distinct location. Thus, developers can access any compiled version at any time just by switching directories. This is particularly helpful because it allows you to mount these directories over NFS to embedded hardware, et cetera.