I'm trying to apply ExternalProject_Add to automate the installation of dependencies of a mid sized C project. Things were going well until I had to install a library which uses ExternalProject_Add to install one of its dependencies, which also happen to be used by my own project. It would be nice if I could avoid having to rebuild this library, but instead use the already installed version.
Is there a good way to accomplish this? Can I tell ExternalProject to download stuff only if some condition, e.g., library already installed, is not met?
Related
Suppose that:
I'm writing a C or C++ library.
I intend my library to be usable on multiple Unix-like platforms (and perhaps also on Windows).
I use CMake for build configuration.
I have some dependencies on other libraries.
Given this - should I be cognizant of the pkg-config mechanism? Versed in its use? Or - should I just ignore it? I'm asking both about its use when configuring my library's build, but also about whether to make sure the installation commands generate and install a .pc file for my library?
I have two separate git repositories that I am not sure how to best bring together using cmake. I would like a solution that is cross platform.
I have a C++ library project which produces a static library (and C++ headers). This project has its own cmake which will produce a static library. I haven't yet written an install step in the cmake.
I have a UI (Qt) project which visualizes the product of this library. This also is based on cmake and should be using the library; in fact, it does not make sense without the library.
What is the best practice for a situation such as this? I could imagine a few things:
The library is a git submodule of the UI project and the cmake of the UI uses add_subdirectory()
The UI build expects the user to have built and installed (to the system) the static library & headers
The UI build has a hard coded path (or ENV var) to the cmake of the library (or something like LibraryConfig.cmake, but I'm not familiar enough with this yet)
My end goal is that the user should be able to pull, build, and use the library in their own projects, but if in the future they feel necessary, they can grab the visualization tool additionally and use it with the library. Also, people who are not comfortable with using the library themselves might just want to clone the visualization tool repo and build & use it.
I want to use KDL (Kinematics and Dynamics Library) in robot control box. But robot control box uses SCons as their build system while KDL uses CMake.
It turned out that the control box doesn't have CMake installed. Should I install CMake in the control box? Or write SCons file for compiling KDL?
====================================================
My question is ambiguous. Sorry for that. And unfortunately, I cannot show the link of Control Box, it's not public. Here is link of KDL installation manual.
http://www.orocos.org/kdl/installation-manual
Let me make it more clear.
Forget all of previous question above and all about Control box, KDL. Let's say that you want to use one library. But the library can be built using CMake according to installation manual. Your PC doesn't have CMake installed but it has SCons, and unfortunately you should not install CMake on your PC.
If you can only use SCons, what can you do?
I know this situation is not usual, I want to know your opinion.
To answer your initial question: Yes, you should always try to install CMake, if that is a build requirement for you library and if you need to build that library from the sources.
To answer your later question: Replacing or rewriting the build system scripts is a major effort and not advisable. In general there is no script to convert build-systems. Such script might help to make the manual transformation. If you have a look at LLVM's effort to replace Autotools by CMake or Boost replacing it's own build system by CMake, you find out it takes several people several years and still not everybody is satisfied.
Often you don't need to build the library yourself. Either there are already built packages from the project directly of from your distribution (Debian etc. packages) or third party packagers like Mac Ports or NuGet.
In your case KDL provides Debian/Ubuntu packages.
Additional KDL is part of ROS, which is experimental in Homebrew for OS X.
I wrote a piece of software which works well on my own box. It has been a headache to get it onto another box, though.
The main problem is that there is a library which it uses which is not a library covered by apt-get; it's called pngwriter. And pngwriter is also very finicky, and it is not very easily installed. It also has version compatibility issues. To get around all of that, I thought it would be great to include the source for pngwriter with my project, and have CMake go ahead and make pngwriter with the rest of the code.
So my main question is: Is this type of deployment canon? Should CMake call the makefiles that the developers of the software already wrote, and then use FIND_PACKAGE locally, or will I need to rewrite all of their makefiles so that I can use ADD_LIBRARY?
I'd recommend using the ExternalProject_Add function.
The docs are OK, but there is a decent article which explains things in a bit more detail. From this article:
The ExternalProject_Add function makes it possible to say “download this project from the internet, run its configure step, build it and install it”
Bear in mind that you can skip the install step altogether, or you could choose to install to a location inside your own build directory.
I'd like to use ConnectionKit in a project, but haven't yet been able to compile the framework.
I haven't been able to find a definitive list of external projects that ConnectionKit depends on. I've attempted to include projects that fit my best guess, but nothing has worked so far.
Does anyone know exactly what projects / libraries ConnectionKit requires?
To take my comment and turn it into an answer: it appears that ConnectionKit already includes many of its dependencies by default. However, there are two Git submodules that you're going to have to install for this framework to compile: "libssh2_sftp-Cocoa-wrapper" and "DAVKit".
The easiest way to install them is to cd to the framework directory once you've cloned it, and to run git submodule update --init libssh2_sftp-Cocoa-wrapper DAVKit.