Let us have a closer look at the invocation of add_custom_command:
add_custom_command( OUTPUT ${wrap_BLAS_LAPACK_sources} COMMAND ${CMAKE_COMMAND} -E tar xzf ${CMAKE_CURRENT_SOURCE_DIR}/wrap_BLAS_LAPACK.tar.gz COMMAND ${CMAKE_COMMAND} -E touch ${wrap_BLAS_LAPACK_sources} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/wrap_BLAS_LAPACK.tar.gz COMMENT "Unpacking C++ wrappers for BLAS/LAPACK" VERBATIM )
add_custom_command adds rules to targets so that they know how to generate the output by executing the commands. Any target declared within the same directory of add_custom_command, that is, in the same CMakeLists.txt, and that uses any file in the output as its source file, will be given a rule ...