I have a complex build project that started as 4 visual studio 2017 solution C++/Fortran projects. I need to port them to Linux. We were planning the port from the beginning (5 years ago) using cross-platform compatible coding practices but it wasn't until recently that we were directed to actually start the port. I used a python cmake-converter to get me started. This worked remarkably well, until I got to linking. Below is the structure of the system, abstracted for brevity
each of these directories has a CMakeList.txt, and I use the idiom
to start the build.
I have been successful to the point that the several dozen static libraries build. each .a ends up in a parallel directory structure such as cmake_base/build/fortran_libs/f1static/libf1static.a
What now has me stymied is that I need to build the two shared libraries which are APIs wrapping the functionality of all the static libraries from the fortran_libs and cpp_libs projects (as well as some libraries I've installed such as openssl and GEOS). The shared libraries are being linked, but they only contain the wrapping and data marshalling, none of the functionality. I am trying to write my CMake code as recommended in Effective Modern CMake.
I started trying to use find_package(c1static REQUIRED) paired with target_link_libraries(cppAPI_shared c1static) in the CMakeLists.txt file in the cpp_API_shared directory, but find is looking for c1staticConfig.cmake which does not exist, so I'm obviously missing additional infrastructure in one or more CMakeLists.txt files in the hierarchy.
I think I could make things work using the link_directories and link_libraries commands, but I would prefer to solve the issue using the more modern way of thinking. I don't want to "install" all the static libraries, but I do want to install the two API libraries. The utilities and tests project will simply use the installed .so libraries to link against, so once I have the two API libraries built and installed in their correct location (/usr/local/lib/...) the executables should be a relatively easy as they only need to link to cpp_api.so
Any guidance would be appreciated.