Hi,
After 10+ years of maintaining a horrible kind o CMake configuration
for a project I maintain, SOCI [1], I'm in the middle of rewriting it [2]
according to the modern CMake principles. At least, I'm trying to.
The library has number of dependencies on third-party libraries,
namely database access client libraries. I've reached the point
where I need to 'list' those dependencies in soci-config.cmake [3]
Namely, I need to make friend with find_dependency.
In SOCI, I maintain number of Find-modules, eg. FindSQLite3.cmake,
FindOracle.cmake, etc. Those are also an ancient CMake scripts,
but I think my problem/question is orthogonal to rewriting those to
target-aware modules or keep those old-style w/ FOO_LIBRARIES, etc.
Now, if I have a custom `FindSQLite3.cmake` module and I do
target_link_libraries(soci_sqlite3 PUBLIC ${SQLITE3_LIBRARIES})
in CMakeLists.txt of the SOCI library, then in soci-config.cmake I do
find_dependency(SQLite3)
Is that correct?
Now, am I supposed to deploy the FindSQLite3.cmake along
soci-config.cmake to match the ${SQLITE3_LIBRARIES}?
What if a user of SOCI (or even CMake distribution) comes with
custom FindSQLite3.cmake which actually defines targets
instead of old-style variables
or defines SQLITE_LIBRARIES (without 3 in SQLITE)?
How to handle such situations?
What should I read to wrap my head around the find_dependency
for my use case?
[1] https://github.com/SOCI/soci/
[2] https://github.com/mloskot/soci/tree/ml/modern-cmake
[3] https://github.com/mloskot/soci/blob/ml/modern-cmake/cmake/soci-config.cmake
Best regards,
--
Mateusz Loskot, http://mateusz.loskot.net
--
Powered by www.kitware.com
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Kitware offers various services to support the CMake community. For more
information on each offering, please visit:
CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake