mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-24 03:49:01 +08:00
[vcpkg] Improve create command to generate initial CONTROL file
This commit is contained in:
parent
cddc4f612e
commit
241ca8cd17
@ -39,16 +39,18 @@ macro(debug_message)
|
||||
endmacro()
|
||||
|
||||
if(CMD MATCHES "^CREATE$")
|
||||
file(TO_NATIVE_PATH ${VCPKG_ROOT_DIR} NATIVE_VCPKG_ROOT_DIR)
|
||||
file(TO_NATIVE_PATH ${DOWNLOADS} NATIVE_DOWNLOADS)
|
||||
if(EXISTS ports/${PORT}/portfile.cmake)
|
||||
message(FATAL_ERROR "Portfile already exists: '${VCPKG_ROOT_DIR}/ports/${PORT}/portfile.cmake'")
|
||||
message(FATAL_ERROR "Portfile already exists: '${NATIVE_VCPKG_ROOT_DIR}\\ports\\${PORT}\\portfile.cmake'")
|
||||
endif()
|
||||
if(NOT FILENAME)
|
||||
get_filename_component(FILENAME "${URL}" NAME)
|
||||
endif()
|
||||
string(REGEX REPLACE "(\\.(zip|gz|tar|tgz|bz2))+\$" "" ROOT_NAME ${FILENAME})
|
||||
if(EXISTS ${DOWNLOADS}/${FILENAME})
|
||||
message(STATUS "Using pre-downloaded: ${DOWNLOADS}/${FILENAME}")
|
||||
message(STATUS "If this is not desired, delete the file and ${VCPKG_ROOT_DIR}/ports/${PORT}/portfile.cmake")
|
||||
message(STATUS "Using pre-downloaded: ${NATIVE_DOWNLOADS}\\${FILENAME}")
|
||||
message(STATUS "If this is not desired, delete the file and ${NATIVE_VCPKG_ROOT_DIR}\\ports\\${PORT}")
|
||||
else()
|
||||
include(vcpkg_download_distfile)
|
||||
file(DOWNLOAD ${URL} ${DOWNLOADS}/${FILENAME} STATUS error_code)
|
||||
@ -60,8 +62,12 @@ if(CMD MATCHES "^CREATE$")
|
||||
|
||||
file(MAKE_DIRECTORY ports/${PORT})
|
||||
configure_file(scripts/templates/portfile.in.cmake ports/${PORT}/portfile.cmake @ONLY)
|
||||
configure_file(scripts/templates/CONTROL.in ports/${PORT}/CONTROL @ONLY)
|
||||
|
||||
message(STATUS "Generated portfile: ${VCPKG_ROOT_DIR}/ports/${PORT}/portfile.cmake")
|
||||
message(STATUS "Generated portfile: ${NATIVE_VCPKG_ROOT_DIR}\\ports\\${PORT}\\portfile.cmake")
|
||||
message(STATUS "Generated CONTROL: ${NATIVE_VCPKG_ROOT_DIR}\\ports\\${PORT}\\CONTROL")
|
||||
message(STATUS "To launch an editor for these new files, run")
|
||||
message(STATUS " vcpkg edit ${PORT}")
|
||||
elseif(CMD MATCHES "^BUILD$")
|
||||
if(NOT DEFINED CURRENT_PORT_DIR)
|
||||
message(FATAL_ERROR "CURRENT_PORT_DIR was not defined")
|
||||
|
3
scripts/templates/CONTROL.in
Normal file
3
scripts/templates/CONTROL.in
Normal file
@ -0,0 +1,3 @@
|
||||
Source: @PORT@
|
||||
Version:
|
||||
Description:
|
Loading…
Reference in New Issue
Block a user