Sunday, September 4, 2022

cmake: ExternalProject_Add Ignore the INSTALL_COMMAND

The cmake function ExternalProject_Add  is documented at ExternalProject. There are circumstances when ExternalProject_Add's install command needs to be disabled.  The simplest way to disable the install command is to set the parameter to an empty string as follows: 

ExternalProject_Add(example_package
  SOURCE_DIR ${example_package_CMAKE}
  BUILD_COMMAND "cmake"
  INSTALL_COMMAND ""
)

A better solution is to write a message to the build output indicating that the install command has been disabled:

ExternalProject_Add(example_package
  SOURCE_DIR ${example_package_CMAKE}
  BUILD_COMMAND "cmake"
  INSTALL_COMMAND cmake -E echo "example_package: temporarily skipping install step."
)

No comments :

Post a Comment