ENH: Added better default install location for windows builds. The previous default /usr/local did not make much sense. Now "%SystemDrive%/Program Files/PROJECT_NAME" is used, which is the windows equivalent to /usr/local.
This commit is contained in:
parent
ec497c7a23
commit
7c7b173042
|
@ -23,16 +23,27 @@ ENDIF(CMAKE_COMPILER_IS_GNUCXX)
|
|||
|
||||
SET (CMAKE_SKIP_RPATH "NO" CACHE BOOL
|
||||
"If set, runtime paths are not added when using shared libraries.")
|
||||
SET (CMAKE_INSTALL_PREFIX /usr/local CACHE PATH
|
||||
"Install path prefix, prepended onto install directories.")
|
||||
|
||||
# Choose a default install prefix for this platform.
|
||||
IF(UNIX)
|
||||
SET(CMAKE_INSTALL_PREFIX "/usr/local"
|
||||
CACHE PATH "Install path prefix, prepended onto install directories.")
|
||||
ELSE(UNIX)
|
||||
IF("$ENV{SystemDrive}" MATCHES "^$")
|
||||
SET(CMAKE_GENERIC_SYSTEM_DRIVE "C:")
|
||||
ELSE("$ENV{SystemDrive}" MATCHES "^$")
|
||||
SET(CMAKE_GENERIC_SYSTEM_DRIVE "$ENV{SystemDrive}")
|
||||
ENDIF("$ENV{SystemDrive}" MATCHES "^$")
|
||||
SET(CMAKE_INSTALL_PREFIX
|
||||
"${CMAKE_GENERIC_SYSTEM_DRIVE}/Program Files/${PROJECT_NAME}"
|
||||
CACHE PATH "Install path prefix, prepended onto install directories.")
|
||||
SET(CMAKE_GENERIC_SYSTEM_DRIVE)
|
||||
MARK_AS_ADVANCED(CMAKE_INSTALL_PREFIX)
|
||||
ENDIF(UNIX)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
CMAKE_SKIP_RPATH
|
||||
)
|
||||
|
||||
IF(NOT UNIX)
|
||||
MARK_AS_ADVANCED(CMAKE_INSTALL_PREFIX)
|
||||
ENDIF(NOT UNIX)
|
||||
|
||||
# always include the gcc compiler information
|
||||
INCLUDE(Platform/gcc)
|
||||
|
|
|
@ -75,10 +75,32 @@ void cmLocalGenerator::GenerateInstallRules()
|
|||
const cmTargets &tgts = m_Makefile->GetTargets();
|
||||
const char* prefix
|
||||
= m_Makefile->GetDefinition("CMAKE_INSTALL_PREFIX");
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
std::string prefix_win32;
|
||||
if(!prefix)
|
||||
{
|
||||
if(!cmSystemTools::GetEnv("SystemDrive", prefix_win32))
|
||||
{
|
||||
prefix_win32 = "C:";
|
||||
}
|
||||
const char* project_name = m_Makefile->GetDefinition("PROJECT_NAME");
|
||||
if(project_name && project_name[0])
|
||||
{
|
||||
prefix_win32 += "/Program Files/";
|
||||
prefix_win32 += project_name;
|
||||
}
|
||||
else
|
||||
{
|
||||
prefix_win32 += "/InstalledCMakeProject";
|
||||
}
|
||||
prefix = prefix_win32.c_str();
|
||||
}
|
||||
#else
|
||||
if (!prefix)
|
||||
{
|
||||
prefix = "/usr/local";
|
||||
}
|
||||
#endif
|
||||
|
||||
std::string file = m_Makefile->GetStartOutputDirectory();
|
||||
std::string homedir = m_Makefile->GetHomeOutputDirectory();
|
||||
|
|
Loading…
Reference in New Issue