简体   繁体   中英

exporting cmake build options to external project

I have got a C++ Library A. A can be installed in a multitude of ways depending on which external dependencies are used. This also changes depending on whether the library is build in debug or release mode. This means that some features might not be available or some types/defines need to be changed in order to link to the library.

Now I want to link A to a local project B. I have set up a ProjectConfig.cmake file for A which is located at /path/lib/CMake/A/AConfig.cmake which is found and works fine in a minimal build. However as soon as I add definitions to the compilation or include some packages, this information is not automatically exported. This makes linking to A hard as for example I need to know that OpenMP was used to have a coherent build.

Is there a way to export this information the same way the ProjectConfig.cmake does it?

Generate the ProjectConfig.cmake file to contain what you need it to contain.

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

Note that if you set the usage requirements of the targets, you have less need to generate the file.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM