You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am linking to the shared variant of Boost::log and would like to copy the shared (.dll / .so) and import (.lib, .dll.a / .a) library files to the output folder using target dependent generator expressions in an post-build command like so:
# Add a post-build command to copy all shared and import libraries
add_custom_command(TARGET ${TARGET_NAME} POST_BUILD
# Command to copy the shared library.
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "$<TARGET_FILE:${ITERATED_COMPONENT}>" "${LIBRARY_OUTPUT_DIRECTORY}"
# Command to copy the import library.
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "$<TARGET_LINKER_FILE:${ITERATED_COMPONENT}>" "${ARCHIVE_OUTPUT_DIRECTORY}" )
Problem
Many of the properties listed in target dependent generator expressions evaluate to empty or wrong (as far as my understanding goes) values. This is the case for both FindBoost and BoostConfig, i.e. no matter if setting Boost_NO_BOOST_CMAKE=ON or Boost_NO_BOOST_CMAKE=OFF.
Here is a list of some of the values the generator expressions evaluate to:
This is a copy of the Gitlab Kitware Issue 20611, which applies to both FindBoost and BoostConfig
Maybe you want to deal with it differently?!:
Background
I am linking to the shared variant of Boost::log and would like to copy the shared (.dll / .so) and import (.lib, .dll.a / .a) library files to the output folder using target dependent generator expressions in an post-build command like so:
Problem
Many of the properties listed in target dependent generator expressions evaluate to empty or wrong (as far as my understanding goes) values. This is the case for both FindBoost and BoostConfig, i.e. no matter if setting
Boost_NO_BOOST_CMAKE=ON
orBoost_NO_BOOST_CMAKE=OFF
.Here is a list of some of the values the generator expressions evaluate to:
and what I would have expected:
That way I could easily copy the files.
Also the limited availability of string-manipulation generator expressions as already discussed prevents me from quickly replacing the
CMAKE_IMPORT_LIBRARY_SUFFIX
with theCMAKE_SHARED_LIBRARY_SUFFIX
.Workaround
I thought of a solution, which is not very pretty, but it works:
There is no such things as
${LIBRARY_DIRECTORY_$<CONFIG>}
, right? I get this error:Is there a way to go around this? I tried this without success:
The text was updated successfully, but these errors were encountered: