[CMake] CMAKE_INSTALL_PREFIX not working in Visual Studio

David Cole david.cole at kitware.com
Mon Oct 20 13:00:47 EDT 2008


How are you configuring? With a CMake GUI or a command line tool?

If with a gui, set the CMAKE_INSTALL_PREFIX in the gui.
If with a command line tool, pass -DCMAKE_INSTALL_PREFIX:STRING=/blah on the
command line.

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.


HTH,
David


On Sun, Oct 19, 2008 at 2:55 AM, Sam Baker <sam.baker at bigfishgames.com>wrote:

>  In my project file I have near the top of the file, the line:
>
>
>
> set(CMAKE_INSTALL_PREFIX ${APP_INSTALL_DIR}/MyApp)
>
>
>
> 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:
>
>
>
> INSTALL(TARGETS MyApp
>
>             RUNTIME DESTINATION .
>
>             LIBRARY DESTINATION .
>
>             ARCHIVE DESTINATION .)
>
>
>
> INSTALL(FILES ${MYAPP_ROOT_DIR}/plugins.cfg
> ${MYAPP_ROOT_DIR}/plugins_debug.cfg DESTINATION .)
>
> INSTALL(DIRECTORY ${MYAPP_ROOT_DIR}/assets DESTINATION .)
>
> # Add Microsoft runtime
>
> set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP TRUE)
>
> INCLUDE(InstallRequiredSystemLibraries)
>
> INSTALL(PROGRAMS ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} DESTINATION .)
>
>
>
> However when I build the install project in Visual Studio, everything is
> installed to C:/Program Files/MyApp/
>
>
>
> Is this a bug or is there something else I need to do to override the
> default install location?
>
>
>
> 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.
>
>
>
> 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 .
>
> 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?
>
>
>
> If this is a bug, let me know and I'll report it.
>
>
>
> Thanks,
> Sam
>
>
>
>
> Big Fish Games, Inc. * A New Game Every Day!™<http://www.bigfishgames.com>
> * <http://www.bigfishgames.com>
>
>
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20081020/63b20967/attachment.htm>


More information about the CMake mailing list