We changed policy 0167 from OLD to NEW, which means we are now using BoostConfig.cmake from Boost instead of the FindBoost module from CMake.
This has the side effect that Boost_LIBRARIES changed from /usr/lib/x86_64-linux-gnu/libboost_iostreams.so to Boost::iostreams, and similar for all other components.
This breaks a configure_file command that we need for deployment to MacOS.
How to convert the target Boost::iostreams to the corresponding library path?
I saw the generating expression $<TARGET_FILE:tgt>, but couldn’t get it to be expanded in the right moment.
$<TARGET_FILE:tgt> should indeed be the way to go. Of course, as a generator expression, it can only be expanded at generate time — when CMake is done reading all CMakeLists.txt files and is working on generating the buildsystem from them. Nevertheless, for all things which are needed at build time or later, this should be workable.
The basic command to look into would be file(GENERATE). This can even be combined with configure_file() in a two step configure–generate process. If you share the code and purpose of your configured file, we might be able to provide more detailed advice.
Our code is open source; the code line in question is here [1]. But it’s terribly complicated: a C++/Python project to be deployed to macOS. Anyway, the line in question essentially says
configure(${lib} ${output_directory} COPYONLY)
Maybe the COPYONLY simplifies things: couldn’t we just replace the statement by a file(GENERATE ...) statement?
Oh, I thought you were referring to the files inside a configured file, I didn’t realise you were configuring the files themselves.
Would it be OK for you if the copying happened at build time instead of at CMake time? If so, you can use file(GENERATE) to create a script which will do the copying (you can use a construct such as ${CMAKE_COMMAND} -E copy ...), and then run the script as a custom target or custom command.