<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#ffffff" text="#000000">
    <br>
    <blockquote
      cite="mid:BANLkTinEeb2twX+xvadRx6kYOA+2V7_-GQ@mail.gmail.com"
      type="cite">
      <blockquote type="cite">
        <pre wrap="">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. &nbsp;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? &nbsp;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.

</pre>
      </blockquote>
      <pre wrap="">
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
</pre>
    </blockquote>
    Thank you for the response John.&nbsp; When I first setup CPack it built
    both Release and Debug, but it didn't package the required DLLs in
    the installer.&nbsp; I did some searching and came across the
    "GetPrerequisites" module.&nbsp; I had this scan the executables I wanted
    to package up to create a list of the DLLs I needed.&nbsp; I had to
    manually specify the directory however, because I'm not sure how to
    tell CPack what configuration the user wants to build.&nbsp; I have a
    feeling there's a better way around this, but I haven't figure it
    out yet.<br>
    <br>
    Here's the code for one of the executables in the package.<br>
    <br>
    <div class="moz-text-html" lang="x-western">
      <div><small><font face="Courier New">########## INSTALLER
            ##########</font></small></div>
      <div><small><font face="Courier New">IF(INSTALLER_WITH_PROGRAM)</font></small></div>
      <div><small><font face="Courier New"><br>
          </font></small></div>
      <div><small><font face="Courier New">&nbsp; &nbsp; # Add Microsoft DLLs to
            Installer</font></small></div>
      <div><small><font face="Courier New">&nbsp; &nbsp;
            INCLUDE(InstallRequiredSystemLibraries)</font></small></div>
      <div><small><font face="Courier New"><br>
          </font></small></div>
      <div><small><font face="Courier New">&nbsp; &nbsp; include(GetPrerequisites)</font></small></div>
      <small>
      </small>
      <div><small><font face="Courier New"><br>
          </font></small></div>
      <div><small><font face="Courier New">&nbsp; &nbsp; # Clear Path Variable</font></small></div>
      <div><small><font face="Courier New">&nbsp; &nbsp; set(PATH_TO_FILE
            "${PATH_TO_FILE}-NOTFOUND")</font></small></div>
      <div><small><font face="Courier New">&nbsp; &nbsp; set(DLL "DLL-NOTFOUND")</font></small></div>
      <div><small><font face="Courier New"><br>
          </font></small></div>
      <div><small><font face="Courier New">&nbsp; &nbsp; # Scan the executable for
            required DLLs</font></small></div>
      <small>
      </small>
      <div><small><font face="Courier New">&nbsp; &nbsp; IF(EXISTS
            "${EXECUTABLE_OUTPUT_PATH}/Release/Program.exe")</font></small></div>
      <div><small><font face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp;
            GET_PREREQUISITES("${EXECUTABLE_OUTPUT_PATH}/Release/Program.exe"
            DEPENDENCIES 1 1 "" "")</font></small></div>
      <div><small><font face="Courier New"><br>
          </font></small></div>
      <div><small><font face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; # Scan for each DLL</font></small></div>
      <div><small><font face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; FOREACH(DEPENDENCY
            ${DEPENDENCIES})</font></small></div>
      <div><small><font face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
            FOREACH(PATH_TO_FILE ${CMAKE_MODULE_PATH})</font></small></div>
      <div><small><font face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; find_file(DLL
            ${DEPENDENCY} "${PATH_TO_FILE}/bin"})</font></small></div>
      <div><small><font face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
            ENDFOREACH(PATH_TO_FILE)<span class="Apple-tab-span"
              style="white-space: pre;"> </span> &nbsp; &nbsp; &nbsp;&nbsp; <br>
          </font></small></div>
      <div><small><font face="Courier New">&nbsp; &nbsp;&nbsp;</font></small></div>
      <div><small><font face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # Add discovered
            DLL to Installer</font></small></div>
      <div><small><font face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; install(FILES
            ${DLL} DESTINATION "bin" )</font></small></div>
      <small>
      </small>
      <div><small><font face="Courier New"><br>
          </font></small></div>
      <div><small><font face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # Reset DLL
            Variable</font></small></div>
      <div><small><font face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; set(DLL
            "DLL-NOTFOUND")</font></small></div>
      <div><small><font face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp;
            ENDFOREACH(DEPENDENCY)</font></small></div>
      <div><small><font face="Courier New"><br>
          </font></small></div>
      <div><small><font face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; # Add Release TS
            Executable</font></small></div>
      <div><small><font face="Courier New">
            &nbsp; &nbsp; &nbsp; &nbsp; install(TARGETS Program RUNTIME DESTINATION "bin")</font></small></div>
      <div><small><font face="Courier New">&nbsp; &nbsp; ELSE()</font></small></div>
      <div><small><font face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; message("Please build
            ${EXECUTABLE_OUTPUT_PATH}/Release/Program.exe and run CMake
            again.")</font></small></div>
      <small>
      </small>
      <div><small><font face="Courier New">&nbsp; &nbsp; ENDIF(EXISTS
            "${EXECUTABLE_OUTPUT_PATH}/Release/Program.exe")</font></small></div>
      <div><small><font face="Courier New">ENDIF(INSTALLER_WITH_PROGRAM)</font></small></div>
      <small>
      </small></div>
    <br>
  </body>
</html>