I have two projects, both of which use CMake. Now I want to include one of the projects as a library inside the other, while still maintaining the ability to compile them as standalone projects.
What I have done so far is: Use the version control system to clone a copy of the child project in a subdir of the parent project. I've used the "add_subdirectory" to include the CMakeLists.txt of the child project into the parent project. And I have fixed name collisions between targets by renaming some of the targets in the child project.
However, an issue that I am running into is that the various configuration tests in the child project don't seem to be running. For example, the child project uses the FindThreads module to determine what synchronization primitives are available. The parent project is unaware of threading issues and therefore does not have any tests related to this. Similarly, the child project has various tests for headers and such that are not needed by the parent project. None of these tests appear to be running, and the symbols defined by these tests aren't being added to the CMakeCache.txt file.
I really don't want to have to hoist all of the child project's tests (which mostly deal with platform-specific issues that are not relevant to the parent) into the parent project's CMakeLists.txt.