<div dir="ltr">How are you configuring? With a CMake GUI or a command line tool?<br><br>If with a gui, set the CMAKE_INSTALL_PREFIX in the gui.<br>If with a command line tool, pass -DCMAKE_INSTALL_PREFIX:STRING=/blah on the command line.<br>
<br>To workaround this entirely, invent your own CMake variable that CMake knows nothing about, and then use SET with CACHE, INTERNAL *and* FORCE to set CMAKE_INSTALL_PREFIX to your variable's value.<br><br><br>HTH,<br>
David<br><br><br><div class="gmail_quote">On Sun, Oct 19, 2008 at 2:55 AM, Sam Baker <span dir="ltr"><<a href="mailto:sam.baker@bigfishgames.com">sam.baker@bigfishgames.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div link="blue" vlink="purple" lang="EN-US">
<div>
<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">In my project file I have near the top of the file, the
line:</span></font></p>
<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>
<p style=""><font size="2" face="Courier New"><span style="font-size: 10pt;">set(CMAKE_INSTALL_PREFIX ${APP_INSTALL_DIR}/MyApp)</span></font></p>
<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>
<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">Which I thought would force all install destinations to be
relative to that directory. Later in the same CMakeLists.txt file, I have some
install commands:</span></font></p>
<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>
<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">INSTALL(TARGETS MyApp</span></font></p>
<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"> RUNTIME
DESTINATION .</span></font></p>
<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"> LIBRARY
DESTINATION .</span></font></p>
<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"> ARCHIVE
DESTINATION .)</span></font></p>
<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>
<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">INSTALL(FILES ${MYAPP_ROOT_DIR}/plugins.cfg
${MYAPP_ROOT_DIR}/plugins_debug.cfg DESTINATION .)</span></font></p>
<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">INSTALL(DIRECTORY ${MYAPP_ROOT_DIR}/assets DESTINATION .)</span></font></p>
<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"># Add Microsoft runtime</span></font></p>
<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP TRUE)</span></font></p>
<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">INCLUDE(InstallRequiredSystemLibraries)</span></font></p>
<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">INSTALL(PROGRAMS ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS}
DESTINATION .)</span></font></p>
<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>
<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">However when I build the install project in Visual Studio,
everything is installed to C:/Program Files/MyApp/</span></font></p>
<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>
<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">Is this a bug or is there something else I need to do to
override the default install location?</span></font></p>
<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>
<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">As a test I tried adding message(${CMAKE_INSTALL_PREFIX})
through my CMakeLists.txt before and after the install command and the message
prints out the correct directory, but the Visual Studio project is still installing
to the wrong directory.</span></font></p>
<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>
<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">One thing that might affect this is that I use out of source
add_subdirectory() commands after setting CMAKE_INSTALL_PREFIX and those
themselves install targets using DESTINATION .</span></font></p>
<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">Those should also be going to the parent's
CMAKE_INSTALL_PREFIX dir. Is it possible that they are affecting a global
version of CMAKE_INSTALL_PREFIX by not setting it explicitly themselves?</span></font></p>
<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>
<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">If this is a bug, let me know and I'll report it.</span></font></p>
<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>
<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">Thanks,<br>
Sam</span></font></p>
</div>
<br>
<br>
<div style="font-family: Arial; font-size: 11px; margin-top: 10px; line-height: 130%; color: rgb(102, 102, 102);">
<p>Big Fish Games, Inc. <u>
<span style="color: rgb(102, 102, 102);"><a href="http://www.bigfishgames.com" target="_blank">
A New Game Every Day!™</a></span></u><span style="text-decoration: none;" color="#666666"><a href="http://www.bigfishgames.com" target="_blank">
</a></span></p>
</div>
<br></div>
<br>_______________________________________________<br>
CMake mailing list<br>
<a href="mailto:CMake@cmake.org">CMake@cmake.org</a><br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br></blockquote></div><br></div>