ENH: Simpler AddExternalProject configure step

This simplifies the implementation with add_external_project_step.
This commit is contained in:
Brad King 2009-03-30 11:38:05 -04:00
parent 385eb4dea7
commit f3ba510a65
1 changed files with 25 additions and 42 deletions

View File

@ -466,55 +466,38 @@ function(add_external_project_configure_command name)
# Create the working_dir for configure, build and install steps: # Create the working_dir for configure, build and install steps:
# #
mkdir("${working_dir}") mkdir("${working_dir}")
add_custom_command( add_external_project_step(${name} working_dir
OUTPUT ${sentinels_dir}/${name}-working_dir COMMENT "Making directory \"${working_dir}\""
COMMAND ${CMAKE_COMMAND} -E make_directory ${working_dir} COMMAND ${CMAKE_COMMAND} -E make_directory ${working_dir}
COMMAND ${CMAKE_COMMAND} -E touch ${sentinels_dir}/${name}-working_dir DEPENDEES update patch
DEPENDS ${sentinels_dir}/${name}-update DEPENDS ${file_deps}
${sentinels_dir}/${name}-patch
${file_deps}
VERBATIM
) )
get_target_property(cmd ${name} AEP_CONFIGURE_COMMAND) get_property(cmd_set TARGET ${name} PROPERTY AEP_CONFIGURE_COMMAND SET)
if(cmd STREQUAL "") if(cmd_set)
# Explicit empty string means no configure step for this project get_property(cmd TARGET ${name} PROPERTY AEP_CONFIGURE_COMMAND)
add_custom_command(
OUTPUT ${sentinels_dir}/${name}-configure
COMMAND ${CMAKE_COMMAND} -E touch ${sentinels_dir}/${name}-configure
WORKING_DIRECTORY ${working_dir}
COMMENT "No configure step for '${name}'"
DEPENDS ${sentinels_dir}/${name}-working_dir
VERBATIM
)
else() else()
if(NOT cmd) get_target_property(cmake_command ${name} AEP_CMAKE_COMMAND)
get_target_property(cmake_command ${name} AEP_CMAKE_COMMAND) if(cmake_command)
if(cmake_command) set(cmd "${cmake_command}")
set(cmd "${cmake_command}") else()
else() set(cmd "${CMAKE_COMMAND}")
set(cmd "${CMAKE_COMMAND}")
endif()
get_property(cmake_args TARGET ${name} PROPERTY AEP_CMAKE_ARGS)
list(APPEND cmd ${cmake_args})
get_target_property(cmake_generator ${name} AEP_CMAKE_GENERATOR)
if(cmake_generator)
list(APPEND cmd "-G${cmake_generator}" "${source_dir}/${name}")
endif()
endif() endif()
add_custom_command( get_property(cmake_args TARGET ${name} PROPERTY AEP_CMAKE_ARGS)
OUTPUT ${sentinels_dir}/${name}-configure list(APPEND cmd ${cmake_args})
COMMAND ${cmd}
COMMAND ${CMAKE_COMMAND} -E touch ${sentinels_dir}/${name}-configure get_target_property(cmake_generator ${name} AEP_CMAKE_GENERATOR)
WORKING_DIRECTORY ${working_dir} if(cmake_generator)
COMMENT "Performing configure step for '${name}'" list(APPEND cmd "-G${cmake_generator}" "${source_dir}/${name}")
DEPENDS ${sentinels_dir}/${name}-working_dir endif()
VERBATIM
)
endif() endif()
add_external_project_step(${name} configure
COMMAND ${cmd}
WORKING_DIRECTORY ${working_dir}
DEPENDEES working_dir
)
endfunction(add_external_project_configure_command) endfunction(add_external_project_configure_command)