@ -16,7 +16,12 @@
# [ C V S _ T A G t a g ] # T a g t o c h e c k o u t f r o m C V S r e p o
# [ C V S _ T A G t a g ] # T a g t o c h e c k o u t f r o m C V S r e p o
# [ S V N _ R E P O S I T O R Y u r l ] # U R L o f S u b v e r s i o n r e p o
# [ S V N _ R E P O S I T O R Y u r l ] # U R L o f S u b v e r s i o n r e p o
# [ S V N _ R E V I S I O N r e v ] # R e v i s i o n t o c h e c k o u t f r o m S u b v e r s i o n r e p o
# [ S V N _ R E V I S I O N r e v ] # R e v i s i o n t o c h e c k o u t f r o m S u b v e r s i o n r e p o
# [ S V N _ U S E R N A M E j o h n ] # U s e r n a m e f o r S u b v e r s i o n c h e c k o u t a n d u p d a t e
# [ S V N _ P A S S W O R D d o e ] # P a s s w o r d f o r S u b v e r s i o n c h e c k o u t a n d u p d a t e
# [ G I T _ R E P O S I T O R Y u r l ] # U R L o f g i t r e p o
# [ G I T _ T A G t a g ] # G i t b r a n c h n a m e , c o m m i t i d o r t a g
# [ U R L / . . . / s r c . t g z ] # F u l l p a t h o r U R L o f s o u r c e
# [ U R L / . . . / s r c . t g z ] # F u l l p a t h o r U R L o f s o u r c e
# [ U R L _ M D 5 m d 5 ] # M D 5 c h e c k s u m o f f i l e a t U R L
# [ T I M E O U T s e c o n d s ] # T i m e a l l o w e d f o r f i l e d o w n l o a d o p e r a t i o n s
# [ T I M E O U T s e c o n d s ] # T i m e a l l o w e d f o r f i l e d o w n l o a d o p e r a t i o n s
# # - - U p d a t e / P a t c h s t e p - - - - - - - - - -
# # - - U p d a t e / P a t c h s t e p - - - - - - - - - -
# [ U P D A T E _ C O M M A N D c m d . . . ] # S o u r c e w o r k - t r e e u p d a t e c o m m a n d
# [ U P D A T E _ C O M M A N D c m d . . . ] # S o u r c e w o r k - t r e e u p d a t e c o m m a n d
@ -111,19 +116,19 @@
# L i c e n s e t e x t f o r t h e a b o v e r e f e r e n c e . )
# L i c e n s e t e x t f o r t h e a b o v e r e f e r e n c e . )
# P r e - c o m p u t e a r e g e x t o m a t c h d o c u m e n t e d k e y w o r d s f o r e a c h c o m m a n d .
# P r e - c o m p u t e a r e g e x t o m a t c h d o c u m e n t e d k e y w o r d s f o r e a c h c o m m a n d .
file ( STRINGS "${CMAKE_CURRENT_LIST_FILE}" lines LIMIT_COUNT 10 0
file ( STRINGS "${CMAKE_CURRENT_LIST_FILE}" lines LIMIT_COUNT 10 3
R E G E X " ^ # ( \ \ [ [ A - Z _] + [ ^ ] ] * \ \ ] + # . * $ | [ A - Z a - z _ ] + \ \ ( ) " )
R E G E X " ^ # ( \ \ [ [ A - Z 0- 9 _] + [ ^ ] ] * \ \ ] + # . * $ | [ A - Z a - z 0 - 9 _ ] + \ \ ( ) " )
foreach ( line IN LISTS lines )
foreach ( line IN LISTS lines )
if ( "${line}" MATCHES "^# [A-Za-z _]+\\(")
if ( "${line}" MATCHES "^# [A-Za-z 0-9 _]+\\(")
if ( _ep_func )
if ( _ep_func )
set ( _ep_keywords_ ${ _ep_func } "${_ep_keywords_${_ep_func}})$" )
set ( _ep_keywords_ ${ _ep_func } "${_ep_keywords_${_ep_func}})$" )
endif ( )
endif ( )
string ( REGEX REPLACE "^# ([A-Za-z _]+)\\(.*" "\\1" _ep_func "${line}" )
string ( REGEX REPLACE "^# ([A-Za-z 0-9 _]+)\\(.*" "\\1" _ep_func "${line}" )
# message ( "function [${_ep_func}]" )
# message ( "function [${_ep_func}]" )
set ( _ep_keywords_ ${ _ep_func } "^(" )
set ( _ep_keywords_ ${ _ep_func } "^(" )
set ( _ep_keyword_sep )
set ( _ep_keyword_sep )
else ( )
else ( )
string ( REGEX REPLACE "^# \\[([A-Z _]+) .*" "\\1" _ep_key "${line}" )
string ( REGEX REPLACE "^# \\[([A-Z 0-9 _]+) .*" "\\1" _ep_key "${line}" )
# message ( " keyword [${_ep_key}]" )
# message ( " keyword [${_ep_key}]" )
set ( _ep_keywords_ ${ _ep_func }
set ( _ep_keywords_ ${ _ep_func }
" $ { _ e p _ k e y w o r d s _ $ { _ e p _ f u n c } } $ { _ e p _ k e y w o r d _ s e p } $ { _ e p _ k e y } " )
" $ { _ e p _ k e y w o r d s _ $ { _ e p _ f u n c } } $ { _ e p _ k e y w o r d _ s e p } $ { _ e p _ k e y } " )
@ -148,7 +153,7 @@ function(_ep_parse_arguments f name ns args)
foreach ( arg IN LISTS args )
foreach ( arg IN LISTS args )
set ( is_value 1 )
set ( is_value 1 )
if ( arg MATCHES "^[A-Z][A-Z _][A-Z_]+$" AND
if ( arg MATCHES "^[A-Z][A-Z 0-9 _][A-Z0-9 _]+$" AND
NOT ( ( arg STREQUAL "${key}" ) AND ( key STREQUAL "COMMAND" ) ) A N D
NOT ( ( arg STREQUAL "${key}" ) AND ( key STREQUAL "COMMAND" ) ) A N D
N O T a r g M A T C H E S " ^ ( T R U E | F A L S E ) $ " )
N O T a r g M A T C H E S " ^ ( T R U E | F A L S E ) $ " )
if ( _ep_keywords_ ${ f } AND arg MATCHES "${_ep_keywords_${f}}" )
if ( _ep_keywords_ ${ f } AND arg MATCHES "${_ep_keywords_${f}}" )
@ -157,6 +162,7 @@ function(_ep_parse_arguments f name ns args)
if ( NOT ( key STREQUAL "COMMAND" )
if ( NOT ( key STREQUAL "COMMAND" )
A N D NOT ( key STREQUAL "CVS_MODULE" )
A N D NOT ( key STREQUAL "CVS_MODULE" )
A N D NOT ( key STREQUAL "DEPENDS" )
A N D NOT ( key STREQUAL "DEPENDS" )
A N D NOT ( key STREQUAL "DOWNLOAD_COMMAND" )
)
)
message ( AUTHOR_WARNING "unknown ${f} keyword: ${arg}" )
message ( AUTHOR_WARNING "unknown ${f} keyword: ${arg}" )
endif ( )
endif ( )
@ -203,7 +209,63 @@ define_property(DIRECTORY PROPERTY "EP_PREFIX" INHERITED
)
)
function ( _ep_write_downloadfile_script script_filename remote local timeout )
function ( _ep_write_gitclone_script script_filename source_dir git_EXECUTABLE git_repository git_tag src_name work_dir )
file ( WRITE ${ script_filename }
" if ( \"${git_tag}\" STREQUAL \"\")
message ( FATAL_ERROR \"Tag for git checkout should not be empty.\ " )
endif ( )
execute_process (
C O M M A N D \ $ { C M A K E _ C O M M A N D } - E r e m o v e _ d i r e c t o r y \ " $ { s o u r c e _ d i r } \ "
R E S U L T _ V A R I A B L E e r r o r _ c o d e
)
if ( error_code )
message ( FATAL_ERROR \"Failed to remove directory: ' ${ source_dir } '\ " )
endif ( )
execute_process (
C O M M A N D \ " $ { g i t _ E X E C U T A B L E } \ " c l o n e \ " $ { g i t _ r e p o s i t o r y } \ " \ " $ { s r c _ n a m e } \ "
W O R K I N G _ D I R E C T O R Y \ " $ { w o r k _ d i r } \ "
R E S U L T _ V A R I A B L E e r r o r _ c o d e
)
if ( error_code )
message ( FATAL_ERROR \"Failed to clone repository: ' ${ git_repository } '\ " )
endif ( )
execute_process (
C O M M A N D \ " $ { g i t _ E X E C U T A B L E } \ " c h e c k o u t $ { g i t _ t a g }
W O R K I N G _ D I R E C T O R Y \ " $ { w o r k _ d i r } / $ { s r c _ n a m e } \ "
R E S U L T _ V A R I A B L E e r r o r _ c o d e
)
if ( error_code )
message ( FATAL_ERROR \"Failed to checkout tag: ' ${ git_tag } '\ " )
endif ( )
execute_process (
C O M M A N D \ " $ { g i t _ E X E C U T A B L E } \ " s u b m o d u l e i n i t
W O R K I N G _ D I R E C T O R Y \ " $ { w o r k _ d i r } / $ { s r c _ n a m e } \ "
R E S U L T _ V A R I A B L E e r r o r _ c o d e
)
if ( error_code )
message ( FATAL_ERROR \"Failed to init submodules in: ' ${ work_dir } / ${ src_name } '\ " )
endif ( )
execute_process (
C O M M A N D \ " $ { g i t _ E X E C U T A B L E } \ " s u b m o d u l e u p d a t e - - r e c u r s i v e
W O R K I N G _ D I R E C T O R Y \ " $ { w o r k _ d i r } / $ { s r c _ n a m e } \ "
R E S U L T _ V A R I A B L E e r r o r _ c o d e
)
if ( error_code )
message ( FATAL_ERROR \"Failed to update submodules in: ' ${ work_dir } / ${ src_name } '\ " )
endif ( )
"
)
endfunction ( _ep_write_gitclone_script )
function ( _ep_write_downloadfile_script script_filename remote local timeout md5 )
if ( timeout )
if ( timeout )
set ( timeout_args TIMEOUT ${ timeout } )
set ( timeout_args TIMEOUT ${ timeout } )
set ( timeout_msg "${timeout} seconds" )
set ( timeout_msg "${timeout} seconds" )
@ -212,6 +274,12 @@ function(_ep_write_downloadfile_script script_filename remote local timeout)
set ( timeout_msg "none" )
set ( timeout_msg "none" )
endif ( )
endif ( )
if ( md5 )
set ( md5_args EXPECTED_MD5 ${ md5 } )
else ( )
set ( md5_args "# no EXPECTED_MD5" )
endif ( )
file ( WRITE ${ script_filename }
file ( WRITE ${ script_filename }
" message ( STATUS \"downloading...
" message ( STATUS \"downloading...
s r c = ' $ { r e m o t e } '
s r c = ' $ { r e m o t e } '
@ -221,6 +289,8 @@ function(_ep_write_downloadfile_script script_filename remote local timeout)
file ( DOWNLOAD
file ( DOWNLOAD
\ " $ { r e m o t e } \ "
\ " $ { r e m o t e } \ "
\ " $ { l o c a l } \ "
\ " $ { l o c a l } \ "
S H O W _ P R O G R E S S
$ { m d 5 _ a r g s }
$ { t i m e o u t _ a r g s }
$ { t i m e o u t _ a r g s }
S T A T U S s t a t u s
S T A T U S s t a t u s
L O G l o g )
L O G l o g )
@ -243,23 +313,64 @@ message(STATUS \"downloading... done\")
endfunction ( _ep_write_downloadfile_script )
endfunction ( _ep_write_downloadfile_script )
function ( _ep_write_extractfile_script script_filename filename tmp directory )
function ( _ep_write_verifyfile_script script_filename local md5 )
set ( args "" )
file ( WRITE ${ script_filename }
" message ( STATUS \"verifying file...
f i l e = ' $ { l o c a l } ' \ " )
if ( filename MATCHES ".tar$" )
set ( verified 0 )
set ( args xf )
# I f a n e x p e c t e d m d 5 c h e c k s u m e x i s t s , c o m p a r e a g a i n s t i t :
#
if ( NOT \"${md5}\" STREQUAL \"\")
execute_process ( COMMAND \${CMAKE_COMMAND} -E md5sum \"${local}\"
O U T P U T _ V A R I A B L E o v
O U T P U T _ S T R I P _ T R A I L I N G _ W H I T E S P A C E
R E S U L T _ V A R I A B L E r v )
if ( NOT rv EQUAL 0 )
message ( FATAL_ERROR \"error: computing md5sum of ' ${ local } ' failed\ " )
endif ( )
endif ( )
if ( filename MATCHES ".tgz$" )
string ( REGEX MATCH \"^([0-9A-Fa-f]+)\" md5_actual \"\${ov}\")
set ( args xfz )
string ( TOLOWER \"\${md5_actual}\" md5_actual )
string ( TOLOWER \"${md5}\" md5 )
if ( NOT \"\${md5}\" STREQUAL \"\${md5_actual}\")
message ( FATAL_ERROR \"error: md5sum of ' ${ local } ' does not match expected value
m d 5 _ e x p e c t e d : \ $ { m d 5 }
m d 5 _ a c t u a l : \ $ { m d 5 _ a c t u a l }
\ " )
endif ( )
endif ( )
if ( filename MATCHES ".tar.gz$" )
set ( verified 1 )
endif ( )
if ( verified )
message ( STATUS \"verifying file... done\ " )
else ( )
message ( STATUS \"verifying file... warning: did not verify file - no URL_MD5 checksum argument? corrupt file?\ " )
endif ( )
"
)
endfunction ( _ep_write_verifyfile_script )
function ( _ep_write_extractfile_script script_filename filename directory )
set ( args "" )
if ( filename MATCHES "(\\.bz2|\\.tar\\.gz|\\.tgz|\\.zip)$" )
set ( args xfz )
set ( args xfz )
endif ( )
endif ( )
if ( filename MATCHES "\\.tar$" )
set ( args xf )
endif ( )
if ( args STREQUAL "" )
if ( args STREQUAL "" )
message ( SEND_ERROR "error: do not know how to extract '${filename}' -- known types are .tar, .tgz and .tar.gz" )
message ( SEND_ERROR "error: do not know how to extract '${filename}' -- known types are . bz2, . tar, .tar.gz, .t gz and .zip ")
return ( )
return ( )
endif ( )
endif ( )
@ -267,20 +378,23 @@ function(_ep_write_extractfile_script script_filename filename tmp directory)
" # M a k e f i l e n a m e s a b s o l u t e :
" # M a k e f i l e n a m e s a b s o l u t e :
#
#
get_filename_component ( filename \"${filename}\" ABSOLUTE )
get_filename_component ( filename \"${filename}\" ABSOLUTE )
get_filename_component ( tmp \"${tmp}\" ABSOLUTE )
get_filename_component ( directory \"${directory}\" ABSOLUTE )
get_filename_component ( directory \"${directory}\" ABSOLUTE )
message ( STATUS \"extracting...
message ( STATUS \"extracting...
s r c = ' \ $ { f i l e n a m e } '
s r c = ' \ $ { f i l e n a m e } '
d s t = ' \ $ { d i r e c t o r y } ' \ " )
d s t = ' \ $ { d i r e c t o r y } ' \ " )
if ( NOT EXISTS \"\${filename}\")
message ( FATAL_ERROR \"error: file to extract does not exist: '\ ${ filename } '\ " )
endif ( )
# P r e p a r e a s p a c e f o r e x t r a c t i n g :
# P r e p a r e a s p a c e f o r e x t r a c t i n g :
#
#
set ( i 1 )
set ( i 1 234 )
while ( EXISTS \"\${tmp}/extract\${i}\")
while ( EXISTS \"\${ directory}/../ex \${i}\")
math ( EXPR i \"\${i} + 1\ " )
math ( EXPR i \"\${i} + 1\ " )
endwhile ( )
endwhile ( )
set ( ut_dir \"\${ tmp}/extract \${i}\")
set ( ut_dir \"\${ directory}/../ex \${i}\")
file ( MAKE_DIRECTORY \"\${ut_dir}\")
file ( MAKE_DIRECTORY \"\${ut_dir}\")
# E x t r a c t i t :
# E x t r a c t i t :
@ -305,10 +419,12 @@ if(NOT n EQUAL 1 OR NOT IS_DIRECTORY \"\${contents}\")
set ( contents \"\${ut_dir}\")
set ( contents \"\${ut_dir}\")
endif ( )
endif ( )
# Co p y \ " t h e o n e \ " d i r e c t o r y t o t h e f i n a l d i r e c t o r y :
# Mo v e \ " t h e o n e \ " d i r e c t o r y t o t h e f i n a l d i r e c t o r y :
#
#
message ( STATUS \"extracting... [copy]\ " )
message ( STATUS \"extracting... [rename]\ " )
file ( COPY \"\${contents}/\" DESTINATION \${directory})
file ( REMOVE_RECURSE \${directory})
get_filename_component ( contents \${contents} ABSOLUTE )
file ( RENAME \${contents} \${directory})
# C l e a n u p :
# C l e a n u p :
#
#
@ -609,6 +725,29 @@ function(_ep_add_mkdir_command name)
endfunction ( _ep_add_mkdir_command )
endfunction ( _ep_add_mkdir_command )
function ( _ep_get_git_version git_EXECUTABLE git_version_var )
if ( git_EXECUTABLE )
execute_process (
C O M M A N D " $ { g i t _ E X E C U T A B L E } " - - v e r s i o n
O U T P U T _ V A R I A B L E o v
O U T P U T _ S T R I P _ T R A I L I N G _ W H I T E S P A C E
)
string ( REGEX REPLACE "^git version (.+)$" "\\1" version "${ov}" )
set ( ${ git_version_var } "${version}" PARENT_SCOPE )
endif ( )
endfunction ( )
function ( _ep_is_dir_empty dir empty_var )
file ( GLOB gr "${dir}/*" )
if ( "${gr}" STREQUAL "" )
set ( ${ empty_var } 1 PARENT_SCOPE )
else ( )
set ( ${ empty_var } 0 PARENT_SCOPE )
endif ( )
endfunction ( )
function ( _ep_add_download_command name )
function ( _ep_add_download_command name )
ExternalProject_Get_Property ( ${ name } source_dir stamp_dir download_dir tmp_dir )
ExternalProject_Get_Property ( ${ name } source_dir stamp_dir download_dir tmp_dir )
@ -616,6 +755,7 @@ function(_ep_add_download_command name)
get_property ( cmd TARGET ${ name } PROPERTY _EP_DOWNLOAD_COMMAND )
get_property ( cmd TARGET ${ name } PROPERTY _EP_DOWNLOAD_COMMAND )
get_property ( cvs_repository TARGET ${ name } PROPERTY _EP_CVS_REPOSITORY )
get_property ( cvs_repository TARGET ${ name } PROPERTY _EP_CVS_REPOSITORY )
get_property ( svn_repository TARGET ${ name } PROPERTY _EP_SVN_REPOSITORY )
get_property ( svn_repository TARGET ${ name } PROPERTY _EP_SVN_REPOSITORY )
get_property ( git_repository TARGET ${ name } PROPERTY _EP_GIT_REPOSITORY )
get_property ( url TARGET ${ name } PROPERTY _EP_URL )
get_property ( url TARGET ${ name } PROPERTY _EP_URL )
# T O D O : P e r h a p s f i l e : / / s h o u l d b e c o p i e d t o d o w n l o a d d i r b e f o r e e x t r a c t i o n .
# T O D O : P e r h a p s f i l e : / / s h o u l d b e c o p i e d t o d o w n l o a d d i r b e f o r e e x t r a c t i o n .
@ -661,8 +801,10 @@ function(_ep_add_download_command name)
endif ( )
endif ( )
get_property ( svn_revision TARGET ${ name } PROPERTY _EP_SVN_REVISION )
get_property ( svn_revision TARGET ${ name } PROPERTY _EP_SVN_REVISION )
get_property ( svn_username TARGET ${ name } PROPERTY _EP_SVN_USERNAME )
get_property ( svn_password TARGET ${ name } PROPERTY _EP_SVN_PASSWORD )
set ( repository ${ svn_repository } )
set ( repository "${svn_repository} user=${svn_username} password=${svn_password}" )
set ( module )
set ( module )
set ( tag ${ svn_revision } )
set ( tag ${ svn_revision } )
configure_file (
configure_file (
@ -674,13 +816,55 @@ function(_ep_add_download_command name)
get_filename_component ( src_name "${source_dir}" NAME )
get_filename_component ( src_name "${source_dir}" NAME )
get_filename_component ( work_dir "${source_dir}" PATH )
get_filename_component ( work_dir "${source_dir}" PATH )
set ( comment "Performing download step (SVN checkout) for '${name}'" )
set ( comment "Performing download step (SVN checkout) for '${name}'" )
set ( cmd ${ Subversion_SVN_EXECUTABLE } co ${ svn_repository } ${ svn_revision } ${ src_name } )
set ( cmd ${ Subversion_SVN_EXECUTABLE } co ${ svn_repository } ${ svn_revision }
- - u s e r n a m e = $ { s v n _ u s e r n a m e } - - p a s s w o r d = $ { s v n _ p a s s w o r d } $ { s r c _ n a m e } )
list ( APPEND depends ${ stamp_dir } / ${ name } -svninfo.txt )
list ( APPEND depends ${ stamp_dir } / ${ name } -svninfo.txt )
elseif ( git_repository )
find_package ( Git )
if ( NOT GIT_EXECUTABLE )
message ( FATAL_ERROR "error: could not find git for clone of ${name}" )
endif ( )
# T h e g i t s u b m o d u l e u p d a t e ' - - r e c u r s i v e ' f l a g r e q u i r e s g i t > = v 1 . 6 . 5
#
_ep_get_git_version ( "${GIT_EXECUTABLE}" git_version )
if ( git_version VERSION_LESS 1.6.5 )
message ( FATAL_ERROR "error: git version 1.6.5 or later required for 'git submodule update --recursive': git_version='${git_version}'" )
endif ( )
get_property ( git_tag TARGET ${ name } PROPERTY _EP_GIT_TAG )
if ( NOT git_tag )
set ( git_tag "master" )
endif ( )
set ( repository ${ git_repository } )
set ( module )
set ( tag ${ git_tag } )
configure_file (
" $ { C M A K E _ R O O T } / M o d u l e s / R e p o s i t o r y I n f o . t x t . i n "
" $ { s t a m p _ d i r } / $ { n a m e } - g i t i n f o . t x t "
@ O N L Y
)
get_filename_component ( src_name "${source_dir}" NAME )
get_filename_component ( work_dir "${source_dir}" PATH )
# S i n c e g i t c l o n e d o e s n ' t s u c c e e d i f t h e n o n - e m p t y s o u r c e _ d i r e x i s t s ,
# c r e a t e a c m a k e s c r i p t t o i n v o k e a s d o w n l o a d c o m m a n d .
# T h e s c r i p t w i l l d e l e t e t h e s o u r c e d i r e c t o r y a n d t h e n c a l l g i t c l o n e .
#
_ep_write_gitclone_script ( ${ tmp_dir } / ${ name } -gitclone.cmake ${ source_dir }
$ { G I T _ E X E C U T A B L E } $ { g i t _ r e p o s i t o r y } $ { g i t _ t a g } $ { s r c _ n a m e } $ { w o r k _ d i r }
)
set ( comment "Performing download step (git clone) for '${name}'" )
set ( cmd ${ CMAKE_COMMAND } -P ${ tmp_dir } / ${ name } -gitclone.cmake )
list ( APPEND depends ${ stamp_dir } / ${ name } -gitinfo.txt )
elseif ( url )
elseif ( url )
get_filename_component ( work_dir "${source_dir}" PATH )
get_filename_component ( work_dir "${source_dir}" PATH )
get_property ( md5 TARGET ${ name } PROPERTY _EP_URL_MD5 )
set ( repository "external project URL" )
set ( repository "external project URL" )
set ( module "${url}" )
set ( module "${url}" )
set ( tag "" )
set ( tag " ${md5} ")
configure_file (
configure_file (
" $ { C M A K E _ R O O T } / M o d u l e s / R e p o s i t o r y I n f o . t x t . i n "
" $ { C M A K E _ R O O T } / M o d u l e s / R e p o s i t o r y I n f o . t x t . i n "
" $ { s t a m p _ d i r } / $ { n a m e } - u r l i n f o . t x t "
" $ { s t a m p _ d i r } / $ { n a m e } - u r l i n f o . t x t "
@ -696,25 +880,30 @@ function(_ep_add_download_command name)
if ( "${url}" MATCHES "^[a-z]+://" )
if ( "${url}" MATCHES "^[a-z]+://" )
# T O D O : S h o u l d d o w n l o a d a n d e x t r a c t i o n b e d i f f e r e n t s t e p s ?
# T O D O : S h o u l d d o w n l o a d a n d e x t r a c t i o n b e d i f f e r e n t s t e p s ?
string ( REGEX MATCH "[^/]*$" fname "${url}" )
string ( REGEX MATCH "[^/]*$" fname "${url}" )
if ( NOT "${fname}" MATCHES "\\.( tar|tgz|tar\\.gz)$")
if ( NOT "${fname}" MATCHES "\\.( bz2| tar|tgz|tar\\.gz|zip )$")
message ( FATAL_ERROR "Could not extract tarball filename from url:\n ${url}" )
message ( FATAL_ERROR "Could not extract tarball filename from url:\n ${url}" )
endif ( )
endif ( )
set ( file ${ download_dir } / ${ fname } )
set ( file ${ download_dir } / ${ fname } )
get_property ( timeout TARGET ${ name } PROPERTY _EP_TIMEOUT )
get_property ( timeout TARGET ${ name } PROPERTY _EP_TIMEOUT )
_ep_write_downloadfile_script ( "${stamp_dir}/download-${name}.cmake" "${url}" "${file}" "${timeout}" )
_ep_write_downloadfile_script ( "${stamp_dir}/download-${name}.cmake" "${url}" "${file}" "${timeout}" "${md5}" )
set ( cmd ${ CMAKE_COMMAND } -P ${ stamp_dir } /download- ${ name } .cmake
set ( cmd ${ CMAKE_COMMAND } -P ${ stamp_dir } /download- ${ name } .cmake
C O M M A N D )
C O M M A N D )
set ( comment "Performing download step (download and extract) for '${name}'")
set ( comment "Performing download step (download , verify and extract) for '${name}'")
else ( )
else ( )
set ( file "${url}" )
set ( file "${url}" )
set ( comment "Performing download step ( extract) for '${name}'")
set ( comment "Performing download step ( verify and extract) for '${name}'")
endif ( )
endif ( )
_ep_write_verifyfile_script ( "${stamp_dir}/verify-${name}.cmake" "${file}" "${md5}" )
list ( APPEND cmd ${ CMAKE_COMMAND } -P ${ stamp_dir } /verify- ${ name } .cmake )
# T O D O : S u p p o r t o t h e r a r c h i v e f o r m a t s .
# T O D O : S u p p o r t o t h e r a r c h i v e f o r m a t s .
_ep_write_extractfile_script ( "${stamp_dir}/extract-${name}.cmake" "${file}" "${tmp_dir}" "${source_dir}" )
_ep_write_extractfile_script ( "${stamp_dir}/extract-${name}.cmake" "${file}" "${ source_dir}")
list ( APPEND cmd ${ CMAKE_COMMAND } -P ${ stamp_dir } /extract- ${ name } .cmake )
list ( APPEND cmd ${ CMAKE_COMMAND } -P ${ stamp_dir } /extract- ${ name } .cmake )
endif ( )
endif ( )
else ( )
else ( )
message ( SEND_ERROR "error: no download info for '${name}' -- please specify existing SOURCE_DIR or one of URL, CVS_REPOSITORY and CVS_MODULE, SVN_REPOSITORY or DOWNLOAD_COMMAND" )
_ep_is_dir_empty ( "${source_dir}" empty )
if ( ${ empty } )
message ( SEND_ERROR "error: no download info for '${name}' -- please specify existing/non-empty SOURCE_DIR or one of URL, CVS_REPOSITORY and CVS_MODULE, SVN_REPOSITORY, GIT_REPOSITORY or DOWNLOAD_COMMAND" )
endif ( )
endif ( )
endif ( )
ExternalProject_Add_Step ( ${ name } download
ExternalProject_Add_Step ( ${ name } download
@ -734,6 +923,7 @@ function(_ep_add_update_command name)
get_property ( cmd TARGET ${ name } PROPERTY _EP_UPDATE_COMMAND )
get_property ( cmd TARGET ${ name } PROPERTY _EP_UPDATE_COMMAND )
get_property ( cvs_repository TARGET ${ name } PROPERTY _EP_CVS_REPOSITORY )
get_property ( cvs_repository TARGET ${ name } PROPERTY _EP_CVS_REPOSITORY )
get_property ( svn_repository TARGET ${ name } PROPERTY _EP_SVN_REPOSITORY )
get_property ( svn_repository TARGET ${ name } PROPERTY _EP_SVN_REPOSITORY )
get_property ( git_repository TARGET ${ name } PROPERTY _EP_GIT_REPOSITORY )
set ( work_dir )
set ( work_dir )
set ( comment )
set ( comment )
@ -757,7 +947,25 @@ function(_ep_add_update_command name)
set ( work_dir ${ source_dir } )
set ( work_dir ${ source_dir } )
set ( comment "Performing update step (SVN update) for '${name}'" )
set ( comment "Performing update step (SVN update) for '${name}'" )
get_property ( svn_revision TARGET ${ name } PROPERTY _EP_SVN_REVISION )
get_property ( svn_revision TARGET ${ name } PROPERTY _EP_SVN_REVISION )
set ( cmd ${ Subversion_SVN_EXECUTABLE } up ${ svn_revision } )
get_property ( svn_username TARGET ${ name } PROPERTY _EP_SVN_USERNAME )
get_property ( svn_password TARGET ${ name } PROPERTY _EP_SVN_PASSWORD )
set ( cmd ${ Subversion_SVN_EXECUTABLE } up ${ svn_revision }
- - u s e r n a m e = $ { s v n _ u s e r n a m e } - - p a s s w o r d = $ { s v n _ p a s s w o r d } )
set ( always 1 )
elseif ( git_repository )
if ( NOT GIT_EXECUTABLE )
message ( FATAL_ERROR "error: could not find git for fetch of ${name}" )
endif ( )
set ( work_dir ${ source_dir } )
set ( comment "Performing update step (git fetch) for '${name}'" )
get_property ( git_tag TARGET ${ name } PROPERTY _EP_GIT_TAG )
if ( NOT git_tag )
set ( git_tag "master" )
endif ( )
set ( cmd ${ GIT_EXECUTABLE } fetch
C O M M A N D $ { G I T _ E X E C U T A B L E } c h e c k o u t $ { g i t _ t a g }
C O M M A N D $ { G I T _ E X E C U T A B L E } s u b m o d u l e u p d a t e - - r e c u r s i v e
)
set ( always 1 )
set ( always 1 )
endif ( )
endif ( )
@ -793,7 +1001,7 @@ endfunction(_ep_add_patch_command)
# T O D O : M a k e s u r e e x t e r n a l p r o j e c t s u s e t h e p r o p e r c o m p i l e r
# T O D O : M a k e s u r e e x t e r n a l p r o j e c t s u s e t h e p r o p e r c o m p i l e r
function ( _ep_add_configure_command name )
function ( _ep_add_configure_command name )
ExternalProject_Get_Property ( ${ name } source_dir binary_dir )
ExternalProject_Get_Property ( ${ name } source_dir binary_dir tmp_dir )
_ep_get_configuration_subdir_suffix ( cfgdir )
_ep_get_configuration_subdir_suffix ( cfgdir )
@ -827,6 +1035,16 @@ function(_ep_add_configure_command name)
endif ( )
endif ( )
endif ( )
endif ( )
# I f a n y t h i n g a b o u t t h e c o n f i g u r e c o m m a n d c h a n g e s , ( c o m m a n d i t s e l f , c m a k e
# u s e d , c m a k e a r g s o r c m a k e g e n e r a t o r ) t h e n r e - r u n t h e c o n f i g u r e s t e p .
# F i x e s i s s u e h t t p : / / p u b l i c . k i t w a r e . c o m / B u g / v i e w . p h p ? i d = 1 0 2 5 8
#
if ( NOT EXISTS ${ tmp_dir } / ${ name } -cfgcmd.txt.in )
file ( WRITE ${ tmp_dir } / ${ name } -cfgcmd.txt.in "cmd='@cmd@'\n" )
endif ( )
configure_file ( ${ tmp_dir } / ${ name } -cfgcmd.txt.in ${ tmp_dir } / ${ name } -cfgcmd.txt )
list ( APPEND file_deps ${ tmp_dir } / ${ name } -cfgcmd.txt )
ExternalProject_Add_Step ( ${ name } configure
ExternalProject_Add_Step ( ${ name } configure
C O M M A N D $ { c m d }
C O M M A N D $ { c m d }
W O R K I N G _ D I R E C T O R Y $ { b i n a r y _ d i r }
W O R K I N G _ D I R E C T O R Y $ { b i n a r y _ d i r }