Merge topic 'bootstrap-select-system-libs'

bace650 bootstrap: Clarify --init flag documentation (#11431)
60d72b5 bootstrap: Granular system library selection (#11431)
This commit is contained in:
Brad King 2011-01-19 14:01:45 -05:00 committed by CMake Topic Stage
commit 1837276eb3
2 changed files with 70 additions and 34 deletions

View File

@ -16,6 +16,12 @@ IF(COMMAND CMAKE_POLICY)
CMAKE_POLICY(SET CMP0003 NEW)
ENDIF(COMMAND CMAKE_POLICY)
IF(CMAKE_BOOTSTRAP)
# Running from bootstrap script. Set local variable and remove from cache.
SET(CMAKE_BOOTSTRAP 1)
UNSET(CMAKE_BOOTSTRAP CACHE)
ENDIF()
MARK_AS_ADVANCED(CMAKE_BACKWARDS_COMPATIBILITY)
# Allow empty endif() and such with CMake 2.4.
@ -53,42 +59,47 @@ MACRO(CMAKE_HANDLE_SYSTEM_LIBRARIES)
OPTION(CTEST_USE_XMLRPC "Enable xmlrpc submission method in CTest." OFF)
MARK_AS_ADVANCED(CTEST_USE_XMLRPC)
# Allow the user to enable/disable all system utility library options
# by setting CMAKE_USE_SYSTEM_LIBRARIES on the command line.
IF(DEFINED CMAKE_USE_SYSTEM_LIBRARIES)
SET(CMAKE_USE_SYSTEM_LIBRARIES_USER 1)
ENDIF(DEFINED CMAKE_USE_SYSTEM_LIBRARIES)
IF(CMAKE_USE_SYSTEM_LIBRARIES)
SET(CMAKE_USE_SYSTEM_LIBRARIES ON)
ELSE(CMAKE_USE_SYSTEM_LIBRARIES)
SET(CMAKE_USE_SYSTEM_LIBRARIES OFF)
ENDIF(CMAKE_USE_SYSTEM_LIBRARIES)
IF(CMAKE_USE_SYSTEM_LIBRARIES_USER)
SET(CMAKE_USE_SYSTEM_CURL "${CMAKE_USE_SYSTEM_LIBRARIES}"
CACHE BOOL "Use system-installed curl" FORCE)
SET(CMAKE_USE_SYSTEM_EXPAT "${CMAKE_USE_SYSTEM_LIBRARIES}"
CACHE BOOL "Use system-installed expat" FORCE)
SET(CMAKE_USE_SYSTEM_ZLIB "${CMAKE_USE_SYSTEM_LIBRARIES}"
CACHE BOOL "Use system-installed zlib" FORCE)
SET(CMAKE_USE_SYSTEM_BZIP2 "${CMAKE_USE_SYSTEM_LIBRARIES}"
CACHE BOOL "Use system-installed bzip2" FORCE)
SET(CMAKE_USE_SYSTEM_LIBARCHIVE "${CMAKE_USE_SYSTEM_LIBRARIES}"
CACHE BOOL "Use system-installed libarchive" FORCE)
ENDIF(CMAKE_USE_SYSTEM_LIBRARIES_USER)
# Allow the user to enable/disable all system utility library options by
# defining CMAKE_USE_SYSTEM_LIBRARIES or CMAKE_USE_SYSTEM_LIBRARY_${util}.
SET(UTILITIES BZIP2 CURL EXPAT LIBARCHIVE ZLIB)
FOREACH(util ${UTILITIES})
IF(NOT DEFINED CMAKE_USE_SYSTEM_LIBRARY_${util}
AND DEFINED CMAKE_USE_SYSTEM_LIBRARIES)
SET(CMAKE_USE_SYSTEM_LIBRARY_${util} "${CMAKE_USE_SYSTEM_LIBRARIES}")
ENDIF()
IF(DEFINED CMAKE_USE_SYSTEM_LIBRARY_${util})
IF(CMAKE_USE_SYSTEM_LIBRARY_${util})
SET(CMAKE_USE_SYSTEM_LIBRARY_${util} ON)
ELSE()
SET(CMAKE_USE_SYSTEM_LIBRARY_${util} OFF)
ENDIF()
IF(CMAKE_BOOTSTRAP)
UNSET(CMAKE_USE_SYSTEM_LIBRARY_${util} CACHE)
ENDIF()
STRING(TOLOWER "${util}" lutil)
SET(CMAKE_USE_SYSTEM_${util} "${CMAKE_USE_SYSTEM_LIBRARY_${util}}"
CACHE BOOL "Use system-installed ${lutil}" FORCE)
ELSE()
SET(CMAKE_USE_SYSTEM_LIBRARY_${util} OFF)
ENDIF()
ENDFOREACH(util)
IF(CMAKE_BOOTSTRAP)
UNSET(CMAKE_USE_SYSTEM_LIBRARIES CACHE)
ENDIF()
# Optionally use system utility libraries.
OPTION(CMAKE_USE_SYSTEM_LIBARCHIVE "Use system-installed libarchive" ${CMAKE_USE_SYSTEM_LIBRARIES})
OPTION(CMAKE_USE_SYSTEM_LIBARCHIVE "Use system-installed libarchive" "${CMAKE_USE_SYSTEM_LIBRARY_LIBARCHIVE}")
CMAKE_DEPENDENT_OPTION(CMAKE_USE_SYSTEM_CURL "Use system-installed curl"
${CMAKE_USE_SYSTEM_LIBRARIES} "NOT CTEST_USE_XMLRPC" ON)
"${CMAKE_USE_SYSTEM_LIBRARY_CURL}" "NOT CTEST_USE_XMLRPC" ON)
CMAKE_DEPENDENT_OPTION(CMAKE_USE_SYSTEM_EXPAT "Use system-installed expat"
${CMAKE_USE_SYSTEM_LIBRARIES} "NOT CTEST_USE_XMLRPC" ON)
"${CMAKE_USE_SYSTEM_LIBRARY_EXPAT}" "NOT CTEST_USE_XMLRPC" ON)
CMAKE_DEPENDENT_OPTION(CMAKE_USE_SYSTEM_ZLIB "Use system-installed zlib"
${CMAKE_USE_SYSTEM_LIBRARIES} "NOT CMAKE_USE_SYSTEM_LIBARCHIVE;NOT CMAKE_USE_SYSTEM_CURL" ON)
"${CMAKE_USE_SYSTEM_LIBRARY_ZLIB}" "NOT CMAKE_USE_SYSTEM_LIBARCHIVE;NOT CMAKE_USE_SYSTEM_CURL" ON)
CMAKE_DEPENDENT_OPTION(CMAKE_USE_SYSTEM_BZIP2 "Use system-installed bzip2"
${CMAKE_USE_SYSTEM_LIBRARIES} "NOT CMAKE_USE_SYSTEM_LIBARCHIVE" ON)
"${CMAKE_USE_SYSTEM_LIBRARY_BZIP2}" "NOT CMAKE_USE_SYSTEM_LIBARCHIVE" ON)
# Mention to the user what system libraries are being used.
FOREACH(util BZIP2 CURL EXPAT LIBARCHIVE ZLIB)
FOREACH(util ${UTILITIES})
IF(CMAKE_USE_SYSTEM_${util})
MESSAGE(STATUS "Using system-installed ${util}")
ENDIF(CMAKE_USE_SYSTEM_${util})

View File

@ -26,6 +26,11 @@ cmake_date_stamp_component()
"
}
cmake_toupper()
{
echo "$1" | sed 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'
}
# Detect system and directory information.
cmake_system=`uname`
cmake_source_dir=`cd "\`dirname \"$0\"\`";pwd`
@ -294,11 +299,22 @@ Configuration:
--verbose display more information
--parallel=n bootstrap cmake in parallel, where n is
number of nodes [1]
--init=FILE use FILE for cmake initialization
--system-libs use system-installed third-party libraries
--init=FILE load FILE as script to populate cache
--system-libs use all system-installed third-party libraries
(for use only by package maintainers)
--no-system-libs use cmake-provided third-party libraries
--no-system-libs use all cmake-provided third-party libraries
(default)
--system-curl use system-installed curl library
--no-system-curl use cmake-provided curl library (default)
--system-expat use system-installed expat library
--no-system-expat use cmake-provided expat library (default)
--system-zlib use system-installed zlib library
--no-system-zlib use cmake-provided zlib library (default)
--system-bzip2 use system-installed bzip2 library
--no-system-bzip2 use cmake-provided bzip2 library (default)
--system-libarchive use system-installed libarchive library
--no-system-libarchive use cmake-provided libarchive library (default)
--qt-gui build the Qt-based GUI (requires Qt >= 4.2)
--no-qt-gui do not build the Qt-based GUI (default)
--qt-qmake=<qmake> use <qmake> as the qmake executable to find Qt
@ -528,11 +544,20 @@ for a in "$@"; do
if echo $a | grep "^--init=" > /dev/null 2> /dev/null; then
cmake_init_file=`echo $a | sed "s/^--init=//"`
fi
for lib in bzip2 curl expat libarchive zlib; do
if echo $a | grep "^--system-${lib}" > /dev/null 2> /dev/null; then
cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARY_`cmake_toupper ${lib}`=1"
break
elif echo $a | grep "^--no-system-${lib}" > /dev/null 2> /dev/null; then
cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARY_`cmake_toupper ${lib}`=0"
break
fi
done
if echo $a | grep "^--system-libs" > /dev/null 2> /dev/null; then
cmake_bootstrap_system_libs="-DCMAKE_USE_SYSTEM_LIBRARIES=1"
cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARIES=1"
fi
if echo $a | grep "^--no-system-libs" > /dev/null 2> /dev/null; then
cmake_bootstrap_system_libs="-DCMAKE_USE_SYSTEM_LIBRARIES=0"
cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARIES=0"
fi
if echo $a | grep "^--qt-gui" > /dev/null 2> /dev/null; then
cmake_bootstrap_qt_gui="1"
@ -1494,7 +1519,7 @@ export CXX
export MAKE
# Run bootstrap CMake to configure real CMake
"${cmake_bootstrap_dir}/cmake" "${cmake_source_dir}" "-C${cmake_bootstrap_dir}/InitialCacheFlags.cmake" "-G${cmake_bootstrap_generator}" ${cmake_bootstrap_system_libs}
"${cmake_bootstrap_dir}/cmake" "${cmake_source_dir}" "-C${cmake_bootstrap_dir}/InitialCacheFlags.cmake" "-G${cmake_bootstrap_generator}" -DCMAKE_BOOTSTRAP=1 ${cmake_bootstrap_system_libs}
RES=$?
if [ "${RES}" -ne "0" ]; then
cmake_error 11 "Problem while running initial CMake"