Explorar el Código

Merge topic 'cmake-install-dependencies-option'

068e7962 CMake: Add CMake_INSTALL_DEPENDENCIES option
Brad King hace 10 años
padre
commit
eb2b23e0d9
Se han modificado 3 ficheros con 10 adiciones y 3 borrados
  1. 3 1
      CMakeCPack.cmake
  2. 5 0
      CMakeLists.txt
  3. 2 2
      Source/QtDialog/CMakeLists.txt

+ 3 - 1
CMakeCPack.cmake

@@ -22,7 +22,9 @@ if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
       set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS ON)
     endif()
 
-    include(${CMake_SOURCE_DIR}/Modules/InstallRequiredSystemLibraries.cmake)
+    if(CMake_INSTALL_DEPENDENCIES)
+      include(${CMake_SOURCE_DIR}/Modules/InstallRequiredSystemLibraries.cmake)
+    endif()
   endif()
 
   set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "CMake is a build tool")

+ 5 - 0
CMakeLists.txt

@@ -70,6 +70,11 @@ macro(CMake_OPTIONAL_COMPONENT NAME)
   endif()
 endmacro()
 
+# option to disable installing 3rd-party dependencies
+option(CMake_INSTALL_DEPENDENCIES
+  "Whether to install 3rd-party runtime dependencies" ON)
+mark_as_advanced(CMake_INSTALL_DEPENDENCIES)
+
 #-----------------------------------------------------------------------
 # a macro to deal with system libraries, implemented as a macro
 # simply to improve readability of the main script

+ 2 - 2
Source/QtDialog/CMakeLists.txt

@@ -39,7 +39,7 @@ if (Qt5Widgets_FOUND)
   # We need to install platform plugin and add qt.conf for Qt5 on Mac and Windows.
   # FIXME: This should be part of Qt5 CMake scripts, but unfortunatelly
   # Qt5 support is missing there.
-  if(APPLE OR WIN32)
+  if(CMake_INSTALL_DEPENDENCIES AND (APPLE OR WIN32))
     macro(install_qt5_plugin _qt_plugin_name _qt_plugins_var)
       get_target_property(_qt_plugin_path "${_qt_plugin_name}" LOCATION)
       if(EXISTS "${_qt_plugin_path}")
@@ -213,7 +213,7 @@ if(APPLE)
   " ${COMPONENT})
 endif()
 
-if(APPLE OR WIN32)
+if(CMake_INSTALL_DEPENDENCIES AND (APPLE OR WIN32))
   # install rules for including 3rd party libs such as Qt
   # if a system Qt is used (e.g. installed in /usr/lib/), it will not be included in the installation
   set(fixup_exe "\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/bin/cmake-gui${CMAKE_EXECUTABLE_SUFFIX}")