Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CMake depend on "all" target from custom target

I'm making a library that needs to be packaged in a fancy way, and as part of that, I have a script that contains these lines:

#only install the lib component, nd put in the a special directory
ADD_CUSTOM_TARGET(o_destdir_install
  COMMAND DESTDIR=${CMAKE_BINARY_DIR}/o_package ${CMAKE_COMMAND} -DCOMPONENT=lib -P cmake_install.cmake
  DEPENDS ${CMAKE_BINARY_DIR}/cmake_install.cmake
  COMMENT "Building o_package directory with DESTDIR"
  )
ADD_DEPENDENCIES(o_destdir_install all preinstall)

I've found this code from the old UseDebian.cmake dpkg builder, however it does NOT build all and preinstall before it runs the install. Making my target depend on a non-built-in target seems to work, but I can't depend on any built-in targets it seems. How can I get this to work?

Also it would be nice if I could depend on a single component install preferably without the hacking calling of cmake, but I'm fine either way

like image 911
byteit101 Avatar asked Dec 01 '25 02:12

byteit101


1 Answers

add_custom_target(my_deploy
    DEPENDS all
    # Add your commands...
)
like image 114
VerySimple Avatar answered Dec 02 '25 21:12

VerySimple