source: tol/TestCMake/TestFileDownload/CMakeLists.txt @ f859796

1941-docker-image-to-testdevel
Last change on this file since f859796 was f859796, checked in by Jorge Pérez <josp.jorge@…>, 11 years ago

pruebas aisladas cno cmake

git-svn-id: ​https://www.tol-project.org/svn/tolp/trunk@7074 be4846ae-f051-483a-831f-b64e7d08527f

  • Property mode set to 100644
File size: 2.1 KB
Line 
1cmake_minimum_required(VERSION 2.8)
2project( TestDownload )
3
4function( get_tol_plat var )
5  if( CMAKE_SIZEOF_VOID_P EQUAL 4 )
6    set( tol_ps 32 )
7  elseif( CMAKE_SIZEOF_VOID_P EQUAL 8 )
8    set( tol_ps 64 )
9  else( )
10    message( WARNING "Could not determine pointer size because CMAKE_SIZEOF_VOID_P=${CMAKE_SIZEOF_VOID_P}" )
11    set( ${var} "unknown" PARENT_SCOPE )
12    return()   
13  endif( )
14  string( TOUPPER ${CMAKE_SYSTEM_NAME} _system )
15  if( UNIX )
16    if( _system STREQUAL "LINUX" )
17      set( ${var} "Linux${tol_ps}GNU" PARENT_SCOPE )
18      return()
19    else( )
20      message( WARNING "Could not determine TOL platform for system ${CMAKE_SYSTEM_NAME}" )
21      set( ${var} "unknown" PARENT_SCOPE )
22      return()
23    endif( )
24  elseif( MINGW )
25    set( ${var} "Win${tol_ps}GNU" )
26  else( MINGW )
27    message( WARNING "Could not determine TOL platform for system ${CMAKE_SYSTEM_NAME}" )
28    set( ${var} "unknown" PARENT_SCOPE )
29    return()
30  endif( UNIX )
31endfunction( get_tol_plat )
32
33function( download_tol_package pkg bin )
34  set( url "http://packages.tol-project.org/OfficialTolArchiveNetwork/repository.php?action=download&format=attachment&tol_package_version=4&package=${pkg}" )
35  if ( WGET_FOUND )
36    if( bin )
37      get_tol_plat( tol_plat )
38      set( url "${url}%23${tol_plat}" )
39    endif( )
40    message( "going to download last version of ${pkg} ..." )
41    execute_process(
42      COMMAND ${WGET_EXECUTABLE} --content-disposition "${url}"
43      OUTPUT_VARIABLE WGET_OUTPUT
44      ERROR_VARIABLE IGNORE_ERROR
45      OUTPUT_STRIP_TRAILING_WHITESPACE )
46  else( WGET_FOUND )
47    message( WARNING "Could not download package ${pkg} because wget command is not available" )
48  endif( WGET_FOUND )
49endfunction( download_tol_package )
50
51find_package( Wget )
52if ( WGET_FOUND )
53  download_tol_package( StdLib 0 )
54  download_tol_package( TclCore 1 )
55  message( "${CMAKE_CURRENT_BINARY_DIR}/*.zip.1" )
56  file( GLOB zip_copies "${CMAKE_CURRENT_BINARY_DIR}/*.zip.1" )
57  message( STATUS "zip_copies = ${zip_copies}" )
58  foreach( f ${zip_copies} )
59    string( REPLACE ".zip.1" ".zip" f_zip ${f} )
60    file( REMOVE ${f_zip} )
61    file( RENAME ${f} ${f_zip} )
62  endforeach( )
63endif( WGET_FOUND )
64
Note: See TracBrowser for help on using the repository browser.