[CMake] Proposal for new generator options

John Drescher drescherjm at gmail.com
Sat Jan 16 11:49:31 EST 2010


> Now it works, I have upgraded to 2.8.0 and switched to "Advanced View".
> Since I have to start the tool, change it for debug and release and then
> re-generate
> I still think it could be done easier, especially without needing to ask in
> this mailing list.
> How do all these dummy windows users find out that they have to change
> /MD to /MT if they are used to changing this with a setting inside the
> graphical IDE?
>

I would suspect that most users use the default values. I pretty much
go with the defaults with the addition of adding the /MP parameter
inside my main CMakeLists.txt file. To avoid any problems with other
users not having the right .dll runtimes I just have CMake bundle the
runtime with the install it generates.

Here is what I have in my packaging for my current application:

IF(PACKAGE_FOR_INSTALL)

SET(CPACK_PACKAGE_VERSION_MAJOR ${StudyManager_VERSION_MAJOR})
SET(CPACK_PACKAGE_VERSION_MINOR ${StudyManager_VERSION_MINOR})
SET(CPACK_PACKAGE_VERSION_PATCH ${StudyManager_VERSION_PATCH})

IF(CMAKE_CL_64)
     SET(CMAKE_MSVC_ARCH amd64)
   ELSE(CMAKE_CL_64)
     SET(CMAKE_MSVC_ARCH x86)
ENDIF(CMAKE_CL_64)

IF(MSVC80)

    FIND_PROGRAM(MSVC_REDIST NAMES
vcredist_${CMAKE_MSVC_ARCH}/vcredist_${CMAKE_MSVC_ARCH}.exe
      PATHS
      "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0;InstallDir]/../../SDK/v2.0/BootStrapper/Packages/"
      "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\VisualStudio\\8.0;InstallDir]/../../SDK/v2.0/BootStrapper/Packages/"
      )
    GET_FILENAME_COMPONENT(vcredist_name "${MSVC_REDIST}" NAME)
    INSTALL(PROGRAMS ${MSVC_REDIST} COMPONENT Runtime DESTINATION bin)
    SET(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "ExecWait
'\\\"$INSTDIR\\\\bin\\\\${vcredist_name}\\\"'")
ENDIF(MSVC80)

IF(WIN32)
	SET(CPACK_NSIS_COMPRESSOR "/SOLID lzma")
	SET(CPACK_PACKAGE_EXECUTABLES "StudyManager")

	INSTALL(FILES
			"${QT_BINARY_DIR}/QtCore${QT_VERSION_MAJOR}.dll"
			"${QT_BINARY_DIR}/QtXml${QT_VERSION_MAJOR}.dll"
			"${QT_BINARY_DIR}/QtTest${QT_VERSION_MAJOR}.dll"
			"${QT_BINARY_DIR}/QtGui${QT_VERSION_MAJOR}.dll"
			"${QT_BINARY_DIR}/QtNetwork${QT_VERSION_MAJOR}.dll"
			"${QT_BINARY_DIR}/QtScript${QT_VERSION_MAJOR}.dll"
			"${QT_BINARY_DIR}/QtSql${QT_VERSION_MAJOR}.dll"
			DESTINATION bin
			COMPONENT Applications
	)
ENDIF(WIN32)

set(CPACK_COMPONENTS_ALL Applications Runtime)

INCLUDE(CPack)
ENDIF(PACKAGE_FOR_INSTALL)


More information about the CMake mailing list