[CMake] CMAKE_INSTALL_PREFIX not working in Visual Studio

Sam Baker sam.baker at bigfishgames.com
Sun Oct 19 02:55:05 EDT 2008


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!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20081018/9d1f62de/attachment.htm>


More information about the CMake mailing list