diff options
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 67 |
1 files changed, 39 insertions, 28 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 4508e33..37e0edc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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}) |