add alternative to install(CODE "...") with code block instead of code string
currently i use this code to implement postinstall commands:
install(CODE "
message(STATUS \"PostInstall: target: If QtDBus.abi3.so exists, copying QtDBus.abi3.so to /build/tmpz5es9eq4/wheel/PyQt6\")
execute_process(COMMAND ${CMAKE_COMMAND} -E copy QtDBus.abi3.so /build/tmpz5es9eq4/wheel/PyQt6)
")
this is ugly, because the cmake code is in a string
i would prefer to put my code in a block, so i dont need to escape the doublequotes:
installcode()
message(STATUS "PostInstall: target: If QtDBus.abi3.so exists, copying QtDBus.abi3.so to /build/tmpz5es9eq4/wheel/PyQt6")
execute_process(COMMAND ${CMAKE_COMMAND} -E copy QtDBus.abi3.so /build/tmpz5es9eq4/wheel/PyQt6)
endinstallcode()
i dont want to use install(SCRIPT path/to/script.cmake)
, as i want to generate one monolithic cmake file
another advantage of such "inline code" is syntax highlighting
Edited by milahu