user3717577
user3717577

Reputation: 23

CMake and Config/Modules find_package

I'm developing a lib and now trying to make it usable through cmake find_package keyword.

Using the config mode works fine. I've put the CPackConfig.cmake generated by cmake inside the installation folder of my lib by naming it log++Config.cmake and it can be found in my project. Fine. But this method is not satisfying. I need to define my own variables such as lib dependencies needed to link and some custom macros, and didn't found any way to embed this inside the CPackConfig.cmake.

So now I'm trying to use the module mode of find_package. My concern is that I can't find any way to have cmake use my Findlog++.cmake without putting it inside cmake installation folders (which is awfully ugly). I've found some posts telling to just put this file inside my project root but it's almost as ugly as modifying cmake itself.

Is there a way to have my Findlog++.cmake file somewhere inside my lib folder and have cmake finding it without setting the CMAKE_MODULE_PATH variable?

Upvotes: 2

Views: 1494

Answers (1)

steveire
steveire

Reputation: 11074

You seem to be confused between CPack and 'config file packages'. First, understand that they are separate and different. Then read

http://www.cmake.org/cmake/help/v3.0/manual/cmake-packages.7.html#creating-packages

http://www.cmake.org/cmake/help/v3.0/manual/cmake-buildsystem.7.html

to learn about usage requirements and inclusion of macros etc.

Upvotes: 2

Related Questions