and my assumption/hope was that find_package will find the autogenerated files and since the dependencies are built and installed through CMake, the include and library directories and the library names will be picked up automatically.
Now find_package 'is' able to find the dependencies i.e. if I am trying to find SDL2, it is able to do so and SDL2_FOUND is set. However, nothing else is picked up by find_package, including the include directories, library directories nor the name of the library (e.g. in SDL's case, it is called libSDL2.so).
I am also not sure which variables are set by find_package. For example, if the SDL2 library is found by find_package, what do I pass to target_include_directories and target_link_libraries? My first thought was to use "message(STATUS variable_set_by_find_package)" but I don't know what the variables are called.
Here's the project folder structure in case it helps visualize everything:
- CMakeLists.txt (root level, superbuild that adds all deps and subprojs)
- Dep/ (folder where dependencies are cloned)
- Install/ (folder where dependencies are installed)
-- SubProject1/CMakeLists.txt (subproject1 dependent on above deps)
-- SubProject2/CMakeLists.txt (subproject2 dependent on above deps)
Here's the auto-generated files by one of the dependencies, SDL2 (all dependencies generate similar files which are put in one of the nested directores inside the root "Install" directory):