diff --git a/CMakeCPackOptions.cmake.in b/CMakeCPackOptions.cmake.in index 2a83e304b..0c1eac43b 100644 --- a/CMakeCPackOptions.cmake.in +++ b/CMakeCPackOptions.cmake.in @@ -1,4 +1,10 @@ +# This file is configured at cmake time, and loaded at cpack time. +# To pass variables to cpack from cmake, they must be configured +# in this file. + if(CPACK_GENERATOR MATCHES "NSIS") + SET(BUILD_QtDialog @BUILD_QtDialog@) + SET(CMAKE_QT_IS_STATIC @CMAKE_QT_IS_STATIC@) # set the install/unistall icon used for the installer itself # There is a bug in NSI that does not handle full unix paths properly. SET(CPACK_NSIS_MUI_ICON "@CMake_SOURCE_DIR@/Utilities/Release\\CMakeLogo.ico") @@ -27,6 +33,10 @@ if(CPACK_GENERATOR MATCHES "NSIS") SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\www.kitware.com") SET(CPACK_NSIS_CONTACT @CPACK_PACKAGE_CONTACT@) SET(CPACK_NSIS_MODIFY_PATH ON) + # only package cmake-gui if QT is static on windows + IF(BUILD_QtDialog AND CMAKE_QT_IS_STATIC) + SET(CPACK_PACKAGE_EXECUTABLES ${CPACK_PACKAGE_EXECUTABLES} "cmake-gui" "cmake-gui(beta)") + ENDIF(BUILD_QtDialog AND CMAKE_QT_IS_STATIC) endif(CPACK_GENERATOR MATCHES "NSIS") if(CPACK_GENERATOR MATCHES "CygwinSource") diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt index 9ed469ed3..65765399d 100644 --- a/Source/QtDialog/CMakeLists.txt +++ b/Source/QtDialog/CMakeLists.txt @@ -7,7 +7,9 @@ IF(NOT QT4_FOUND) ELSE(NOT QT4_FOUND) INCLUDE(${QT_USE_FILE}) - + IF(QT_CONFIG MATCHES "static") + SET(CMAKE_QT_IS_STATIC TRUE CACHE STATIC "") + ENDIF(QT_CONFIG MATCHES "static") SET(SRCS AddCacheEntry.cxx AddCacheEntry.h @@ -47,8 +49,14 @@ ELSE(NOT QT4_FOUND) ADD_EXECUTABLE(cmake-gui WIN32 MACOSX_BUNDLE ${SRCS}) TARGET_LINK_LIBRARIES(cmake-gui CMakeLib ${QT_QTMAIN_LIBRARY} ${QT_LIBRARIES}) - - INSTALL_TARGETS(/bin cmake-gui) + # if qt is not static and we are on windows then skip the install + # I don't want to distribute qt dlls + IF(WIN32 AND NOT CMAKE_QT_IS_STATIC) + SET(SKIP_INSTALL TRUE) + ENDIF(WIN32 AND NOT CMAKE_QT_IS_STATIC) + IF(NOT SKIP_INSTALL) + INSTALL_TARGETS(/bin cmake-gui) + ENDIF(NOT SKIP_INSTALL) ENDIF(NOT QT4_FOUND)