Building as an external project dependency (C++)

I’m trying to use Pulse as a dependency for a larger preexisting project, in MSVC/Visual Studio 2022.

I am pulling in the Pulse engine via fetchcontent, and the files are cloned into my build directory as expected. The library’s build system is a little unconventional though, and I’m having trouble getting it plugged in correctly. My CMake chops are mediocre at best.

Pulse seems to require an install path to be specified, but also builds some static libs into an InnerBuild folder in my build directory. Despite seeing the libs in both folders, target_link_libraries(project PRIVATE Pulse::Pulse) isn’t able to find the files (LINK : fatal error LNK1104: cannot open file 'Pulse::Pulse.lib'), nor does it add the include directories. find_package doesn’t find anything either. I usually don’t “install” cmake libraries and just let it automatically handle the build artifacts internally, so I’m not sure if something different needs to be done here.

The how-to CMakeLists.txt example seems pretty seamless, but that’s within the engine source tree which probably simplifies the dependency resolution. Is there an example of how to build Pulse as an external dependency to a parent project somewhere?

I have not experimented with FetchContents.
I still use the superbuild approach, via AddExternalProject.
This talks about using that approach, but is pretty dated, so might need to clean it up.

The Pulse CMake system uses this, so you could also grab our utilities from our cmake folder to setup your project as a superbuild. So maybe the combination of that wiki page and looking at the Pulse code base will help you. (You would need to write a External_Pulse.cmake file, like what is here)

In general though, when you build Pulse, there is a Pulse.cmake located in the install/lib/cmake/pulse directory, pointing your CMAKE_MODULE_PATH then find_package should find Pulse.

Thanks, I will give this a try. There are so many ways to design a project’s integration mechanism with CMake that figuring it out on a new codebase can be a puzzle…