On Fri, Jun 10, 2011 at 11:02 AM, Jason Gochanour <<a href="mailto:jrgochan@lanl.gov">jrgochan@lanl.gov</a>> wrote:<br>> I think you may be right. CMAKE_INSTALL_CONFIG_NAME doesn't contain a value<br>> when I run a fresh build of the PACKAGE project in Visual Studio.<br>
><br>> If it isn't possible to tell CPack what build configuration the user chooses<br>> in the IDE is there any way to have it just package the required DLLs<br>> automatically, without having to manually specify their paths? CPack will<br>
> package the correct versions of the executables, and even the .libs if I<br>> choose, but I can't figure out how to get .dll files packaged at all.<br>><br>> On 6/9/2011 8:50 PM, J Decker wrote:<br>>><br>
>> You probably need to escape it... so it is kept as<br>>> ${CMAKE_INSTALL_CONFIG_NAME}<br>>><br>>> or I think it only ends up working for the initial configuration<br>>> chosen when the .sln is made...<br>
>><br>>><br>>><br>>> On Thu, Jun 9, 2011 at 6:22 PM, J Decker<<a href="mailto:d3ck0r@gmail.com">d3ck0r@gmail.com</a>> wrote:<br>>>><br>>>> if(SUPPORTS_PARALLEL_BUILD_TYPE)<br>
>>><br>>>> CMAKE_INSTALL_CONFIG_NAME is set to the current configuration name<br>>>> (DEbug, release, minsizerel) as chosen in the visual studio<br>>>> environment.... so to choose which you build - you choose which you<br>
>>> build.<br>>>><br>>>> It doesn't package multiple configurations at once into a single NSIS,<br>>>> but it will package any single configuration.<br>>>><br>>>> ?<br>
>>><br>>>> On Thu, Jun 9, 2011 at 2:12 PM, Jason Gochanour<<a href="mailto:jrgochan@lanl.gov">jrgochan@lanl.gov</a>><br>>>> wrote:<br>>>>><br>>>>> I've managed to get an NSIS project up and running in VIsual Studio with<br>
>>>> CPack, but I can't figure out how to determine which configuration type<br>>>>> is<br>>>>> being built. Is it possible to write up a CMakeLists that will run<br>>>>> through<br>
>>>> different conditionals based off of the Build Configuration Type<br>>>>> selected in<br>>>>> Visual Studio? If a user selects a Debug build I'd like to be able to<br>>>>> tell<br>
>>>> the installer to be built with the Debug libraries instead of the<br>>>>> Release.<br>>>>><br>>>>> That is what it does. When debug is selected in Visual Studio and you<br>
>>>> build the PACKAGE project it will build this using debug libs.<br>>>>><br>>>>> John<br>>>>><br>>>>> Thank you for the response John. When I first setup CPack it built both<br>
>>>> Release and Debug, but it didn't package the required DLLs in the<br>>>>> installer. I did some searching and came across the "GetPrerequisites"<br>>>>> module. I had this scan the executables I wanted to package up to<br>
>>>> create a<br>>>>> list of the DLLs I needed. I had to manually specify the directory<br>>>>> however,<br>>>>> because I'm not sure how to tell CPack what configuration the user wants<br>
>>>> to<br>>>>> build. I have a feeling there's a better way around this, but I haven't<br>>>>> figure it out yet.<br>>>>><br>>>>> Here's the code for one of the executables in the package.<br>
>>>><br>>>>> ########## INSTALLER ##########<br>>>>> IF(INSTALLER_WITH_PROGRAM)<br>>>>> # Add Microsoft DLLs to Installer<br>>>>> INCLUDE(InstallRequiredSystemLibraries)<br>
>>>> include(GetPrerequisites)<br>>>>> # Clear Path Variable<br>>>>> set(PATH_TO_FILE "${PATH_TO_FILE}-NOTFOUND")<br>>>>> set(DLL "DLL-NOTFOUND")<br>
>>>> # Scan the executable for required DLLs<br>>>>> IF(EXISTS "${EXECUTABLE_OUTPUT_PATH}/Release/Program.exe")<br>>>>> <br>>>>> GET_PREREQUISITES("${EXECUTABLE_OUTPUT_PATH}/Release/Program.exe"<br>
>>>> DEPENDENCIES 1 1 "" "")<br>>>>> # Scan for each DLL<br>>>>> FOREACH(DEPENDENCY ${DEPENDENCIES})<br>>>>> FOREACH(PATH_TO_FILE ${CMAKE_MODULE_PATH})<br>
>>>> find_file(DLL ${DEPENDENCY} "${PATH_TO_FILE}/bin"})<br>>>>> ENDFOREACH(PATH_TO_FILE)<br>>>>><br>>>>> # Add discovered DLL to Installer<br>
>>>> install(FILES ${DLL} DESTINATION "bin" )<br>>>>> # Reset DLL Variable<br>>>>> set(DLL "DLL-NOTFOUND")<br>>>>> ENDFOREACH(DEPENDENCY)<br>
>>>> # Add Release TS Executable<br>>>>> install(TARGETS Program RUNTIME DESTINATION "bin")<br>>>>> ELSE()<br>>>>> message("Please build<br>
>>>> ${EXECUTABLE_OUTPUT_PATH}/Release/Program.exe<br>>>>> and run CMake again.")<br>>>>> ENDIF(EXISTS "${EXECUTABLE_OUTPUT_PATH}/Release/Program.exe")<br>>>>> ENDIF(INSTALLER_WITH_PROGRAM)<br>
>>>><br>>>>> _______________________________________________<br>>>>> Powered by <a href="http://www.kitware.com">www.kitware.com</a><br>>>>><br>>>>> Visit other Kitware open-source projects at<br>
>>>> <a href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><br>>>>><br>>>>> Please keep messages on-topic and check the CMake FAQ at:<br>
>>>> <a href="http://www.cmake.org/Wiki/CMake_FAQ">http://www.cmake.org/Wiki/CMake_FAQ</a><br>>>>><br>>>>> Follow this link to subscribe/unsubscribe:<br>>>>> <a href="http://www.cmake.org/mailman/listinfo/cmake">http://www.cmake.org/mailman/listinfo/cmake</a><br>
>>>><br>> _______________________________________________<br>> Powered by <a href="http://www.kitware.com">www.kitware.com</a><br>><br>> Visit other Kitware open-source projects at<br>> <a href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><br>
><br>> Please keep messages on-topic and check the CMake FAQ at:<br>> <a href="http://www.cmake.org/Wiki/CMake_FAQ">http://www.cmake.org/Wiki/CMake_FAQ</a><br>><br>> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://www.cmake.org/mailman/listinfo/cmake">http://www.cmake.org/mailman/listinfo/cmake</a><br>><br><br><br>What version of CMake are you using? At the top of the latest InstallRequiredSystemLibraries.cmake are the following comments:<br>
<br> # If CMAKE_INSTALL_DEBUG_LIBRARIES is set and it is the MSVC<br> # compiler, then the debug libraries are installed when available.<br> # If CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY is set then only the debug<br> # libraries are installed when both debug and release are available.<br>
<div><br></div><div>The problem is: the debug libraries for MSVC are not redistributable. You're not *supposed* to package them from a legal/licensing standpoint. You may still build an installer that installs them if you set the above referenced variables before including InstallRequiredSystemLibraries, but you have to make the conscious choice to do so.</div>
<div><br></div><div>The assumption is that anybody who needs to debug the program will have MSVC installed themselves, and will therefore also have the debug libraries installed. I'd recommend going with that approach over packaging the libs into an installer.</div>
<div><br></div><div><br></div><div>HTH,</div><div>David</div><div><br></div>