title: Cmake: How to build custom compiler binary and then use it for some targets?
body: <p>I need to build a custom C++ compiler binary and then use it for some targets in the project.</p>
  
  <p>What is the best way to do it in modern CMake?</p>
  
  <p>I set a dependency from the compiler target, and it works as expected, but then what, use 'generator expressions' to get the compiler target binary name?</p>
  
  <p><code>set(CMAKE_CXX_COMPILER ...)</code> -- either it doesn't understand generator expressions or I misuse it somehow.</p>
  
  <p>Is there a way to set the compiler only for specific targets? As I understand, <code>set(CMAKE_CXX_COMPILER)</code> works for current directory and its children.</p>