I think you may be right. CMAKE_INSTALL_CONFIG_NAME doesn't contain a value when I run a fresh build of the PACKAGE project in Visual Studio.

If it isn't possible to tell CPack what build configuration the user chooses in the IDE is there any way to have it just package the required DLLs automatically, without having to manually specify their paths? CPack will package the correct versions of the executables, and even the .libs if I choose, but I can't figure out how to get .dll files packaged at all.

On 6/9/2011 8:50 PM, J Decker wrote:
You probably need to escape it...  so it is kept as
${CMAKE_INSTALL_CONFIG_NAME}

or I think it only ends up working for the initial configuration
chosen when the .sln is made...



On Thu, Jun 9, 2011 at 6:22 PM, J Decker<d3c...@gmail.com>  wrote:
if(SUPPORTS_PARALLEL_BUILD_TYPE)

  CMAKE_INSTALL_CONFIG_NAME is set to the current configuration name
(DEbug, release, minsizerel) as chosen in the visual studio
environment.... so to choose which you build - you choose which you
build.

It doesn't package multiple configurations at once into a single NSIS,
but it will package any single configuration.

?

On Thu, Jun 9, 2011 at 2:12 PM, Jason Gochanour<jrgoc...@lanl.gov>  wrote:
I've managed to get an NSIS project up and running in VIsual Studio with
CPack, but I can't figure out how to determine which configuration type is
being built.  Is it possible to write up a CMakeLists that will run through
different conditionals based off of the Build Configuration Type selected in
Visual Studio?  If a user selects a Debug build I'd like to be able to tell
the installer to be built with the Debug libraries instead of the Release.

That is what it does. When debug is selected in Visual Studio and you
build the PACKAGE project it will build this using debug libs.

John

Thank you for the response John.  When I first setup CPack it built both
Release and Debug, but it didn't package the required DLLs in the
installer.  I did some searching and came across the "GetPrerequisites"
module.  I had this scan the executables I wanted to package up to create a
list of the DLLs I needed.  I had to manually specify the directory however,
because I'm not sure how to tell CPack what configuration the user wants to
build.  I have a feeling there's a better way around this, but I haven't
figure it out yet.

Here's the code for one of the executables in the package.

########## INSTALLER ##########
IF(INSTALLER_WITH_PROGRAM)
     # Add Microsoft DLLs to Installer
     INCLUDE(InstallRequiredSystemLibraries)
     include(GetPrerequisites)
     # Clear Path Variable
     set(PATH_TO_FILE "${PATH_TO_FILE}-NOTFOUND")
     set(DLL "DLL-NOTFOUND")
     # Scan the executable for required DLLs
     IF(EXISTS "${EXECUTABLE_OUTPUT_PATH}/Release/Program.exe")
         GET_PREREQUISITES("${EXECUTABLE_OUTPUT_PATH}/Release/Program.exe"
DEPENDENCIES 1 1 "" "")
         # Scan for each DLL
         FOREACH(DEPENDENCY ${DEPENDENCIES})
             FOREACH(PATH_TO_FILE ${CMAKE_MODULE_PATH})
                 find_file(DLL ${DEPENDENCY} "${PATH_TO_FILE}/bin"})
             ENDFOREACH(PATH_TO_FILE)

             # Add discovered DLL to Installer
             install(FILES ${DLL} DESTINATION "bin" )
             # Reset DLL Variable
             set(DLL "DLL-NOTFOUND")
         ENDFOREACH(DEPENDENCY)
         # Add Release TS Executable
         install(TARGETS Program RUNTIME DESTINATION "bin")
     ELSE()
         message("Please build ${EXECUTABLE_OUTPUT_PATH}/Release/Program.exe
and run CMake again.")
     ENDIF(EXISTS "${EXECUTABLE_OUTPUT_PATH}/Release/Program.exe")
ENDIF(INSTALLER_WITH_PROGRAM)

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to