2010/8/31 David Cole <[email protected]>:
> Steps 7 thru 10 on your list may be performed by the command lines:
> cmake --build . --config Release
> cmake --build . --target install --config Release
> (equivalent to the "make; make install" parts of your example command
> line)
> Causing that to happen in delicious GUI form would be simple enough... But
> do enough people want this...?
Speaking for a one-line install (or buid package) command
using CMake would be nice.
I did craft one small (not bulletproof at all) CMake script
which can be called as
$ cmake -P CMake-autoinstall.cmake
-- Trying to autoinstall CMake version using
http://www.cmake.org/files/v2.8/cmake-2.8.2.tar.gz file...
-- Downloading...
-- Already there: nothing to do
-- Unarchiving the file
-- CMake version 2.8.2 has been unarchived in /home/eric/CMake/tmp/cmake-2.8.2.
-- Configuring with CMake...
-- Building with cmake --build ...
-- Create package RPM with CPack...
-- CMake version 2.8.2 has been built in /home/eric/CMake/tmp/cmake-2.8.2.
-- CMake package(s) are:
/home/eric/CMake/tmp/cmake-2.8.2-build/cmake-2.8.2-Linux-x86_64.rpm
The example file is attached. It does not handle error case very nicely
and should probable put all logs in files instead of var.
In my case the "autoinstall" file is building an RPM and in my case I don't
want the 3) to 5) steps (default configure option should be enough).
May be a GUI would help to chose some parameters of the "autoinstall script"
version, CPack generator etc... but I don't think it must be the current
"cmake-gui".
> We've talked about a "build" button in the cmake-gui before, but if errors
> occur, you have to go elsewhere to edit code anyhow.
> If we have a build button, we have to:
> - make sure we handle voluminous output from the build tools
> - provide a way to interrupt a build in progress when the observer can't
> wait any longer...
> It shouldn't be hard, but it's not entirely trivial either. Deliciousness
> never is.
My opinion is that "automagicall one big button (or small script) makes it all"
shouldn't handle error case at all.
Average user won't go and inspect why it fails.
He would probably just tell the project releaser that he/she did a poor job
and wait for him/her to fix that :-)
> What do others think? Is this a thing you've always wanted, or something
> you've never even wished for...?
One-line install command (or one button)
would be great but I think that if for any reason the automagic process
fails don't try to help the user with that but just point out the error file.
If it's a "power user" he will go back to current cmake UI.
If it's an average user he may file the error file back to the project releaser.
--
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org
# Simple cmake script which may be used to autoinstall
# cmake from automatically downloaded source
#
# cd tmp/
# cmake -P CMake-autoinstall.cmake
# you should end up with a
# tmp/cmake-x.y.z source tree
# tmp/cmake-x.y.z-build build tree
# configure and compiled tree, using the tarball found on Kitware.
cmake_minimum_required(VERSION 2.6)
set(CMAKE_VERSION "2.8.2")
set(CMAKE_FILE_PREFIX "cmake-${CMAKE_VERSION}")
set(CMAKE_REMOTE_PREFIX "http://www.cmake.org/files/v2.8/")
set(CMAKE_FILE_SUFFIX ".tar.gz")
set(CPACK_GEN "RPM")
set(LOCAL_FILE "./${CMAKE_FILE_PREFIX}${CMAKE_FILE_SUFFIX}")
set(REMOTE_FILE "${CMAKE_REMOTE_PREFIX}${CMAKE_FILE_PREFIX}${CMAKE_FILE_SUFFIX}")
message(STATUS "Trying to autoinstall CMake version ${VERSION} using ${REMOTE_FILE} file...")
message(STATUS "Downloading...")
if (EXISTS ${LOCAL_FILE})
message(STATUS "Already there: nothing to do")
else (EXISTS ${LOCAL_FILE})
message(STATUS "Not there, trying to download...")
file(DOWNLOAD ${REMOTE_FILE} ${LOCAL_FILE}
TIMEOUT 600
STATUS DL_STATUS
LOG DL_LOG)
list(GET DL_STATUS 0 DL_NOK)
if ("${DL_LOG}" MATCHES "404 Not Found")
set(DL_NOK 1)
endif ("${DL_LOG}" MATCHES "404 Not Found")
if (DL_NOK)
# we shall remove the file because it is created
# with an inappropriate content
file(REMOVE ${LOCAL_FILE})
message(SEND_ERROR "Download failed: ${DL_LOG}")
else (DL_NOK)
message(STATUS "Download successful.")
endif (DL_NOK)
endif (EXISTS ${LOCAL_FILE})
message(STATUS "Unarchiving the file")
execute_process(COMMAND ${CMAKE_COMMAND} -E tar zxvf ${LOCAL_FILE}
RESULT_VARIABLE UNTAR_RES
OUTPUT_VARIABLE UNTAR_OUT
ERROR_VARIABLE UNTAR_ERR
)
message(STATUS "CMake version ${CMAKE_VERSION} has been unarchived in ${CMAKE_CURRENT_SOURCE_DIR}/${CMAKE_FILE_PREFIX}.")
message(STATUS "Configuring with CMake...")
file(MAKE_DIRECTORY ${CMAKE_FILE_PREFIX}-build)
execute_process(COMMAND ${CMAKE_COMMAND} ../${CMAKE_FILE_PREFIX}
WORKING_DIRECTORY ${CMAKE_FILE_PREFIX}-build
RESULT_VARIABLE CONFIG_RES
OUTPUT_VARIABLE CONFIG_OUT
ERROR_VARIABLE CONFIG_ERR
TIMEOUT 200
)
message(STATUS "Building with cmake --build ...")
execute_process(COMMAND ${CMAKE_COMMAND} --build .
WORKING_DIRECTORY ${CMAKE_FILE_PREFIX}-build
RESULT_VARIABLE CONFIG_RES
OUTPUT_VARIABLE CONFIG_OUT
ERROR_VARIABLE CONFIG_ERR
)
message(STATUS "Create package ${CPACK_GEN} with CPack...")
execute_process(COMMAND ${CMAKE_CPACK_COMMAND} -G ${CPACK_GEN}
WORKING_DIRECTORY ${CMAKE_FILE_PREFIX}-build
RESULT_VARIABLE CONFIG_RES
OUTPUT_VARIABLE CONFIG_OUT
ERROR_VARIABLE CONFIG_ERR
)
message(STATUS "CMake version ${CMAKE_VERSION} has been built in ${CMAKE_CURRENT_SOURCE_DIR}/${CMAKE_FILE_PREFIX}.")
string(REGEX MATCH "CPack: - package:(.*)generated" PACKAGES "${CONFIG_OUT}")
message(STATUS "CMake package(s) are: ${CMAKE_MATCH_1}")_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake