I use ExternalProject_Add command in my CMakeLists.txt for adding some external project. I'd like to retrieve some project properties (exactly I'd like to get preprocessor definitions like <project>_DEFINITIONS from Find<package>.cmake).
Is there any way to get all allowed project properties for using as ExternalProject_Get_property command parameter? For example, I know about source_dir and binary_dir, i. e. something like this:
ExternalProject_Get_property(<my project> binary_dir)
OR is there any way to use find_package function immediately after dowloading external project? I definitely know that find_package for this project works after launching build (i. e. after external project is already configured). It automatically sets all necessary variables (like <project>_DEFINITIONS), but obviously find_package(<project>) is not available initially (i. e. before external project was configured).
When you download external package, you have only its sources. CMake has no common way for extract information about the package using only its sources.
Only sources:
Function ExternalProject_Get_property returns properties which are set by ExternalProject_Add call itself. The external project hasn't even configured at this call, so you cannot get any information about the package.
Configured:
There is command export, which allows for configured external package to publish information about some of its targets.
Installed:
Command find_package requires (normally) the package to be already installed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With