Generator expressions in external projects.

Most external project commands support generator expressions. INSTALL_DIR isn’t used by CMake directly but instead used as placeholder in commands which support generator expressions. Documentation doesn’t mention and from experimental results it seems that using generator expressions inside INSTALL_DIR doesn’t work as CMake tries to validate the path without expanding generator expressions. In case of INSTALL_DIR workaround is not using <INSTALL_DIR> and specifying generator expression directly, but in case BINARY_DIR where the project gets built such workaround doesn’t work.

Is there a reason for not supporting generator expressions for external project directories? Am I using external projects incorrectly?

My motivation is that using “Visual Studio” generator executables get placed in directory that depends on Config (Release or Debug). I want to install the dlls from external project in the same directory so that development build can be run.

1 Like

I think that may be something that just hasn’t come up yet. Which error message are you getting?

As for a workaround, you may be able to use $(Configuration) which ends up letting MSBuild do the replacement (it only works for the VS generators though).